* Copyright (c) 1982, 1986 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
* @(#)kern_subr.c 7.2 (Berkeley) %G%
register struct uio
*uio
;
register struct iovec
*iov
;
if (uio
->uio_rw
!= UIO_READ
&& uio
->uio_rw
!= UIO_WRITE
)
while (n
> 0 && uio
->uio_resid
) {
switch (uio
->uio_segflg
) {
if (uio
->uio_rw
== UIO_READ
)
error
= copyout(cp
, iov
->iov_base
, cnt
);
error
= copyin(iov
->iov_base
, cp
, cnt
);
if (uio
->uio_rw
== UIO_READ
)
bcopy((caddr_t
)cp
, iov
->iov_base
, cnt
);
bcopy(iov
->iov_base
, (caddr_t
)cp
, cnt
);
* Give next character to user as result of read.
register struct uio
*uio
;
register struct iovec
*iov
;
if (uio
->uio_iovcnt
== 0)
if (iov
->iov_len
<= 0 || uio
->uio_resid
<= 0) {
switch (uio
->uio_segflg
) {
if (subyte(iov
->iov_base
, c
) < 0)
if (suibyte(iov
->iov_base
, c
) < 0)
* Get next character written in by user from uio.
register struct iovec
*iov
;
if (uio
->uio_iovcnt
<= 0)
if (--uio
->uio_iovcnt
== 0)
switch (uio
->uio_segflg
) {
c
= fubyte(iov
->iov_base
);
c
= *iov
->iov_base
& 0377;
c
= fuibyte(iov
->iov_base
);