diff options
author | Stefan Kempf <stefan@cvs.openbsd.org> | 2016-01-15 18:10:49 +0000 |
---|---|---|
committer | Stefan Kempf <stefan@cvs.openbsd.org> | 2016-01-15 18:10:49 +0000 |
commit | 71c9b7097d1206686159fde0db0c5c4885a69afd (patch) | |
tree | 049256cf7ebc2d2a31c339de8e92992d5f87485b /sys | |
parent | 2cfd0bef17ae35d9666e7f1afccb625841783f03 (diff) |
Convert to uiomove(); from Martin Natano
ok millert@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/sys_pipe.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 22babb98e39..dc68bf25062 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_pipe.c,v 1.71 2016/01/06 17:59:30 tedu Exp $ */ +/* $OpenBSD: sys_pipe.c,v 1.72 2016/01/15 18:10:48 stefan Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -297,8 +297,7 @@ pipe_read(struct file *fp, off_t *poff, struct uio *uio, struct ucred *cred) { struct pipe *rpipe = fp->f_data; int error; - int nread = 0; - int size; + size_t size, nread = 0; error = pipelock(rpipe); if (error) @@ -316,7 +315,7 @@ pipe_read(struct file *fp, off_t *poff, struct uio *uio, struct ucred *cred) size = rpipe->pipe_buffer.cnt; if (size > uio->uio_resid) size = uio->uio_resid; - error = uiomovei(&rpipe->pipe_buffer.buffer[rpipe->pipe_buffer.out], + error = uiomove(&rpipe->pipe_buffer.buffer[rpipe->pipe_buffer.out], size, uio); if (error) { break; @@ -413,7 +412,7 @@ int pipe_write(struct file *fp, off_t *poff, struct uio *uio, struct ucred *cred) { int error = 0; - int orig_resid; + size_t orig_resid; struct pipe *wpipe, *rpipe; rpipe = fp->f_data; @@ -460,7 +459,7 @@ pipe_write(struct file *fp, off_t *poff, struct uio *uio, struct ucred *cred) orig_resid = uio->uio_resid; while (uio->uio_resid) { - int space; + size_t space; retrywrite: if (wpipe->pipe_state & PIPE_EOF) { @@ -476,8 +475,8 @@ retrywrite: if (space > 0) { if ((error = pipelock(wpipe)) == 0) { - int size; /* Transfer size */ - int segsize; /* first segment to transfer */ + size_t size; /* Transfer size */ + size_t segsize; /* first segment to transfer */ /* * If a process blocked in uiomove, our @@ -514,7 +513,7 @@ retrywrite: /* Transfer first segment */ - error = uiomovei(&wpipe->pipe_buffer.buffer[wpipe->pipe_buffer.in], + error = uiomove(&wpipe->pipe_buffer.buffer[wpipe->pipe_buffer.in], segsize, uio); if (error == 0 && segsize < size) { @@ -529,7 +528,7 @@ retrywrite: panic("Expected pipe buffer wraparound disappeared"); #endif - error = uiomovei(&wpipe->pipe_buffer.buffer[0], + error = uiomove(&wpipe->pipe_buffer.buffer[0], size - segsize, uio); } if (error == 0) { |