[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

glibc preparation patch for lockf support in Hurd



Hi,

The following patch to sysdeps/mach/hurd/bits/fcntl.h is needed for
future support of posix file locking support in Hurd. These patches are
an update of Neals patches from 2001 adapted for libpthread instead of
cthreads.

The reason this is needed is that the MIG generated RPC for hurd/glibc
currently does not support mixed 32 and 64 bit entries, in this case for
struct flock. Problems arise when hurd is compiled with
-D_FILE_OFFSET_BITS=64 in CPPFLAGS which defines __USE_FILE_OFFSET64.

Used by MIG:
/usr/include/hurd/hurd_types.defs
type flock_t = struct[5] of int;

Set as default in hurd/Makeconf:
CPPFLAGS += ... -D_FILE_OFFSET_BITS=64 ...

/usr/include/i386-gnu/bits/fcntl.h
struct flock
  {
    int l_type;         /* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.
*/
    int l_whence;       /* Where `l_start' is relative to (like
`lseek').  */
#ifndef __USE_FILE_OFFSET64
    __off_t l_start;    /* Offset where the lock begins.  */
    __off_t l_len;      /* Size of the locked area; zero means until
EOF.  */
#else
    __off64_t l_start;  /* Offset where the lock begins.  */
    __off64_t l_len;    /* Size of the locked area; zero means until
EOF.  */
#endif
    __pid_t l_pid;      /* Process holding the lock.  */
  };

Index: glibc-2.19/sysdeps/mach/hurd/bits/fcntl.h
===================================================================
--- glibc-2.19.orig/sysdeps/mach/hurd/bits/fcntl.h
+++ glibc-2.19/sysdeps/mach/hurd/bits/fcntl.h
@@ -184,7 +184,7 @@ struct flock
   {
     int l_type;		/* Type of lock: F_RDLCK, F_WRLCK, or F_UNLCK.  */
     int l_whence;	/* Where `l_start' is relative to (like `lseek').  */
-#ifndef __USE_FILE_OFFSET64
+#if !defined(__USE_FILE_OFFSET64) || defined(MIG_32BIT_STRUCT_FLOCK)
     __off_t l_start;	/* Offset where the lock begins.  */
     __off_t l_len;	/* Size of the locked area; zero means until EOF.  */
 #else

Reply to: