#include <sys/uio.h>
#include <sys/queue.h>
-#include "xtio.h"
#include "sysio.h"
+#include "xtio.h"
#include "file.h"
#include "inode.h"
/*
* 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;
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);
+
err =
_sysio_iiox(IIOXOP_READ(fil->f_ino),
fil,
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);
xtv,
xtv_count)) == IOID_FAIL)
return -1;
- return iowait(ioid);
+ return SYSIO_INTERFACE_NAME(iowait)(ioid);
}
#if _LARGEFILE64_SOURCE
xtv,
xtv_count)) == IOID_FAIL)
return -1;
- return iowait(ioid);
+ return SYSIO_INTERFACE_NAME(iowait)(ioid);
}
#endif
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);
xtv,
xtv_count)) == IOID_FAIL)
return -1;
- return iowait(ioid);
+ return SYSIO_INTERFACE_NAME(iowait)(ioid);
}
#if _LARGEFILE64_SOURCE
xtv,
xtv_count)) == IOID_FAIL)
return -1;
- return iowait(ioid);
+ return SYSIO_INTERFACE_NAME(iowait)(ioid);
}
#endif