Roland McGrath, le Tue 19 Aug 2014 13:26:25 -0700, a écrit : > If we were starting from scratch, we'd use 64-bit types unconditionally. > But given that we already have off_t that is sometimes 32 bits, we should > be consistent with the other systems that have this distinction. That > means F_GETLK64 should be a different value from F_GETLK in the ABI, and > F_GETLK gets that value under __USE_FILE_OFFSET64 (where 'struct flock' > also gets the 'struct flock64' layout).
Ok, so that will be something like this. Samuel diff --git a/sysdeps/mach/hurd/bits/fcntl.h b/sysdeps/mach/hurd/bits/fcntl.h index 392c140..58f63ff 100644 --- a/sysdeps/mach/hurd/bits/fcntl.h +++ b/sysdeps/mach/hurd/bits/fcntl.h @@ -163,9 +163,18 @@ # define F_GETOWN 5 /* Get owner (receiver of SIGIO). */ # define F_SETOWN 6 /* Set owner (receiver of SIGIO). */ #endif +#ifdef __USE_FILE_OFFSET64 +#define F_GETLK F_GETLK64 +#define F_SETLK F_SETLK64 +#define F_SETLKW F_SETLKW64 +#else #define F_GETLK 7 /* Get record locking info. */ #define F_SETLK 8 /* Set record locking info (non-blocking). */ #define F_SETLKW 9 /* Set record locking info (blocking). */ +#endif +#define F_GETLK64 10 /* Get record locking info. */ +#define F_SETLK64 11 /* Set record locking info (non-blocking). */ +#define F_SETLKW64 12 /* Set record locking info (blocking). */ #ifdef __USE_XOPEN2K8 # define F_DUPFD_CLOEXEC 1030 /* Duplicate, set FD_CLOEXEC on new one. */ diff --git a/sysdeps/mach/hurd/fcntl.c b/sysdeps/mach/hurd/fcntl.c index 813f337..7196279 100644 --- a/sysdeps/mach/hurd/fcntl.c +++ b/sysdeps/mach/hurd/fcntl.c @@ -128,6 +128,8 @@ __libc_fcntl (int fd, int cmd, ...) case F_SETLK: case F_SETLKW: { + /* XXX: TODO: replace with conversion to flock64 and actual + implementation. */ /* XXX We need new RPCs to support POSIX.1 fcntl file locking!! For the time being we support the whole-file case only, @@ -179,6 +181,13 @@ __libc_fcntl (int fd, int cmd, ...) return __flock (fd, cmd); } + case F_GETLK64: + case F_SETLK64: + case F_SETLKW64: + { + struct flock64 *fl = va_arg (ap, struct flock64 *); + /* TODO: implementation */ + } case F_GETFL: /* Get per-open flags. */ if (err = HURD_FD_PORT_USE (d, __io_get_openmodes (port, &result)))