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

From: linux-os (Dick Johnson)
Date: Wed Oct 12 2005 - 10:44:17 EST

On Wed, 12 Oct 2005, Michael Kerrisk wrote:

>> Von: "linux-os \(Dick Johnson\)" <linux-os@xxxxxxxxxxxx>
>> An: "Alex Riesen" <raa.lkml@xxxxxxxxx>
>> Kopie: "Trond Myklebust" <trond.myklebust@xxxxxxxxxx>, <boi@xxxxxx>,
>> "Linux kernel" <linux-kernel@xxxxxxxxxxxxxxx>
>> Betreff: Re: blocking file lock functions (lockf,flock,fcntl) do not
>> return after timer signal
> [...]
>> Datum: Wed, 12 Oct 2005 11:20:26 -0400
>> As I told you, you use sigaction(). Also flock() will not block
>> unless there is another open on the file. The code will run to
>> your blocking read(), wait 10 seconds, get your "timeout" from
>> the signal handler, then read() will return with -1 and ERESTARTSYS
>> in errno as required.
> I was just trying to write a message to say the same ;-).
>> 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().

> Cheers,
> Michael
> --
> 10 GB Mailbox, 100 FreeSMS/Monat
> +++ GMX - die erste Adresse für Mail, Message, More +++

Dick Johnson
Penguin : Linux version on an i686 machine (5589.56 BogoMips).
Warning : 98.36% of all statistics are fiction.

The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to DeliveryErrors@xxxxxxxxxxxx - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at