diff options
author | bde <bde@FreeBSD.org> | 1997-03-22 06:53:45 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1997-03-22 06:53:45 +0000 |
commit | 0bc178170104cff1e818e849d08a50c6a4ee0851 (patch) | |
tree | 1a4787be89dc6587f785bb211bf92dd0ce277648 /sys/kern/sys_pipe.c | |
parent | 5610d80b6231f85421e587a175ddd4d4b0c735c5 (diff) | |
download | FreeBSD-src-0bc178170104cff1e818e849d08a50c6a4ee0851.zip FreeBSD-src-0bc178170104cff1e818e849d08a50c6a4ee0851.tar.gz |
Fixed some invalid (non-atomic) accesses to `time', mostly ones of the
form `tv = time'. Use a new function gettime(). The current version
just forces atomicicity without fixing precision or efficiency bugs.
Simplified some related valid accesses by using the central function.
Diffstat (limited to 'sys/kern/sys_pipe.c')
-rw-r--r-- | sys/kern/sys_pipe.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 8be483b..66b0ac7 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -16,7 +16,7 @@ * 4. Modifications may be freely made to this file if the above conditions * are met. * - * $Id$ + * $Id: sys_pipe.c,v 1.24 1997/02/22 09:39:19 peter Exp $ */ #ifndef OLD_PIPE @@ -253,11 +253,9 @@ pipeinit(cpipe) cpipe->pipe_state = 0; cpipe->pipe_peer = NULL; cpipe->pipe_busy = 0; - s = splhigh(); - cpipe->pipe_ctime = time; - cpipe->pipe_atime = time; - cpipe->pipe_mtime = time; - splx(s); + gettime(&cpipe->pipe_ctime); + cpipe->pipe_atime = cpipe->pipe_ctime; + cpipe->pipe_mtime = cpipe->pipe_ctime; bzero(&cpipe->pipe_sel, sizeof cpipe->pipe_sel); cpipe->pipe_pgid = NO_PID; @@ -439,11 +437,8 @@ pipe_read(fp, uio, cred) } } - if (error == 0) { - int s = splhigh(); - rpipe->pipe_atime = time; - splx(s); - } + if (error == 0) + gettime(&rpipe->pipe_atime); --rpipe->pipe_busy; if ((rpipe->pipe_busy == 0) && (rpipe->pipe_state & PIPE_WANT)) { @@ -914,11 +909,9 @@ pipe_write(fp, uio, cred) (error == EPIPE)) error = 0; - if (error == 0) { - int s = splhigh(); - wpipe->pipe_mtime = time; - splx(s); - } + if (error == 0) + gettime(&wpipe->pipe_mtime); + /* * We have something to offer, * wake up select. |