Bug 102864 - fcntl() does not interrupt on receiving a signal
fcntl() does not interrupt on receiving a signal
Product: Red Hat Linux
Classification: Retired
Component: kernel (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Arjan van de Ven
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2003-08-21 18:45 EDT by Need Real Name
Modified: 2007-04-18 12:57 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-09-30 11:41:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

  None (edit)
Description Need Real Name 2003-08-21 18:45:09 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;
     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 18:47:15 EDT
Created attachment 93842 [details]
unit test
Comment 2 Need Real Name 2003-08-21 18:50:36 EDT
Created attachment 93843 [details]
unit test
Comment 3 Jakub Jelinek 2003-08-25 08:17:39 EDT
glibc just calls fcntl64 syscall; changing component.
Comment 4 Christophe Lambin 2003-11-22 18:08:04 EST
Same behaviour observed on FC1, which runs 2.4.22-1.2115.nptl
Comment 5 Bugzilla owner 2004-09-30 11:41:27 EDT
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.