Thread: [Libsysio-commit] HEAD: libsysio/src rw.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2004-04-12 15:50:16
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13297/src Modified Files: rw.c Log Message: Bug fix for Cray SPR 728620. In _sysio_sum_iovec a zero length iovec entry was not accounted for. This caused the routine to believe an overflow had occurred since the count didn't move after adding the xfer length. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -w -b -B -p -r1.3 -r1.4 --- rw.c 14 Feb 2004 19:42:59 -0000 1.3 +++ rw.c 12 Apr 2004 15:36:06 -0000 1.4 @@ -184,7 +184,7 @@ _sysio_sum_iovec(const struct iovec *iov while (count--) { tmp = cc; cc += iov->iov_len; - if (tmp && cc <= tmp) + if (tmp && iov->iov_len && cc <= tmp) return -EINVAL; iov++; } |
From: Lee W. <lw...@us...> - 2004-04-12 15:54:49
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13890/src Modified Files: rw.c Log Message: From Kevin Pedretti: Various rw routines returned a negated errno on errors. The _sysio_sum_iovec returns a count or negated errno. The internal helper routines were inverting this on error but indicating error themselves. The public interface routines would then invert the error number again before setting errno. The result; -1 * -1 * -n. Changed the helper routines to pass the error number untouched. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -w -b -B -p -r1.4 -r1.5 --- rw.c 12 Apr 2004 15:36:06 -0000 1.4 +++ rw.c 12 Apr 2004 15:40:58 -0000 1.5 @@ -210,7 +210,7 @@ _sysio_iiov(int (*f)(struct inode *, str cc = _sysio_sum_iovec(iov, count); if (cc < 0) - return (int )-cc; + return (int )cc; xtv->xtv_off = fil->f_pos; xtv->xtv_len = cc; off = xtv->xtv_off + xtv->xtv_len; @@ -442,7 +442,7 @@ _sysio_ipiov(int (*f)(struct inode *, st cc = _sysio_sum_iovec(iov, count); if (cc < 0) { SYSIO_LEAVE; - return (int )-cc; + return (int )cc; } xtv->xtv_off = off, xtv->xtv_len = cc; |
From: Lee W. <lw...@us...> - 2004-06-04 14:05:52
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17716/src Modified Files: rw.c Log Message: From Eric Mei; A file opened O_RDONLY may be written to. The mode check performed in _sysio_fd_find_capable can't simply check the open mode flags as a mask as O_RDONLY is the absence of any bits. Got rid of _sysio_fd_find_capable and just call _sysio_fd_find straight away. Then, modified _sysio_iiox to make the approrpiate mode check before attempting the operation now. Am leveraging the recent changes for accounting support where the operation is known. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -w -b -B -p -r1.9 -r1.10 --- rw.c 28 May 2004 12:48:27 -0000 1.9 +++ rw.c 4 Jun 2004 14:05:38 -0000 1.10 @@ -102,6 +102,14 @@ _sysio_iiox(int (*f)(struct inode *, str int err; struct ioctx_callback *cb; + /* + * Check that it was opened with flags supporting the operation. + */ + if (!(wr + ? (fil->f_flags & (O_RDWR | O_WRONLY)) + : !(fil->f_flags & O_WRONLY))) + return -EBADF; + ino = fil->f_ino; if (!ino) { /* @@ -156,21 +164,6 @@ _sysio_iiox(int (*f)(struct inode *, str } /* - * Find file record from descriptor and return it if capable based on the - * bit-mask of cleared flag bits. - */ -struct file * -_sysio_fd_find_capable(int fd, int clear) -{ - struct file *fil; - - fil = _sysio_fd_find(fd); - if (!fil || fil->f_flags & clear) - return NULL; - return fil; -} - -/* * Sum iovec entries, returning total found or error if range of ssize_t would * be exceeded. */ @@ -256,7 +249,7 @@ SYSIO_INTERFACE_NAME(ireadv)(int fd, con SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_WRONLY); + fil = _sysio_fd_find(fd); if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); @@ -288,7 +281,7 @@ SYSIO_INTERFACE_NAME(readv)(int fd, cons SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_WRONLY); + fil = _sysio_fd_find(fd); if (!fil) SYSIO_INTERFACE_RETURN(-1, -EBADF); @@ -332,7 +325,7 @@ SYSIO_INTERFACE_NAME(iread)(int fd, void SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_WRONLY); + fil = _sysio_fd_find(fd); if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); @@ -373,7 +366,7 @@ SYSIO_INTERFACE_NAME(read)(int fd, void SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_WRONLY); + fil = _sysio_fd_find(fd); if (!fil) SYSIO_INTERFACE_RETURN(-1, -EBADF); @@ -452,7 +445,7 @@ PREPEND(_, SYSIO_INTERFACE_NAME(ipreadv) SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_WRONLY); + fil = _sysio_fd_find(fd); if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); @@ -507,7 +500,7 @@ PREPEND(_, SYSIO_INTERFACE_NAME(preadv)) SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_WRONLY); + fil = _sysio_fd_find(fd); if (!fil) SYSIO_INTERFACE_RETURN(-1, -EBADF); @@ -557,7 +550,7 @@ PREPEND(_, SYSIO_INTERFACE_NAME(ipread)) SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_WRONLY); + fil = _sysio_fd_find(fd); if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); @@ -622,7 +615,7 @@ PREPEND(_, SYSIO_INTERFACE_NAME(pread))( SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_WRONLY); + fil = _sysio_fd_find(fd); if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); @@ -688,7 +681,7 @@ PREPEND(_, SYSIO_INTERFACE_NAME(ireadx)) SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_WRONLY); + fil = _sysio_fd_find(fd); if (!(fil && xtv_count)) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); @@ -723,7 +716,7 @@ SYSIO_INTERFACE_NAME(ireadx)(int fd, SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_WRONLY); + fil = _sysio_fd_find(fd); if (!(fil && xtv_count)) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); @@ -822,7 +815,7 @@ SYSIO_INTERFACE_NAME(iwritev)(int fd, SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_RDONLY); + fil = _sysio_fd_find(fd); if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); @@ -854,7 +847,7 @@ SYSIO_INTERFACE_NAME(writev)(int fd, con SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_RDONLY); + fil = _sysio_fd_find(fd); if (!fil) SYSIO_INTERFACE_RETURN(-1, -EBADF); @@ -890,7 +883,7 @@ SYSIO_INTERFACE_NAME(iwrite)(int fd, con SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_RDONLY); + fil = _sysio_fd_find(fd); if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); @@ -931,7 +924,7 @@ SYSIO_INTERFACE_NAME(write)(int fd, cons SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_RDONLY); + fil = _sysio_fd_find(fd); if (!fil) SYSIO_INTERFACE_RETURN(-1, -EBADF); @@ -971,7 +964,7 @@ PREPEND(_, SYSIO_INTERFACE_NAME(ipwritev SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_RDONLY); + fil = _sysio_fd_find(fd); if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); @@ -1026,7 +1019,7 @@ PREPEND(_, SYSIO_INTERFACE_NAME(pwritev) SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_RDONLY); + fil = _sysio_fd_find(fd); if (!fil) SYSIO_INTERFACE_RETURN(-1, -EBADF); @@ -1076,7 +1069,7 @@ PREPEND(_, SYSIO_INTERFACE_NAME(ipwrite) SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_RDONLY); + fil = _sysio_fd_find(fd); if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); @@ -1141,7 +1134,7 @@ PREPEND(_, SYSIO_INTERFACE_NAME(pwrite)) SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_RDONLY); + fil = _sysio_fd_find(fd); if (!fil) SYSIO_INTERFACE_RETURN(-1, -EBADF); @@ -1207,7 +1200,7 @@ PREPEND(_, SYSIO_INTERFACE_NAME(iwritex) SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_RDONLY); + fil = _sysio_fd_find(fd); if (!(fil && xtv_count)) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); @@ -1242,7 +1235,7 @@ SYSIO_INTERFACE_NAME(iwritex)(int fd, SYSIO_INTERFACE_DISPLAY_BLOCK; SYSIO_INTERFACE_ENTER; - fil = _sysio_fd_find_capable(fd, O_RDONLY); + fil = _sysio_fd_find(fd); if (!(fil && xtv_count)) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); |
From: Sonja T. <so...@us...> - 2004-08-13 14:40:18
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7514/src Modified Files: rw.c Log Message: Removed definition of MAX_IOVEC from fs_native.c Fixed ireadx to verify the iov_counts and xtv_counts are valid Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -w -b -B -p -r1.12 -r1.13 --- rw.c 27 Jul 2004 15:00:48 -0000 1.12 +++ rw.c 13 Aug 2004 14:40:09 -0000 1.13 @@ -682,9 +682,18 @@ PREPEND(_, SYSIO_INTERFACE_NAME(ireadx)) SYSIO_INTERFACE_ENTER; fil = _sysio_fd_find(fd); - if (!(fil && xtv_count)) + if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); + /* Perform a check on the iov_count and xtv_count */ + if ((iov_count == 0) || (xtv_count == 0)) + SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); + +#ifdef MAX_IOVEC + if ((iov_count >= MAX_IOVEC) || (xtv_count >= MAX_IOVEC)) + SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); +#endif + err = _sysio_iiox(IIOXOP_READ(fil->f_ino), fil, @@ -717,9 +726,20 @@ SYSIO_INTERFACE_NAME(ireadx)(int fd, SYSIO_INTERFACE_ENTER; fil = _sysio_fd_find(fd); - if (!(fil && xtv_count)) + if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); + + /* Perform a check on the iov_count and xtv_count */ + if ((iov_count == 0) || (xtv_count == 0)) + SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); + +#ifdef MAX_IOVEC + if ((iov_count >= MAX_IOVEC) || (xtv_count >= MAX_IOVEC)) + SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); +#endif + + ixtv = ixtvent = malloc(xtv_count * sizeof(struct intnl_xtvec)); if (!ixtv) SYSIO_INTERFACE_RETURN(IOID_FAIL, -ENOMEM); |
From: Sonja T. <so...@us...> - 2004-08-13 15:02:59
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11990/src Modified Files: rw.c Log Message: Try 2: take out the MAX_IOVEC references, revert fs_native.c back to its original form (which still has the MAX_IOVEC references, but it defines it and undefines it within one routine...although this still means that someone can define MAX_IOVEC and force the call to _sysio_enumerate_iovec instead of the syscall, but that doesn't place any strict limit on the number of iovecs) Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -w -b -B -p -r1.13 -r1.14 --- rw.c 13 Aug 2004 14:40:09 -0000 1.13 +++ rw.c 13 Aug 2004 15:02:50 -0000 1.14 @@ -689,11 +689,6 @@ PREPEND(_, SYSIO_INTERFACE_NAME(ireadx)) if ((iov_count == 0) || (xtv_count == 0)) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); -#ifdef MAX_IOVEC - if ((iov_count >= MAX_IOVEC) || (xtv_count >= MAX_IOVEC)) - SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); -#endif - err = _sysio_iiox(IIOXOP_READ(fil->f_ino), fil, @@ -734,12 +729,6 @@ SYSIO_INTERFACE_NAME(ireadx)(int fd, if ((iov_count == 0) || (xtv_count == 0)) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); -#ifdef MAX_IOVEC - if ((iov_count >= MAX_IOVEC) || (xtv_count >= MAX_IOVEC)) - SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); -#endif - - ixtv = ixtvent = malloc(xtv_count * sizeof(struct intnl_xtvec)); if (!ixtv) SYSIO_INTERFACE_RETURN(IOID_FAIL, -ENOMEM); |
From: Ruth K. <rk...@us...> - 2004-09-29 21:18:09
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1275 Modified Files: rw.c Log Message: Cray New_SPR_730113 SN: WRITEX() SETS ERRNO EBADF INSTEAD OF EINVAL Correct the check for 0 xtvecs in writex. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -w -b -B -p -r1.14 -r1.15 --- rw.c 13 Aug 2004 15:02:50 -0000 1.14 +++ rw.c 29 Sep 2004 21:17:58 -0000 1.15 @@ -1245,9 +1245,13 @@ SYSIO_INTERFACE_NAME(iwritex)(int fd, SYSIO_INTERFACE_ENTER; fil = _sysio_fd_find(fd); - if (!(fil && xtv_count)) + if (!fil) SYSIO_INTERFACE_RETURN(IOID_FAIL, -EBADF); + /* Perform a check on the iov_count and xtv_count */ + if ((iov_count == 0) || (xtv_count == 0)) + SYSIO_INTERFACE_RETURN(IOID_FAIL, -EINVAL); + ixtv = ixtvent = malloc(xtv_count * sizeof(struct intnl_xtvec)); if (!ixtv) SYSIO_INTERFACE_RETURN(IOID_FAIL, -ENOMEM); |
From: Lee W. <lw...@us...> - 2007-04-12 18:01:26
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv26307/src Modified Files: rw.c Log Message: Use F_CHKRW macro to test desired access. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -w -b -B -p -r1.16 -r1.17 --- rw.c 25 Jan 2005 00:37:14 -0000 1.16 +++ rw.c 12 Apr 2007 18:01:23 -0000 1.17 @@ -105,9 +105,7 @@ _sysio_iiox(int (*f)(struct inode *, str /* * Check that it was opened with flags supporting the operation. */ - if (!(wr - ? (fil->f_flags & (O_RDWR | O_WRONLY)) - : !(fil->f_flags & O_WRONLY))) + if (!F_CHKRW(fil, wr ? 'w' : 'r')) return -EBADF; ino = fil->f_ino; |
From: Lee W. <lw...@us...> - 2007-04-30 19:36:47
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv11167 Modified Files: rw.c Log Message: Added the internal glibc names for {p}{read,write}{v}. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -w -b -B -p -r1.18 -r1.19 --- rw.c 30 Apr 2007 16:52:20 -0000 1.18 +++ rw.c 30 Apr 2007 19:36:44 -0000 1.19 @@ -787,6 +787,15 @@ SYSIO_INTERFACE_NAME(pread64)(int fd, vo return _do_pio(fd, _do_ireadx, buf, count, offset); } +#if defined(__GLIBC__) +#undef __pread64 +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(pread64), + PREPEND(__, SYSIO_INTERFACE_NAME(pread64))) +#undef __libc_pread64 +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(pread64), + PREPEND(__, SYSIO_INTERFACE_NAME(libc_pread64))) +#endif + ssize_t SYSIO_INTERFACE_NAME(pwrite64)(int fd, const void *buf, size_t count, @@ -795,6 +804,15 @@ SYSIO_INTERFACE_NAME(pwrite64)(int fd, return _do_pio(fd, _do_iwritex, (void *)buf, count, offset); } + +#if defined(__GLIBC__) +#undef __pwrite64 +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(pwrite64), + PREPEND(__, SYSIO_INTERFACE_NAME(pwrite64))) +#undef __libc_pwrite64 +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(pwrite64), + PREPEND(__, SYSIO_INTERFACE_NAME(libc_pwrite64))) +#endif /* defined(__GLIBC__) */ #endif ssize_t @@ -807,6 +825,15 @@ SYSIO_INTERFACE_NAME(pread)(int fd, return _do_pio(fd, _do_ireadx, buf, count, offset); } +#if defined(__GLIBC__) +#undef __pread +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(pread), + PREPEND(__, SYSIO_INTERFACE_NAME(pread))) +#undef __libc_pread +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(pread), + PREPEND(__, SYSIO_INTERFACE_NAME(libc_pread))) +#endif /* defined(__GLIBC__) */ + ssize_t SYSIO_INTERFACE_NAME(pwrite)(int fd, const void *buf, @@ -817,6 +844,15 @@ SYSIO_INTERFACE_NAME(pwrite)(int fd, return _do_pio(fd, _do_iwritex, (void *)buf, count, offset); } +#if defined(__GLIBC__) +#undef __pwrite +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(pwrite), + PREPEND(__, SYSIO_INTERFACE_NAME(pwrite))) +#undef __libc_pwrite +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(pwrite), + PREPEND(__, SYSIO_INTERFACE_NAME(libc_pwrite))) +#endif /* defined(__GLIBC__) */ + /* * Post asynch IO using fildes and iovec. */ @@ -919,6 +955,15 @@ SYSIO_INTERFACE_NAME(readv)(int fd, cons return _do_iov(fd, SYSIO_INTERFACE_NAME(ireadv), iov, count); } +#if defined(__GLIBC__) +#undef __readv +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(readv), + PREPEND(__, SYSIO_INTERFACE_NAME(readv))) +#undef __libc_readv +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(readv), + PREPEND(__, SYSIO_INTERFACE_NAME(libc_readv))) +#endif + ssize_t SYSIO_INTERFACE_NAME(writev)(int fd, const struct iovec *iov, int count) { @@ -926,6 +971,15 @@ SYSIO_INTERFACE_NAME(writev)(int fd, con return _do_iov(fd, SYSIO_INTERFACE_NAME(iwritev), iov, count); } +#if defined(__GLIBC__) +#undef __writev +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(writev), + PREPEND(__, SYSIO_INTERFACE_NAME(writev))) +#undef __libc_writev +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(writev), + PREPEND(__, SYSIO_INTERFACE_NAME(libc_writev))) +#endif + /* * Post asynch IO using fildes. */ @@ -984,6 +1038,15 @@ SYSIO_INTERFACE_NAME(read)(int fd, void return _do_io(fd, SYSIO_INTERFACE_NAME(iread), buf, count); } +#if defined(__GLIBC__) +#undef __read +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(read), + PREPEND(__, SYSIO_INTERFACE_NAME(read))) +#undef __libc_read +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(read), + PREPEND(__, SYSIO_INTERFACE_NAME(libc_read))) +#endif + ssize_t SYSIO_INTERFACE_NAME(write)(int fd, const void *buf, size_t count) { @@ -994,3 +1057,12 @@ SYSIO_INTERFACE_NAME(write)(int fd, cons size_t))SYSIO_INTERFACE_NAME(iwrite), (void *)buf, count); } + +#if defined(__GLIBC__) +#undef __write +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(write), + PREPEND(__, SYSIO_INTERFACE_NAME(write))) +#undef __libc_write +sysio_sym_weak_alias(SYSIO_INTERFACE_NAME(write), + PREPEND(__, SYSIO_INTERFACE_NAME(libc_write))) +#endif |
From: Lee W. <lw...@us...> - 2007-05-01 15:53:10
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv7814 Modified Files: rw.c Log Message: Use the check file for read/write access macro instead of the expansion. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -w -b -B -p -r1.19 -r1.20 --- rw.c 30 Apr 2007 19:36:44 -0000 1.19 +++ rw.c 1 May 2007 15:53:05 -0000 1.20 @@ -222,8 +222,7 @@ _sysio_iiox(int writing, /* * Opened for proper access? */ - if ((writing && !(fil->f_flags & (O_WRONLY | O_RDWR))) || - (!writing && fil->f_flags & O_WRONLY)) { + if (!F_CHKRW(fil, writing ? 'w' : 'r')) { err = -EBADF; break; } |
From: Lee W. <lw...@us...> - 2007-10-09 17:13:37
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30614 Modified Files: rw.c Log Message: >From Bob Glossman (bo...@cr...), during regression testing: Error number from pwrite is negative. Doh! Worse, _do_ipiov should be using the negated return code from _sysio_sum_iovec and not it's own. Fixed. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -w -b -B -p -r1.23 -r1.24 --- rw.c 19 Sep 2007 16:01:33 -0000 1.23 +++ rw.c 9 Oct 2007 17:13:33 -0000 1.24 @@ -582,7 +582,7 @@ _do_ipiov(int fd, cc = _sysio_sum_iovec(iov, count); if (cc < 0) { - errno = -EINVAL; + errno = (int )-cc; return IOID_FAIL; } xtv = malloc(sizeof(struct intnl_xtvec)); |
From: Lee W. <lw...@us...> - 2007-10-09 17:21:50
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv1312 Modified Files: rw.c Log Message: >From Bob Glossman (bo...@cr...) found during regression testing: pwrite returns -1 [EINVAL] The _do_ipio routine was sending the number of bytes in the buffer to the _do_ipiov, helper, routine to be used as the iovec count. Changed to one. Fixed. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -w -b -B -p -r1.24 -r1.25 --- rw.c 9 Oct 2007 17:13:33 -0000 1.24 +++ rw.c 9 Oct 2007 17:21:47 -0000 1.25 @@ -720,7 +720,7 @@ _do_ipio(int fd, return IOID_FAIL; iov->iov_base = buf; iov->iov_len = count; - ioid = _do_ipiov(fd, f, iov, count, free_arg, offset, NULL); + ioid = _do_ipiov(fd, f, iov, 1, free_arg, offset, NULL); if (ioid == IOID_FAIL) free(iov); return ioid; |
From: Lee W. <lw...@us...> - 2007-11-20 18:06:23
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6278/src Modified Files: rw.c Log Message: Add last-chance check for read-only in the post-io routine. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.26 retrieving revision 1.27 diff -u -w -b -B -p -r1.26 -r1.27 --- rw.c 26 Oct 2007 19:48:23 -0000 1.26 +++ rw.c 20 Nov 2007 18:06:20 -0000 1.27 @@ -80,6 +80,9 @@ _sysio_post_io(int (*f)(struct inode *in assert(f != NULL && pno->p_base->pb_ino != NULL); + if (IS_RDONLY(pno)) + return -EROFS; + /* * Get new IO context. */ |
From: Lee W. <lw...@us...> - 2007-11-30 18:10:39
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18030/src Modified Files: rw.c Log Message: This "last chance check for read-only" change should not have crept in yet. Reverting. Index: rw.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/rw.c,v retrieving revision 1.27 retrieving revision 1.28 diff -u -w -b -B -p -r1.27 -r1.28 --- rw.c 20 Nov 2007 18:06:20 -0000 1.27 +++ rw.c 30 Nov 2007 18:10:33 -0000 1.28 @@ -80,9 +80,6 @@ _sysio_post_io(int (*f)(struct inode *in assert(f != NULL && pno->p_base->pb_ino != NULL); - if (IS_RDONLY(pno)) - return -EROFS; - /* * Get new IO context. */ |