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

From: Michael Kerrisk
Date: Wed Oct 12 2005 - 10:38:05 EST


> 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).

Cheers,

Michael

--
10 GB Mailbox, 100 FreeSMS/Monat http://www.gmx.net/de/go/topmail
+++ GMX - die erste Adresse für Mail, Message, More +++
-
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/