Red Hat Bugzilla – Bug 102864
fcntl() does not interrupt on receiving a signal
Last modified: 2007-04-18 12:57:03 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
Description of problem:
When fnctl() is blocked trying to set a lock on a file, it does not get
interrupted when the process receives a signal:
signal (SIGALRM, alarm_handler);
flk.l_type = F_WRLCK;
rc = fcntl (fd, F_SETLKW, &flk);
After three seconds, the signal handler is called, but fcntl continues to
block until it eventually manages to lock the file.
The fcntl() manpage says:
As for F_SETLK, but if a conflicting lock is held on the file,
then wait for that lock to be released. If a signal is caught
while waiting, then the call is interrupted and (after the sig-
nal handler has returned) returns immediately (with return value
-1 and errno set to EINTR).
I may be misinterpreting the manpage (in which case I apologize), but I've
seen the expected behavior on HP-UX, Solaris & AIX.
Version-Release number of selected component (if applicable):
Created attachment 93842 [details]
Created attachment 93843 [details]
glibc just calls fcntl64 syscall; changing component.
Same behaviour observed on FC1, which runs 2.4.22-1.2115.nptl
Thanks for the bug report. However, Red Hat no longer maintains this version of
the product. Please upgrade to the latest version and open a new bug if the problem
The Fedora Legacy project (http://fedoralegacy.org/) maintains some older releases,
and if you believe this bug is interesting to them, please report the problem in
the bug tracker at: http://bugzilla.fedora.us/