Bug 19730 - Problems locking a file opened with FILE_OFFSET_BITS 64
Summary: Problems locking a file opened with FILE_OFFSET_BITS 64
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: glibc
Version: 7.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Aaron Brown
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-10-24 23:20 UTC by Gerd v. Egidy
Modified: 2016-11-24 16:17 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2000-10-25 10:28:28 UTC
Embargoed:


Attachments (Terms of Use)
the program (482 bytes, text/plain)
2000-10-24 23:21 UTC, Gerd v. Egidy
no flags Details

Description Gerd v. Egidy 2000-10-24 23:20:51 UTC
The following Program, compiled and ran under RH7 with glibc 2.1.94-3 and a
2.2 kernel, failes. The same prog compiled and ran under RH6.2, glibc
2.1.2-11 works perfectly.

The Program:

#define _FILE_OFFSET_BITS 64

#include <stdio.h>
#include <fcntl.h>
#include <errno.h>

int main()
{
  struct flock  plockb;
  int           lock_failed;
  int           fd;

  fd = open("test", O_RDWR | O_CREAT, 0644);

  plockb.l_type = F_WRLCK;
  plockb.l_whence = SEEK_SET;
  plockb.l_start=0;
  plockb.l_len=0;

  lock_failed = fcntl(fd, F_SETLK, &plockb);

  if(lock_failed)
  {
        printf("errno: %i string: %s\n",errno,strerror(errno));
  }
  else
  {
        printf("success\n");
  } 

  close(fd);

}

strace with RH7:

open("test", O_RDWR|O_CREAT|O_LARGEFILE, 0644) = 3
fcntl64(3, 0xd /* F_??? */, 0xbffffb10) = -1 ENOSYS (Function not
implemented)
fcntl(3, 0xd /* F_??? */, 0xbffffaa0)   = -1 EINVAL (Invalid argument)

strace with RH6.2:

open("test", O_RDWR|O_CREAT|O_LARGEFILE, 0644) = 3
fcntl(3, F_SETLK, {type=F_WRLCK, whence=SEEK_SET, start=0, len=0}) = 0

Comment 1 Gerd v. Egidy 2000-10-24 23:21:46 UTC
Created attachment 4633 [details]
the program

Comment 2 Jakub Jelinek 2000-10-25 10:28:24 UTC
It would work with 2.4 kernels. I hope I've fixed this in
http://sources.redhat.com/ml/libc-hacker/2000-10/msg00084.html
If Ulrich accepts this, it will make into next glibc errata.


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