MirOS Manual: uio(9), uiomove(9)

UIOMOVE(9)                    BSD Kernel Manual                     UIOMOVE(9)


     uiomove - move data described by a struct uio


     #include <sys/systm.h>

     uiomove(void *buf, int n, struct uio *uio);


     The uiomove function copies up to n bytes between the kernel-space ad-
     dress pointed to by buf and the addresses described by uio, which may be
     in user-space or kernel-space.

     The uio argument is a pointer to a struct uio as defined by <sys/uio.h>:

     struct uio {
             struct  iovec *uio_iov; /* pointer to array of iovecs */
             int     uio_iovcnt;     /* number of iovecs in array */
             off_t   uio_offset;     /* offset into file this uio corresponds to */
             size_t  uio_resid;      /* residual i/o count */
             enum    uio_seg uio_segflg;
             enum    uio_rw uio_rw;
             struct  proc *uio_procp;/* process if UIO_USERSPACE */

     A struct uio typically describes data in motion. Several of the fields
     described below reflect that expectation.

     uio_iov     Pointer to array of struct iovecs:

                 struct iovec {
                         void    *iov_base;      /* Base address. */
                         size_t   iov_len;       /* Length. */

     uio_iovcnt  The number of iovecs in the array.

     uio_offset  An offset into the corresponding object.

     uio_resid   The amount of data remaining to be transferred.

     uio_segflg  A flag indicating whether the space described is in user-
                 space (UIO_USERSPACE) or kernel-space (UIO_SYSSPACE).

     uio_rw      A flag indicating whether date should be read into the space
                 (UIO_READ) or written from the space (UIO_WRITE).

     uio_procp   A pointer to the process whose data area is described by the
                 structure, or NULL if the area is in kernel-space.

     The value of uio->uio_rw controls whether uiomove copies data from buf to
     uio or vice versa.

     The lesser of n or uio->resid bytes are copied.

     uiomove changes fields of the structure pointed to by uio, such that
     uio->uio_resid is decremented by the amount of data moved, uio-
     >uio_offset is incremented by the same amount, and the array of iovecs is
     adjusted to point that much farther into the region described. This al-
     lows multiple calls to uiomove to easily be used to fill or drain the re-
     gion of data.


     uiomove returns 0 on success or EFAULT if a bad address is encountered.



MirOS BSD #10-current         February 12, 1999                              1

Generated on 2017-04-03 16:26:17 by $MirOS: src/scripts/roff2htm,v 1.88 2017/01/29 00:51:06 tg Exp $

These manual pages and other documentation are copyrighted by their respective writers; their source is available at our CVSweb, AnonCVS, and other mirrors. The rest is Copyright © 2002–2017 The MirOS Project, Germany.
This product includes material provided by mirabilos.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.