Bug 102864 - fcntl() does not interrupt on receiving a signal
Summary: fcntl() does not interrupt on receiving a signal
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: kernel
Version: 9
Hardware: i686
OS: Linux
Target Milestone: ---
Assignee: Arjan van de Ven
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2003-08-21 22:45 UTC by Need Real Name
Modified: 2007-04-18 16:57 UTC (History)
0 users

Clone Of:
Last Closed: 2004-09-30 15:41:27 UTC

Attachments (Terms of Use)
unit test (961 bytes, text/plain)
2003-08-21 22:47 UTC, Need Real Name
no flags Details
unit test (962 bytes, text/plain)
2003-08-21 22:50 UTC, Need Real Name
no flags Details

Description Need Real Name 2003-08-21 22:45:09 UTC
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;
     alarm (3);
     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):

Comment 1 Need Real Name 2003-08-21 22:47:15 UTC
Created attachment 93842 [details]
unit test

Comment 2 Need Real Name 2003-08-21 22:50:36 UTC
Created attachment 93843 [details]
unit test

Comment 3 Jakub Jelinek 2003-08-25 12:17:39 UTC
glibc just calls fcntl64 syscall; changing component.

Comment 4 Christophe Lambin 2003-11-22 23:08:04 UTC
Same behaviour observed on FC1, which runs 2.4.22-1.2115.nptl

Comment 5 Bugzilla owner 2004-09-30 15:41:27 UTC
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/

Note You need to log in before you can comment on or make changes to this bug.