diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2018-08-20 16:00:23 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2018-08-20 16:00:23 +0000 |
commit | d1cd3adde7b6cc1679b4a68d59b0b1c7fac3704b (patch) | |
tree | b3aa15e777dcab8f9ea2f1075370a17d66935753 /sys/kern/sys_pipe.c | |
parent | 96caa2d6c8a9b3163030ce6adf44f2f509182277 (diff) |
Reorder checks in the read/write(2) family of syscalls to prepare making
file operations mp-safe.
This change makes it clear that `f_offset' is only accessed in vn_read()
and vn_write(), which will help taking it out of the KERNEL_LOCK().
This refactoring uncovered a race in vn_read() which is now documented
and will be addressed in a later diff.
ok visa@
Diffstat (limited to 'sys/kern/sys_pipe.c')
-rw-r--r-- | sys/kern/sys_pipe.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 7c8378602a8..7709a64cf4e 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_pipe.c,v 1.84 2018/08/15 13:19:06 visa Exp $ */ +/* $OpenBSD: sys_pipe.c,v 1.85 2018/08/20 16:00:22 mpi Exp $ */ /* * Copyright (c) 1996 John S. Dyson @@ -52,8 +52,8 @@ /* * interfaces to the outside world */ -int pipe_read(struct file *, off_t *, struct uio *, struct ucred *); -int pipe_write(struct file *, off_t *, struct uio *, struct ucred *); +int pipe_read(struct file *, struct uio *, int); +int pipe_write(struct file *, struct uio *, int); int pipe_close(struct file *, struct proc *); int pipe_poll(struct file *, int events, struct proc *); int pipe_kqfilter(struct file *fp, struct knote *kn); @@ -308,7 +308,7 @@ pipeselwakeup(struct pipe *cpipe) } int -pipe_read(struct file *fp, off_t *poff, struct uio *uio, struct ucred *cred) +pipe_read(struct file *fp, struct uio *uio, int fflags) { struct pipe *rpipe = fp->f_data; int error; @@ -424,7 +424,7 @@ unlocked_error: } int -pipe_write(struct file *fp, off_t *poff, struct uio *uio, struct ucred *cred) +pipe_write(struct file *fp, struct uio *uio, int fflags) { int error = 0; size_t orig_resid; |