summaryrefslogtreecommitdiff
path: root/pflocal/sock.h
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2000-08-02 20:19:45 +0000
committerMark Kettenis <kettenis@gnu.org>2000-08-02 20:19:45 +0000
commita6888a2b3a918920fe27133308c820e78dcecf16 (patch)
treef6f411ce5fcbcc26087c78daa4b93ddc613defd7 /pflocal/sock.h
parent18dc5dc677ebf1d415e1adeff24041e9f496a2ed (diff)
Add `magic' protocols to specify the file type of a sockets. This
allows implementation of POSIX pipes by using a S_IFSOCK protocol. * sock.h: Include <sys/types.h>. (struct sock): Add new member `mode'. (sock_create): Add new parameter `mode'. * sock.c (sock_create): Initialize `mode' member of struct sock, with new parameter. * pf.c (S_socket_create): Pass file type/mode to sock_create based on PROTOCOL. * io.c (S_io_stat): Use new member of `struct sock' to set ST->st_mode.
Diffstat (limited to 'pflocal/sock.h')
-rw-r--r--pflocal/sock.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/pflocal/sock.h b/pflocal/sock.h
index e2852da0..94035759 100644
--- a/pflocal/sock.h
+++ b/pflocal/sock.h
@@ -1,6 +1,6 @@
/* Internal sockets
- Copyright (C) 1995, 1996, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1995, 1996, 1999, 2000 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -24,6 +24,7 @@
#include <assert.h>
#include <cthreads.h> /* For mutexes */
#include <sys/mman.h>
+#include <sys/types.h>
#include <hurd/ports.h>
@@ -60,6 +61,10 @@ struct sock
/* Last time the socket got frobbed. */
time_value_t change_time;
+ /* File mode as reported by stat. Usually this is S_ISOCK, but it
+ should be S_IFIFO for sockets (ab)used in a pipe. */
+ mode_t mode;
+
/* This socket's local address. Note that we don't hold any references on
ADDR, and depend on the addr zeroing our pointer if it goes away (which
is ok, as we can then just make up another address if necessary, and no
@@ -100,7 +105,8 @@ error_t sock_acquire_write_pipe (struct sock *sock, struct pipe **pipe);
error_t sock_connect (struct sock *sock1, struct sock *sock2);
/* Return a new socket with the given pipe class in SOCK. */
-error_t sock_create (struct pipe_class *pipe_class, struct sock **sock);
+error_t sock_create (struct pipe_class *pipe_class, mode_t mode,
+ struct sock **sock);
/* Free SOCK, assuming there are no more handle on it. */
void sock_free (struct sock *sock);