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

From: Trond Myklebust
Date: Wed Oct 12 2005 - 11:38:27 EST


on den 12.10.2005 Klokka 17:10 (+0200) skreiv Alex Riesen:

> > Desktop$ ./gnurr gnarg
> > locking...
> > timeout
> > timeout
> > timeout
> > timeout
> > timeout
>
> Doesn't look so. I'd expect "flock: EWOULDBLOCK" and "sleeping" after
> the first timeout.

I would rather expect flock to return with ERESTARTSYS and then for libc
to restart the syscall once the signal handler has finished executing.
A stint with the "strace" utility will show you that this is precisely
what happens.

As Dick and others already pointed out to you, the POSIX function
sigaction() allows you to disable the automatic restarting of the
syscall.

Cheers,
Trond

-
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/