[Libsysio-commit] HEAD: libsysio/drivers/yod fs_yod.c
Brought to you by:
lward
From: Ruth K. <rk...@us...> - 2004-07-26 16:38:09
|
Update of /cvsroot/libsysio/libsysio/drivers/yod In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10551/drivers/yod Modified Files: fs_yod.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: fs_yod.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/yod/fs_yod.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -w -b -B -p -r1.15 -r1.16 --- fs_yod.c 3 Jul 2004 05:47:12 -0000 1.15 +++ fs_yod.c 26 Jul 2004 16:38:00 -0000 1.16 @@ -1101,18 +1101,45 @@ yod_inop_iodone(struct ioctx *ioctxp __I } static int -yod_inop_fcntl(struct inode *ino __IS_UNUSED, int cmd, va_list ap __IS_UNUSED) +yod_inop_fcntl(struct inode *ino, int cmd, va_list ap, int *rtn) { - switch (cmd) - { - case F_DUPFD: /* do something to the ino */ + struct yod_inode *nino = I2NI(ino); + long arg; + int err; + + if (nino->ni_fd < 0) + abort(); + + err = 0; + switch (cmd) { + case F_GETFD: + case F_GETFL: +#ifdef F_GETOWN + case F_GETOWN: +#endif + *rtn = syscall(SYS_fcntl, nino->ni_fd, cmd); + if (*rtn == -1) + err = -errno; + break; + case F_DUPFD: + case F_SETFD: + case F_SETFL: + case F_GETLK: + case F_SETLK: + case F_SETLKW: +#ifdef F_SETOWN + case F_SETOWN: +#endif + arg = va_arg(ap, long); + *rtn = syscall(SYS_fcntl, nino->ni_fd, cmd, arg); + if (*rtn == -1) + err = -errno; break; default: - errno = EINVAL; - return -1; + *rtn = -1; + err = -EINVAL; } - return 0; - + return err; } static int |