Re: blocking file lock functions (lockf,flock,fcntl) do not return after timer signal

From: Michael Kerrisk
Date: Wed Oct 12 2005 - 11:06:00 EST


> >> Also, using a 'C' runtime library call like write() in a signal-
> >> handler is a bug.
> >
> > But this is not correct. write() is async-signal-safe (POSIX
> > requires it).
>
> Then tell it to the doom-sayers who always excoriate me when
> I use a 'C' runtime library call in test signal code. I have
> been told that the __only__ thing you can do in a signal handler
> is access global memory and/or execute siglongjmp().

Nevertheless, it is not so. The problem that some may
complain about is not C RTL code, but perhaps using
printf() (wrong) instead of write()


From:
http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04

The following table defines a set of functions that shall
be either reentrant or non-interruptible by signals and
shall be async-signal-safe. Therefore applications may
invoke them, without restriction, from signal-catching
functions:
[...]
write()

Cheers,

Michael

--
NEU: Telefon-Flatrate fürs dt. Festnetz! GMX Phone_Flat: 9,99 Euro/Mon.*
Für DSL-Nutzer. Ohne Providerwechsel! http://www.gmx.net/de/go/telefonie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/