[Libsysio-commit] HEAD: libsysio/drivers/native fs_native.c
Brought to you by:
lward
From: Ruth K. <rk...@us...> - 2004-07-26 16:38:09
|
Update of /cvsroot/libsysio/libsysio/drivers/native In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10551/drivers/native Modified Files: fs_native.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_native.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/drivers/native/fs_native.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -w -b -B -p -r1.42 -r1.43 --- fs_native.c 23 Jul 2004 15:11:57 -0000 1.42 +++ fs_native.c 26 Jul 2004 16:37:59 -0000 1.43 @@ -249,7 +249,7 @@ static int native_inop_read(struct inode static int native_inop_write(struct inode *ino, struct ioctx *ioctx); static _SYSIO_OFF_T native_inop_pos(struct inode *ino, _SYSIO_OFF_T off); static int native_inop_iodone(struct ioctx *ioctx); -static int native_inop_fcntl(struct inode *ino, int cmd, va_list ap); +static int native_inop_fcntl(struct inode *ino, int cmd, va_list ap, int *rtn); static int native_inop_sync(struct inode *ino); static int native_inop_datasync(struct inode *ino); static int native_inop_ioctl(struct inode *ino, @@ -1614,7 +1614,8 @@ native_inop_iodone(struct ioctx *ioctxp static int native_inop_fcntl(struct inode *ino, int cmd, - va_list ap) + va_list ap, + int *rtn) { struct native_inode *nino = I2NI(ino); long arg; @@ -1623,12 +1624,15 @@ native_inop_fcntl(struct inode *ino, if (nino->ni_fd < 0) abort(); + err = 0; switch (cmd) { case F_GETFD: case F_GETFL: +#ifdef F_GETOWN case F_GETOWN: - err = syscall(SYS_fcntl, nino->ni_fd, cmd); - if (err < 0) +#endif + *rtn = syscall(SYS_fcntl, nino->ni_fd, cmd); + if (*rtn == -1) err = -errno; break; case F_DUPFD: @@ -1637,13 +1641,16 @@ native_inop_fcntl(struct inode *ino, case F_GETLK: case F_SETLK: case F_SETLKW: +#ifdef F_SETOWN case F_SETOWN: +#endif arg = va_arg(ap, long); - err = syscall(SYS_fcntl, nino->ni_fd, cmd, arg); - if (err) + *rtn = syscall(SYS_fcntl, nino->ni_fd, cmd, arg); + if (*rtn == -1) err = -errno; break; default: + *rtn = -1; err = -EINVAL; } return err; |