summaryrefslogtreecommitdiffstats
path: root/sys/sys/pipe.h
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2002-02-27 07:35:59 +0000
committeralfred <alfred@FreeBSD.org>2002-02-27 07:35:59 +0000
commit98b979a712ecf3af8a4f540c7b6d946a7ee86d1b (patch)
tree6cf74c80656ab90a5d83b56650044c808bbfae89 /sys/sys/pipe.h
parent0f3fdcbf9df07821dae35a53901bff8233e944a1 (diff)
downloadFreeBSD-src-98b979a712ecf3af8a4f540c7b6d946a7ee86d1b.zip
FreeBSD-src-98b979a712ecf3af8a4f540c7b6d946a7ee86d1b.tar.gz
First rev at making pipe(2) pipe's MPsafe.
Both ends of the pipe share a pool_mutex, this makes allocation and deadlock avoidance easy. Remove some un-needed FILE_LOCK ops while I'm here. There are some issues wrt to select and the f{s,g}etown code that we'll have to deal with, I think we may also need to move the calls to vfs_timestamp outside of the sections covered by PIPE_LOCK.
Diffstat (limited to 'sys/sys/pipe.h')
-rw-r--r--sys/sys/pipe.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/sys/pipe.h b/sys/sys/pipe.h
index 2a1f3d4..f226396 100644
--- a/sys/sys/pipe.h
+++ b/sys/sys/pipe.h
@@ -86,7 +86,7 @@ struct pipemapping {
#define PIPE_WANT 0x020 /* Pipe is wanted to be run-down. */
#define PIPE_SEL 0x040 /* Pipe has a select active. */
#define PIPE_EOF 0x080 /* Pipe is in EOF condition. */
-#define PIPE_LOCK 0x100 /* Process has exclusive access to pointers/data. */
+#define PIPE_LOCKFL 0x100 /* Process has exclusive access to pointers/data. */
#define PIPE_LWANT 0x200 /* Process wants exclusive access to pointers/data. */
#define PIPE_DIRECTW 0x400 /* Pipe direct write active. */
#define PIPE_DIRECTOK 0x800 /* Direct mode ok. */
@@ -106,6 +106,13 @@ struct pipe {
struct pipe *pipe_peer; /* link with other direction */
u_int pipe_state; /* pipe status info */
int pipe_busy; /* busy flag, mostly to handle rundown sanely */
+ struct mtx *pipe_mtxp; /* shared mutex between both pipes */
};
+#define PIPE_MTX(pipe) (pipe)->pipe_mtxp
+#define PIPE_LOCK(pipe) mtx_lock(PIPE_MTX(pipe))
+#define PIPE_UNLOCK(pipe) mtx_unlock(PIPE_MTX(pipe))
+#define PIPE_LOCK_ASSERT(pipe, type) mtx_assert(PIPE_MTX(pipe), (type))
+
+
#endif /* !_SYS_PIPE_H_ */
OpenPOWER on IntegriCloud