This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: fork() and syslog() locks each other. How to avoid?
- From: Daniel Jacobowitz <drow at false dot org>
- To: "Peter Volkov (pva)" <pva at gentoo dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Sat, 23 Sep 2006 10:05:14 -0400
- Subject: Re: fork() and syslog() locks each other. How to avoid?
- References: <1159020013.2975.38.camel@localhost>
On Sat, Sep 23, 2006 at 06:00:13PM +0400, Peter Volkov (pva) wrote:
> I did not checked but seems that fork function takes mutex which syslog
> will waits for it. If I'm right then the question is what is the right
> way to avoid such situations but to keep program behavior?
Avoid calling syslog from a signal handler. Take a look at POSIX, and
you'll find a list of which C library functions are required to be safe
when called from signal handlers - and syslog is not on it.
--
Daniel Jacobowitz
CodeSourcery