| DOFILEREAD(9) | Kernel Developer's Manual | DOFILEREAD(9) | 
dofileread, dofilereadv,
  dofilewrite, dofilewritev
  —
#include <sys/file.h>
int
  
  dofileread(struct
    lwp *l, int fd,
    struct file *fp,
    void *buf,
    size_t nbyte,
    off_t *offset,
    int flags,
    register_t *retval);
int
  
  dofilewrite(struct
    lwp *l, int fd,
    struct file *fp,
    const void *buf,
    size_t nbyte,
    off_t *offset,
    int flags,
    register_t *retval);
int
  
  dofilereadv(struct
    lwp *l, int fd,
    struct file *fp,
    const struct iovec *iovp,
    int iovcnt,
    off_t *offset,
    int flags,
    register_t *retval);
int
  
  dofilewritev(struct
    lwp *l, int fd,
    struct file *fp,
    const struct iovec *iovp,
    int iovcnt,
    off_t *offset,
    int flags,
    register_t *retval);
The dofileread() function attempts to read
    nbytes of data from the object referenced by file
    entry fp into the buffer pointed to by
    buf. The dofilewrite()
    function attempts to write nbytes of data to the
    object referenced by file entry fp from the buffer
    pointed to by buf.
The dofilereadv() and
    dofilewritev() functions perform the same
    operations, but scatter the data with the iovcnt
    buffers specified by the members of the iov array.
The offset of the file operations is explicitly specified by *offset. The new file offset after the file operation is returned in *offset. If the FOF_UPDATE_OFFSET flag is specified in the flags argument, the file offset in the file entry fp is updated to reflect the new file offset, otherwise it remains unchanged after the operation.
The file descriptor fd is largely unused except for use by the ktrace framework for reporting to userlevel the process's file descriptor.
Upon successful completion the number of bytes which were transferred is returned in *retval.
| December 20, 2005 | NetBSD 9.4 |