summaryrefslogtreecommitdiff
path: root/pflocal
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1995-07-01 21:15:49 +0000
committerMiles Bader <miles@gnu.org>1995-07-01 21:15:49 +0000
commit3a5dfe8ada4ac1b9a3f0876dc31c64e9236dc77d (patch)
tree74bbca925f88f1da1d21c2663f735229e8f3eb77 /pflocal
parent54b2826dce3c67db0217cb021ebac6babc9ff41e (diff)
Initial revision
Diffstat (limited to 'pflocal')
-rw-r--r--pflocal/sock.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/pflocal/sock.c b/pflocal/sock.c
new file mode 100644
index 00000000..21fce3ac
--- /dev/null
+++ b/pflocal/sock.c
@@ -0,0 +1,32 @@
+
+/* Returns the pipe that SOCKET is reading from, locked and with an
+ additional reference, or NULL if it has none. SOCKET mustn't be locked. */
+struct pipe *
+socket_aquire_read_pipe (struct socket *socket)
+{
+ struct pipe *pipe;
+
+ mutex_lock (&socket->lock);
+ pipe = user->socket->read_pipe;
+ if (pipe != NULL)
+ pipe_aquire (pipe); /* Do this before unlocking the socket! */
+ mutex_unlock (&socket->lock);
+
+ return pipe;
+}
+
+/* Returns the pipe that SOCKET is writing from, locked and with an
+ additional reference, or NULL if it has none. SOCKET mustn't be locked. */
+struct pipe *
+socket_aquire_write_pipe (struct socket *socket)
+{
+ struct pipe *pipe;
+
+ mutex_lock (&socket->lock);
+ pipe = user->socket->write_pipe;
+ if (pipe != NULL)
+ pipe_aquire (pipe); /* Do this before unlocking the socket! */
+ mutex_unlock (&socket->lock);
+
+ return pipe;
+}