Thread: [Libsysio-commit] HEAD: libsysio/src fcntl.c
Brought to you by:
lward
From: Ruth K. <rk...@us...> - 2004-07-20 22:42:01
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20719 Modified Files: fcntl.c Log Message: fcntl may have a non-zero return Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -b -B -p -r1.13 -r1.14 --- fcntl.c 3 Jul 2004 05:47:13 -0000 1.13 +++ fcntl.c 20 Jul 2004 22:41:52 -0000 1.14 @@ -133,7 +133,7 @@ SYSIO_INTERFACE_NAME(fcntl)(int fd, int } out: - SYSIO_INTERFACE_RETURN(err ? -1 : 0, err); + SYSIO_INTERFACE_RETURN((err < 0) ? -1 : err, (err < 0) ? err : 0); } #ifdef __GLIBC__ |
From: Lee W. <lw...@us...> - 2004-07-20 22:50:53
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22448 Modified Files: fcntl.c Log Message: Trivially unnecessary to trouble ourselves with passing the return macro a zero errno when no error is indicated. Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -b -B -p -r1.14 -r1.15 --- fcntl.c 20 Jul 2004 22:41:52 -0000 1.14 +++ fcntl.c 20 Jul 2004 22:50:44 -0000 1.15 @@ -133,7 +133,7 @@ SYSIO_INTERFACE_NAME(fcntl)(int fd, int } out: - SYSIO_INTERFACE_RETURN((err < 0) ? -1 : err, (err < 0) ? err : 0); + SYSIO_INTERFACE_RETURN((err < 0) ? -1 : err, err); } #ifdef __GLIBC__ |
From: Lee W. <lw...@us...> - 2004-07-21 00:45:53
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11301 Modified Files: fcntl.c Log Message: Hmm. I don't know how to use the RETURN macro. Back to the way it was checked in originally. Thanks Ruth. Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -b -B -p -r1.15 -r1.16 --- fcntl.c 20 Jul 2004 22:50:44 -0000 1.15 +++ fcntl.c 21 Jul 2004 00:45:44 -0000 1.16 @@ -133,7 +133,7 @@ SYSIO_INTERFACE_NAME(fcntl)(int fd, int } out: - SYSIO_INTERFACE_RETURN((err < 0) ? -1 : err, err); + SYSIO_INTERFACE_RETURN((err < 0) ? -1 : err, (err < 0) ? err : 0); } #ifdef __GLIBC__ |
From: Ruth K. <rk...@us...> - 2004-07-26 16:37:42
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9662 Modified Files: fcntl.c Log Message: fcntl fixes: fcntl may return a positive or negative value. Driver function interfaces have been changed to accomodate a returned system call value in the arguments. The return value of the driver functions is 0 for success and -errno for failure. Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -b -B -p -r1.16 -r1.17 --- fcntl.c 21 Jul 2004 00:45:44 -0000 1.16 +++ fcntl.c 26 Jul 2004 16:37:18 -0000 1.17 @@ -88,6 +88,7 @@ int SYSIO_INTERFACE_NAME(fcntl)(int fd, int cmd, ...) { int err; + int rtn; struct file *fil; va_list ap; SYSIO_INTERFACE_DISPLAY_BLOCK; @@ -127,13 +128,13 @@ SYSIO_INTERFACE_NAME(fcntl)(int fd, int break; default: va_start(ap, cmd); - err = fil->f_ino->i_ops.inop_fcntl(fil->f_ino, cmd, ap); + err = fil->f_ino->i_ops.inop_fcntl(fil->f_ino, cmd, ap, &rtn); va_end(ap); break; } out: - SYSIO_INTERFACE_RETURN((err < 0) ? -1 : err, (err < 0) ? err : 0); + SYSIO_INTERFACE_RETURN(rtn, err); } #ifdef __GLIBC__ |
From: Lee W. <lw...@us...> - 2004-07-26 17:07:58
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16218 Modified Files: fcntl.c Log Message: Inconsistencies for WITH_LUSTRE_HACK. Implemented the way the drivers are expected to do it now. Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -b -B -p -r1.17 -r1.18 --- fcntl.c 26 Jul 2004 16:37:18 -0000 1.17 +++ fcntl.c 26 Jul 2004 17:07:49 -0000 1.18 @@ -58,16 +58,16 @@ #include <syscall.h> static int -_sysio_fcntl(int fd, int cmd, va_list ap) +_sysio_fcntl(int fd, int cmd, va_list ap, int *rtn) { - int err; long arg; switch (cmd) { case F_GETFD: case F_GETFL: case F_GETOWN: - return syscall(SYS_fcntl, fd, cmd); + *rtn = syscall(SYS_fcntl, fd, cmd); + break; case F_DUPFD: case F_SETFD: case F_SETFL: @@ -76,11 +76,14 @@ _sysio_fcntl(int fd, int cmd, va_list ap case F_SETLKW: case F_SETOWN: arg = va_arg(ap, long); - return syscall(SYS_fcntl, fd, cmd, arg); + *rtn = syscall(SYS_fcntl, fd, cmd, arg); + break; + default: + *rtn = -1; + errno = EINVAL; } - errno = ENOSYS; - return -1; + return *rtn == -1 ? -errno : 0; } #endif @@ -99,12 +102,12 @@ SYSIO_INTERFACE_NAME(fcntl)(int fd, int if (!fil) { #ifdef HAVE_LUSTRE_HACK va_start(ap, cmd); - err = _sysio_fcntl(fd, cmd, ap); + err = _sysio_fcntl(fd, cmd, ap, &rtn); va_end(ap); - if (err == -1) - err = -errno; goto out; #else + + rtn = -1; err = -EBADF; goto out; #endif @@ -120,10 +123,12 @@ SYSIO_INTERFACE_NAME(fcntl)(int fd, int newfd = va_arg(ap, long); va_end(ap); if (newfd != (int )newfd || newfd < 0) { + rtn = -1; err = -EBADF; goto out; } err = _sysio_fd_dup2(fd, (int )newfd); + rtn = !err ? (int )newfd : -1; } break; default: |
From: MeiJia <me...@us...> - 2004-08-05 18:30:08
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25758/src Modified Files: fcntl.c Log Message: lustre hacking specific code: add ioctl support in socket/native driver. not clear how to do with stdfd Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -w -b -B -p -r1.20 -r1.21 --- fcntl.c 27 Jul 2004 15:00:43 -0000 1.20 +++ fcntl.c 5 Aug 2004 18:29:57 -0000 1.21 @@ -59,29 +59,9 @@ static int _sysio_fcntl(int fd, int cmd, va_list ap, int *rtn) { - long arg; + long arg = va_arg(ap, long); - switch (cmd) { - case F_GETFD: - case F_GETFL: - case F_GETOWN: - *rtn = syscall(SYS_fcntl, fd, cmd); - break; - case F_DUPFD: - case F_SETFD: - case F_SETFL: - case F_GETLK: - case F_SETLK: - case F_SETLKW: - case F_SETOWN: - arg = va_arg(ap, long); *rtn = syscall(SYS_fcntl, fd, cmd, arg); - break; - default: - *rtn = -1; - errno = EINVAL; - } - return *rtn == -1 ? -errno : 0; } #endif |
From: Lee W. <lw...@us...> - 2006-01-03 13:05:41
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3827 Modified Files: fcntl.c Log Message: Fix problem in case with duplicate labels when the LK calls are the same as the LK64 calls. For instance, with a 64-bit processor. From Oleg Drokin at Cluster FS. Thanks! Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -w -b -B -p -r1.23 -r1.24 --- fcntl.c 28 Oct 2005 17:59:31 -0000 1.23 +++ fcntl.c 3 Jan 2006 13:05:29 -0000 1.24 @@ -193,6 +193,7 @@ _sysio_vfcntl(int fd, int cmd, va_list a } } break; +#if !(_LARGEFILE64_SOURCE || F_GETLK64 == F_GETLK) case F_GETLK: case F_SETLK: case F_SETLKW: @@ -248,6 +249,7 @@ _sysio_vfcntl(int fd, int cmd, va_list a rtn = 0; } break; +#endif /* !(_LARGEFILE64_SOURCE || F_GETLK64 == F_GETLK) */ #if _LARGEFILE64_SOURCE case F_GETLK64: case F_SETLK64: |
From: Ruth K. <rk...@us...> - 2006-03-24 16:34:14
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11070 Modified Files: fcntl.c Log Message: Fix from Cray, SPR 734613, "bad return values from successful fcntl() file locking calls" Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -w -b -B -p -r1.24 -r1.25 --- fcntl.c 3 Jan 2006 13:05:29 -0000 1.24 +++ fcntl.c 24 Mar 2006 16:34:07 -0000 1.25 @@ -259,8 +259,7 @@ _sysio_vfcntl(int fd, int cmd, va_list a fl64 = va_arg(ap, struct flock64 *); err = _sysio_fcntl_lock(fil, cmd, fl64); - if (err) - rtn = -1; + rtn = err ? -1 : 0; } break; #endif |
From: Lee W. <lw...@us...> - 2007-03-28 20:50:46
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv2180/src Modified Files: fcntl.c Log Message: Need to include definition for struct stat from the system. Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.25 retrieving revision 1.26 diff -u -w -b -B -p -r1.25 -r1.26 --- fcntl.c 24 Mar 2006 16:34:07 -0000 1.25 +++ fcntl.c 28 Mar 2007 20:50:41 -0000 1.26 @@ -42,11 +42,12 @@ */ #include <string.h> -#include <unistd.h> #include <stdlib.h> #include <errno.h> #include <assert.h> #include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> #include <fcntl.h> #include <sys/queue.h> |
From: Lee W. <lw...@us...> - 2007-05-01 15:57:50
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9720 Modified Files: fcntl.c Log Message: Changed #if TOKEN tests to ifdef's. Changed test for GETLK so that it is true w/o LARGEFILE64 too. Index: fcntl.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/fcntl.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -w -b -B -p -r1.27 -r1.28 --- fcntl.c 30 Apr 2007 16:52:20 -0000 1.27 +++ fcntl.c 1 May 2007 15:57:36 -0000 1.28 @@ -194,14 +194,14 @@ _sysio_vfcntl(int fd, int cmd, va_list a } } break; -#if !(_LARGEFILE64_SOURCE || F_GETLK64 == F_GETLK) +#if !(defined(_LARGEFILE64_SOURCE) && F_GETLK64 == F_GETLK) case F_GETLK: case F_SETLK: case F_SETLKW: { struct intnl_stat buf; struct flock *fl; -#if _LARGEFILE64_SOURCE +#ifdef _LARGEFILE64_SOURCE struct _SYSIO_FLOCK flock64; #endif @@ -218,7 +218,7 @@ _sysio_vfcntl(int fd, int cmd, va_list a * Copy args to a temp and normalize. */ fl = va_arg(ap, struct flock *); -#if _LARGEFILE64_SOURCE +#ifdef _LARGEFILE64_SOURCE flock64.l_type = fl->l_type; flock64.l_whence = fl->l_whence; flock64.l_start = fl->l_start; @@ -232,7 +232,7 @@ _sysio_vfcntl(int fd, int cmd, va_list a rtn = -1; break; } -#if _LARGEFILE64_SOURCE +#ifdef _LARGEFILE64_SOURCE /* * Copy back. Note that the fcntl_lock call * should have ensured that no overflow was possible. @@ -248,8 +248,8 @@ _sysio_vfcntl(int fd, int cmd, va_list a rtn = 0; } break; -#endif /* !(_LARGEFILE64_SOURCE || F_GETLK64 == F_GETLK) */ -#if _LARGEFILE64_SOURCE +#endif /* !(_LARGEFILE64_SOURCE && F_GETLK64 == F_GETLK) */ +#ifdef _LARGEFILE64_SOURCE case F_GETLK64: case F_SETLK64: case F_SETLKW64: |