From a29f300e809cf6c0167aa2518e33d076f62db72f Mon Sep 17 00:00:00 2001 From: Garrett Wollman Date: Sun, 27 Apr 1997 20:01:29 +0000 Subject: The long-awaited mega-massive-network-code- cleanup. Part I. This commit includes the following changes: 1) Old-style (pr_usrreq()) protocols are no longer supported, the compatibility glue for them is deleted, and the kernel will panic on boot if any are compiled in. 2) Certain protocol entry points are modified to take a process structure, so they they can easily tell whether or not it is possible to sleep, and also to access credentials. 3) SS_PRIV is no more, and with it goes the SO_PRIVSTATE setsockopt() call. Protocols should use the process pointer they are now passed. 4) The PF_LOCAL and PF_ROUTE families have been updated to use the new style, as has the `raw' skeleton family. 5) PF_LOCAL sockets now obey the process's umask when creating a socket in the filesystem. As a result, LINT is now broken. I'm hoping that some enterprising hacker with a bit more time will either make the broken bits work (should be easy for netipx) or dike them out. --- sys/kern/sys_socket.c | 50 ++++++++------------------------------------------ 1 file changed, 8 insertions(+), 42 deletions(-) (limited to 'sys/kern/sys_socket.c') diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index c3e66158c31d..0c3b4952cc6a 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)sys_socket.c 8.1 (Berkeley) 6/10/93 - * $Id: sys_socket.c,v 1.11 1997/03/23 03:36:25 bde Exp $ + * $Id: sys_socket.c,v 1.12 1997/03/24 11:52:26 bde Exp $ */ #include @@ -68,9 +68,8 @@ soo_read(fp, uio, cred) struct uio *uio; struct ucred *cred; { - - return (soreceive((struct socket *)fp->f_data, (struct mbuf **)0, - uio, (struct mbuf **)0, (struct mbuf **)0, (int *)0)); + struct socket *so = (struct socket *)fp->f_data; + return so->so_proto->pr_usrreqs->pru_soreceive(so, 0, uio, 0, 0, 0); } /* ARGSUSED */ @@ -80,9 +79,8 @@ soo_write(fp, uio, cred) struct uio *uio; struct ucred *cred; { - - return (sosend((struct socket *)fp->f_data, (struct mbuf *)0, - uio, (struct mbuf *)0, (struct mbuf *)0, 0)); + struct socket *so = (struct socket *)fp->f_data; + return so->so_proto->pr_usrreqs->pru_sosend(so, 0, uio, 0, 0, 0); } int @@ -140,7 +138,7 @@ soo_ioctl(fp, cmd, data, p) return (ifioctl(so, cmd, data, p)); if (IOCGROUP(cmd) == 'r') return (rtioctl(cmd, data, p)); - return ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd, data, 0)); + return ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd, data, 0, p)); } int @@ -149,40 +147,8 @@ soo_select(fp, which, p) int which; struct proc *p; { - register struct socket *so = (struct socket *)fp->f_data; - register int s = splnet(); - - switch (which) { - - case FREAD: - if (soreadable(so)) { - splx(s); - return (1); - } - selrecord(p, &so->so_rcv.sb_sel); - so->so_rcv.sb_flags |= SB_SEL; - break; - - case FWRITE: - if (sowriteable(so)) { - splx(s); - return (1); - } - selrecord(p, &so->so_snd.sb_sel); - so->so_snd.sb_flags |= SB_SEL; - break; - - case 0: - if (so->so_oobmark || (so->so_state & SS_RCVATMARK)) { - splx(s); - return (1); - } - selrecord(p, &so->so_rcv.sb_sel); - so->so_rcv.sb_flags |= SB_SEL; - break; - } - splx(s); - return (0); + struct socket *so = (struct socket *)fp->f_data; + return so->so_proto->pr_usrreqs->pru_soselect(so, which, p); } int -- cgit v1.2.3