From a6888a2b3a918920fe27133308c820e78dcecf16 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Wed, 2 Aug 2000 20:19:45 +0000 Subject: 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 . (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. --- pflocal/sock.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'pflocal/sock.c') diff --git a/pflocal/sock.c b/pflocal/sock.c index 350c7de8..dffd6bf7 100644 --- a/pflocal/sock.c +++ b/pflocal/sock.c @@ -1,6 +1,6 @@ /* Sock functions - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 2000 Free Software Foundation, Inc. Written by Miles Bader @@ -94,7 +94,7 @@ sock_acquire_write_pipe (struct sock *sock, struct pipe **pipe) /* Return a new socket with the given pipe class in SOCK. */ error_t -sock_create (struct pipe_class *pipe_class, struct sock **sock) +sock_create (struct pipe_class *pipe_class, mode_t mode, struct sock **sock) { error_t err; struct sock *new = malloc (sizeof (struct sock)); @@ -116,6 +116,7 @@ sock_create (struct pipe_class *pipe_class, struct sock **sock) new->refs = 0; new->flags = 0; new->write_pipe = NULL; + new->mode = mode; new->id = MACH_PORT_NULL; new->listen_queue = NULL; new->connect_queue = NULL; @@ -155,7 +156,7 @@ _sock_norefs (struct sock *sock) error_t sock_clone (struct sock *template, struct sock **sock) { - error_t err = sock_create (template->pipe_class, sock); + error_t err = sock_create (template->pipe_class, template->mode, sock); if (err) return err; -- cgit v1.2.3