Subject: Eliminating several curproc usages from socket layer, NFS
To: None <tech-kern@netbsd.org>
From: Jonathan Stone <jonathan@dsg.stanford.edu>
List: tech-kern
Date: 05/21/2004 13:50:13
The following patch eliminates several uses of curproc from the kernel
socket layer.  It adds a new explicit `struct proc *' arg to
socreate() and sosend(), and percolates the change downward through
the networking stack, thus allowing removal of several uses of
`curproc' in the socket layer, and notably in NFS code.

Eliminating curproc is a Good Thing (Nathan put it ``curproc must
die''), but it also removes one major remaining obstacle to calling
socket-layer functions from softnet context --- from socket-event
callbacks, for kconts, (or both in combiation).

Matt Thomas has a similar version of these changes; with the exception
of the sys/nfs NFS code (where I went further) and one KASSERT(), these
should be identical to Matt's.

I removed  one 
  KASSERT((uio->uio_procp != NULL)

that Matt added. I did so after carefully auditing all calls to
soreceive() and so_receive() socket methods. It turns out there is one
call which passes uninitiaized junk in the uio_procp field of an
onstack struct uio; and one call (in NFS) which explicitly passes a
NULL pointer.  I propose to addres those separately, then add the KASSERT().
(I will send the audit list to anyone interested).

Any further comments/feedback? These diffs have circulated since
March.  I'd like to commit them soon as I have other, dependent diffs.



Index: compat/svr4/svr4_net.c
===================================================================
RCS file: /cvsroot/src/sys/compat/svr4/svr4_net.c,v
retrieving revision 1.35
diff -u -r1.35 svr4_net.c
--- compat/svr4/svr4_net.c	13 Sep 2003 08:32:10 -0000	1.35
+++ compat/svr4/svr4_net.c	19 May 2004 03:11:10 -0000
@@ -203,7 +203,7 @@
 	if ((error = falloc(p, &fp, &fd)) != 0)
 		return error;
 
-	if ((error = socreate(family, &so, type, protocol)) != 0) {
+	if ((error = socreate(family, &so, type, protocol, p)) != 0) {
 		DPRINTF(("socreate error %d\n", error));
 		fdremove(p->p_fd, fd);
 		FILE_UNUSE(fp, NULL);
Index: kern/sys_socket.c
===================================================================
RCS file: /cvsroot/src/sys/kern/sys_socket.c,v
retrieving revision 1.39
diff -u -r1.39 sys_socket.c
--- kern/sys_socket.c	21 Sep 2003 19:17:08 -0000	1.39
+++ kern/sys_socket.c	19 May 2004 03:11:10 -0000
@@ -79,7 +79,7 @@
 {
 	struct socket *so = (struct socket *) fp->f_data;
 	return ((*so->so_send)(so, (struct mbuf *)0,
-		uio, (struct mbuf *)0, (struct mbuf *)0, 0));
+		uio, (struct mbuf *)0, (struct mbuf *)0, 0, uio->uio_procp));
 }
 
 int
Index: sys/kern/uipc_socket.c
===================================================================
RCS file: /cvsroot/src/sys/kern/uipc_socket.c,v
retrieving revision 1.101
diff -u -r1.101 uipc_socket.c
--- sys/kern/uipc_socket.c	1 May 2004 02:24:38 -0000	1.101
+++ sys/kern/uipc_socket.c	21 May 2004 20:37:52 -0000
@@ -450,14 +450,12 @@
  */
 /*ARGSUSED*/
 int
-socreate(int dom, struct socket **aso, int type, int proto)
+socreate(int dom, struct socket **aso, int type, int proto, struct proc *p)
 {
-	struct proc	*p;
 	const struct protosw	*prp;
 	struct socket	*so;
 	int		error, s;
 
-	p = curproc;		/* XXX */
 	if (proto)
 		prp = pffindproto(dom, proto, type);
 	else
@@ -650,12 +648,10 @@
 }
 
 int
-soconnect(struct socket *so, struct mbuf *nam)
+soconnect(struct socket *so, struct mbuf *nam, struct proc *p)
 {
-	struct proc	*p;
 	int		s, error;
 
-	p = curproc;		/* XXX */
 	if (so->so_options & SO_ACCEPTCONN)
 		return (EOPNOTSUPP);
 	s = splsoftnet();
@@ -732,16 +728,14 @@
  */
 int
 sosend(struct socket *so, struct mbuf *addr, struct uio *uio, struct mbuf *top,
-	struct mbuf *control, int flags)
+	struct mbuf *control, int flags, struct proc *p)
 {
-	struct proc	*p;
 	struct mbuf	**mp, *m;
 	long		space, len, resid, clen, mlen;
 	int		error, s, dontroute, atomic;
 
 	sodopendfree(so);
 
-	p = curproc;		/* XXX */
 	clen = 0;
 	atomic = sosendallatonce(so) || top;
 	if (uio)
@@ -762,7 +756,8 @@
 	dontroute =
 	    (flags & MSG_DONTROUTE) && (so->so_options & SO_DONTROUTE) == 0 &&
 	    (so->so_proto->pr_flags & PR_ATOMIC);
-	p->p_stats->p_ru.ru_msgsnd++;
+	if (p)
+		p->p_stats->p_ru.ru_msgsnd++;
 	if (control)
 		clen = control->m_len;
 #define	snderr(errno)	{ error = errno; splx(s); goto release; }
@@ -935,6 +930,7 @@
 soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio,
 	struct mbuf **mp0, struct mbuf **controlp, int *flagsp)
 {
+	struct proc * p;
 	struct mbuf	*m, **mp;
 	int		flags, len, error, s, offset, moff, type, orig_resid;
 	const struct protosw	*pr;
@@ -945,6 +941,8 @@
 	mp = mp0;
 	type = 0;
 	orig_resid = uio->uio_resid;
+
+	p = uio->uio_procp;
 	if (paddr)
 		*paddr = 0;
 	if (controlp)
@@ -1092,10 +1090,11 @@
 			sbfree(&so->so_rcv, m);
 			mbuf_removed = 1;
 			if (controlp) {
-				if (pr->pr_domain->dom_externalize &&
+				struct domain *dom = pr->pr_domain;
+				if (dom->dom_externalize && p &&
 				    mtod(m, struct cmsghdr *)->cmsg_type ==
 				    SCM_RIGHTS)
-					error = (*pr->pr_domain->dom_externalize)(m);
+					error = (*dom->dom_externalize)(m, p);
 				*controlp = m;
 				so->so_rcv.sb_mb = m->m_next;
 				m->m_next = 0;
Index: kern/uipc_syscalls.c
===================================================================
RCS file: /cvsroot/src/sys/kern/uipc_syscalls.c,v
retrieving revision 1.87
diff -u -r1.87 uipc_syscalls.c
--- kern/uipc_syscalls.c	18 May 2004 11:31:49 -0000	1.87
+++ kern/uipc_syscalls.c	19 May 2004 03:11:12 -0000
@@ -90,7 +90,7 @@
 	fp->f_type = DTYPE_SOCKET;
 	fp->f_ops = &socketops;
 	error = socreate(SCARG(uap, domain), &so, SCARG(uap, type),
-			 SCARG(uap, protocol));
+			 SCARG(uap, protocol), p);
 	if (error) {
 		FILE_UNUSE(fp, p);
 		fdremove(fdp, fd);
@@ -288,7 +288,7 @@
 	if (error)
 		goto out;
 	MCLAIM(nam, so->so_mowner);
-	error = soconnect(so, nam);
+	error = soconnect(so, nam, p);
 	if (error)
 		goto bad;
 	if ((so->so_state & SS_NBIO) && (so->so_state & SS_ISCONNECTING)) {
@@ -340,11 +340,11 @@
 	p = l->l_proc;
 	fdp = p->p_fd;
 	error = socreate(SCARG(uap, domain), &so1, SCARG(uap, type),
-			 SCARG(uap, protocol));
+			 SCARG(uap, protocol), p);
 	if (error)
 		return (error);
 	error = socreate(SCARG(uap, domain), &so2, SCARG(uap, type),
-			 SCARG(uap, protocol));
+			 SCARG(uap, protocol), p);
 	if (error)
 		goto free1;
 	/* falloc() will use the descriptor for us */
@@ -535,7 +535,7 @@
 	}
 #endif
 	len = auio.uio_resid;
-	error = (*so->so_send)(so, to, &auio, NULL, control, flags);
+	error = (*so->so_send)(so, to, &auio, NULL, control, flags, p);
 	if (error) {
 		if (auio.uio_resid != len && (error == ERESTART ||
 		    error == EINTR || error == EWOULDBLOCK))
@@ -907,9 +907,9 @@
 
 	p = l->l_proc;
 	fdp = p->p_fd;
-	if ((error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0)) != 0)
+	if ((error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, p)) != 0)
 		return (error);
-	if ((error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0)) != 0)
+	if ((error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0, p)) != 0)
 		goto free1;
 	/* remember this socket pair implements a pipe */
 	wso->so_state |= SS_ISAPIPE;
Index: kern/uipc_usrreq.c
===================================================================
RCS file: /cvsroot/src/sys/kern/uipc_usrreq.c,v
retrieving revision 1.77
diff -u -r1.77 uipc_usrreq.c
--- kern/uipc_usrreq.c	18 Apr 2004 22:20:32 -0000	1.77
+++ kern/uipc_usrreq.c	19 May 2004 03:11:12 -0000
@@ -834,9 +834,8 @@
 #endif
 
 int
-unp_externalize(struct mbuf *rights)
+unp_externalize(struct mbuf *rights, struct proc *p)
 {
-	struct proc *p = curproc;		/* XXX */
 	struct cmsghdr *cm = mtod(rights, struct cmsghdr *);
 	int i, *fdp;
 	struct file **rp;
Index: miscfs/fifofs/fifo_vnops.c
===================================================================
RCS file: /cvsroot/src/sys/miscfs/fifofs/fifo_vnops.c,v
retrieving revision 1.48
diff -u -r1.48 fifo_vnops.c
--- miscfs/fifofs/fifo_vnops.c	12 May 2004 02:07:37 -0000	1.48
+++ miscfs/fifofs/fifo_vnops.c	19 May 2004 03:11:12 -0000
@@ -162,13 +162,15 @@
 	if ((fip = vp->v_fifoinfo) == NULL) {
 		MALLOC(fip, struct fifoinfo *, sizeof(*fip), M_VNODE, M_WAITOK);
 		vp->v_fifoinfo = fip;
-		if ((error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0)) != 0) {
+		error = socreate(AF_LOCAL, &rso, SOCK_STREAM, 0, p);
+		if (error != 0) {
 			free(fip, M_VNODE);
 			vp->v_fifoinfo = NULL;
 			return (error);
 		}
 		fip->fi_readsock = rso;
-		if ((error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0)) != 0) {
+		error = socreate(AF_LOCAL, &wso, SOCK_STREAM, 0, p);
+		if (error != 0) {
 			(void)soclose(rso);
 			free(fip, M_VNODE);
 			vp->v_fifoinfo = NULL;
@@ -310,7 +312,7 @@
 		wso->so_state |= SS_NBIO;
 	VOP_UNLOCK(ap->a_vp, 0);
 	error = (*wso->so_send)(wso, (struct mbuf *)0, ap->a_uio, 0,
-	    (struct mbuf *)0, 0);
+	    (struct mbuf *)0, 0, curproc /*XXX*/);
 	vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY);
 	if (ap->a_ioflag & IO_NDELAY)
 		wso->so_state &= ~SS_NBIO;
Index: miscfs/portal/portal_vnops.c
===================================================================
RCS file: /cvsroot/src/sys/miscfs/portal/portal_vnops.c,v
retrieving revision 1.54
diff -u -r1.54 portal_vnops.c
--- miscfs/portal/portal_vnops.c	29 Apr 2004 16:10:55 -0000	1.54
+++ miscfs/portal/portal_vnops.c	19 May 2004 03:11:13 -0000
@@ -345,7 +345,7 @@
 	/*
 	 * Create a new socket.
 	 */
-	error = socreate(AF_LOCAL, &so, SOCK_STREAM, 0);
+	error = socreate(AF_LOCAL, &so, SOCK_STREAM, 0, p);
 	if (error)
 		goto bad;
 
@@ -420,7 +420,7 @@
 	auio.uio_resid = aiov[0].iov_len + aiov[1].iov_len;
 
 	error = (*so->so_send)(so, (struct mbuf *) 0, &auio,
-			(struct mbuf *) 0, (struct mbuf *) 0, 0);
+			(struct mbuf *) 0, (struct mbuf *) 0, 0, p);
 	if (error)
 		goto bad;
 
Index: netsmb/smb_trantcp.c
===================================================================
RCS file: /cvsroot/src/sys/netsmb/smb_trantcp.c,v
retrieving revision 1.15
diff -u -r1.15 smb_trantcp.c
--- netsmb/smb_trantcp.c	29 Jun 2003 22:32:11 -0000	1.15
+++ netsmb/smb_trantcp.c	19 May 2004 03:11:13 -0000
@@ -83,7 +83,7 @@
 				    so, NULL, 0, m, 0, flags, p)
 #else
 #define nb_sosend(so,m,flags,p) (*(so)->so_send)(so, NULL, (struct uio *)0, \
-					m, (struct mbuf *)0, flags)
+					m, (struct mbuf *)0, flags, p)
 #endif
 
 static int  nbssn_recv(struct nbpcb *nbp, struct mbuf **mpp, int *lenp,
@@ -267,7 +267,7 @@
 	struct mbuf *m;
 #endif
 
-	error = socreate(AF_INET, &so, SOCK_STREAM, IPPROTO_TCP);
+	error = socreate(AF_INET, &so, SOCK_STREAM, IPPROTO_TCP, p);
 	if (error)
 		return error;
 	nbp->nbp_tso = so;
@@ -289,7 +289,7 @@
 	m = m_get(M_WAIT, MT_SONAME);
 	*mtod(m, struct sockaddr *) = *(struct sockaddr *)to;
 	m->m_len = sizeof(struct sockaddr);
-	error = soconnect(so, m);
+	error = soconnect(so, m, p);
 	m_free(m);
 #endif
 	if (error)
Index: nfs/krpc.h
===================================================================
RCS file: /cvsroot/src/sys/nfs/krpc.h,v
retrieving revision 1.6
diff -u -r1.6 krpc.h
--- nfs/krpc.h	5 May 2003 13:21:00 -0000	1.6
+++ nfs/krpc.h	19 May 2004 03:11:13 -0000
@@ -5,10 +5,11 @@
 #ifdef _KERNEL
 int krpc_call __P((struct sockaddr_in *sin,
 	u_int prog, u_int vers, u_int func,
-	struct mbuf **data, struct mbuf **from));
+	struct mbuf **data, struct mbuf **from, struct proc *p));
 
 int krpc_portmap __P((struct sockaddr_in *sin,
-	u_int prog, u_int vers, u_int proto, u_int16_t *portp));
+	u_int prog, u_int vers, u_int proto, u_int16_t *portp,
+	struct proc *p));
 
 struct mbuf *xdr_string_encode __P((char *str, int len));
 struct mbuf *xdr_string_decode __P((struct mbuf *m, char *str, int *len_p));
Index: nfs/krpc_subr.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/krpc_subr.c,v
retrieving revision 1.27
diff -u -r1.27 krpc_subr.c
--- nfs/krpc_subr.c	26 Feb 2003 06:31:18 -0000	1.27
+++ nfs/krpc_subr.c	19 May 2004 03:11:13 -0000
@@ -131,10 +131,11 @@
  * Returns non-zero error on failure.
  */
 int
-krpc_portmap(sin,  prog, vers, proto, portp)
+krpc_portmap(sin,  prog, vers, proto, portp, p)
 	struct sockaddr_in *sin;		/* server address */
 	u_int prog, vers, proto;	/* host order */
 	u_int16_t *portp;	/* network order */
+	struct proc *p;
 {
 	struct sdata {
 		u_int32_t prog;		/* call program */
@@ -167,7 +168,7 @@
 
 	sin->sin_port = htons(PMAPPORT);
 	error = krpc_call(sin, PMAPPROG, PMAPVERS,
-					  PMAPPROC_GETPORT, &m, NULL);
+					  PMAPPROC_GETPORT, &m, NULL, p);
 	if (error) 
 		return error;
 
@@ -215,11 +216,12 @@
  * the address from whence the response came is saved there.
  */
 int
-krpc_call(sa, prog, vers, func, data, from_p)
+krpc_call(sa, prog, vers, func, data, from_p, p)
 	struct sockaddr_in *sa;
 	u_int prog, vers, func;
 	struct mbuf **data;	/* input/output */
 	struct mbuf **from_p;	/* output */
+	struct proc *p;
 {
 	struct socket *so;
 	struct sockaddr_in *sin;
@@ -244,7 +246,7 @@
 	/*
 	 * Create socket and set its receive timeout.
 	 */
-	if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0)))
+	if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0, p)))
 		goto out;
 
 	if ((error = nfs_boot_setrecvtimo(so)))
@@ -266,7 +268,7 @@
 	tport = IPPORT_RESERVED;
 	do {
 		tport--;
-		error = nfs_boot_sobind_ipport(so, tport);
+		error = nfs_boot_sobind_ipport(so, tport, p);
 	} while (error == EADDRINUSE &&
 			 tport > IPPORT_RESERVED / 2);
 	if (error) {
@@ -317,7 +319,8 @@
 	mhead->m_pkthdr.len = len;
 	mhead->m_pkthdr.rcvif = NULL;
 
-	error = nfs_boot_sendrecv(so, nam, 0, mhead, krpccheck, &m, &from, &xid);
+	error = nfs_boot_sendrecv(so, nam, 0, mhead, krpccheck, &m, &from,
+	    &xid, p);
 	if (error)
 		goto out;
 
Index: nfs/nfs_boot.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_boot.c,v
retrieving revision 1.60
diff -u -r1.60 nfs_boot.c
--- nfs/nfs_boot.c	11 Mar 2004 21:48:43 -0000	1.60
+++ nfs/nfs_boot.c	19 May 2004 03:11:13 -0000
@@ -95,10 +95,10 @@
 
 /* mountd RPC */
 static int md_mount __P((struct sockaddr_in *mdsin, char *path,
-	struct nfs_args *argp));
+	struct nfs_args *argp, struct proc *procp));
 
 static void nfs_boot_defrt __P((struct in_addr *));
-static  int nfs_boot_getfh __P((struct nfs_dlmount *ndm));
+static  int nfs_boot_getfh __P((struct nfs_dlmount *ndm, struct proc *));
 
 
 /*
@@ -161,7 +161,7 @@
 	/*
 	 * Now fetch the NFS file handles as appropriate.
 	 */
-	error = nfs_boot_getfh(&nd->nd_root);
+	error = nfs_boot_getfh(&nd->nd_root, procp);
 
 	if (error)
 		nfs_boot_cleanup(nd, procp);
@@ -197,7 +197,7 @@
 	 * Get a socket to use for various things in here.
 	 * After this, use "goto out" to cleanup and return.
 	 */
-	error = socreate(AF_INET, &so, SOCK_DGRAM, 0);
+	error = socreate(AF_INET, &so, SOCK_DGRAM, 0, procp);
 	if (error) {
 		printf("ifupdown: socreate, error=%d\n", error);
 		return (error);
@@ -246,7 +246,7 @@
 	 * Get a socket to use for various things in here.
 	 * After this, use "goto out" to cleanup and return.
 	 */
-	error = socreate(AF_INET, &so, SOCK_DGRAM, 0);
+	error = socreate(AF_INET, &so, SOCK_DGRAM, 0, procp);
 	if (error) {
 		printf("setaddress: socreate, error=%d\n", error);
 		return (error);
@@ -305,7 +305,7 @@
 	 * Get a socket to use for various things in here.
 	 * After this, use "goto out" to cleanup and return.
 	 */
-	error = socreate(AF_INET, &so, SOCK_DGRAM, 0);
+	error = socreate(AF_INET, &so, SOCK_DGRAM, 0, procp);
 	if (error) {
 		printf("deladdress: socreate, error=%d\n", error);
 		return (error);
@@ -360,9 +360,10 @@
 }
 
 int
-nfs_boot_sobind_ipport(so, port)
+nfs_boot_sobind_ipport(so, port, procp)
 	struct socket *so;
 	u_int16_t port;
+	struct proc *procp;
 {
 	struct mbuf *m;
 	struct sockaddr_in *sin;
@@ -374,7 +375,7 @@
 	sin->sin_family = AF_INET;
 	sin->sin_addr.s_addr = INADDR_ANY;
 	sin->sin_port = htons(port);
-	error = sobind(so, m, curproc);
+	error = sobind(so, m, procp);
 	m_freem(m);
 	return (error);
 }
@@ -389,7 +390,7 @@
 #define TOTAL_TIMEOUT   30	/* seconds */
 
 int
-nfs_boot_sendrecv(so, nam, sndproc, snd, rcvproc, rcv, from_p, context)
+nfs_boot_sendrecv(so, nam, sndproc, snd, rcvproc, rcv, from_p, context, procp)
 	struct socket *so;
 	struct mbuf *nam;
 	int (*sndproc) __P((struct mbuf*, void*, int));
@@ -397,6 +398,7 @@
 	int (*rcvproc) __P((struct mbuf*, void*));
 	struct mbuf **rcv, **from_p;
 	void *context;
+	struct proc *procp;
 {
 	int error, rcvflg, timo, secs, waited;
 	struct mbuf *m, *from;
@@ -434,7 +436,7 @@
 		error = ENOBUFS;
 		goto out;
 	}
-	error = (*so->so_send)(so, nam, NULL, m, NULL, 0);
+	error = (*so->so_send)(so, nam, NULL, m, NULL, 0, procp);
 	if (error) {
 		printf("nfs_boot: sosend: %d\n", error);
 		goto out;
@@ -557,8 +559,9 @@
  * (once for root and once for swap)
  */
 static int
-nfs_boot_getfh(ndm)
+nfs_boot_getfh(ndm, p)
 	struct nfs_dlmount *ndm;	/* output */
+	struct proc *p;
 {
 	struct nfs_args *args;
 	struct sockaddr_in *sin;
@@ -613,7 +616,7 @@
 	 * Get file handle using RPC to mountd/mount
 	 */
 	sin = (struct sockaddr_in *)&ndm->ndm_saddr;
-	error = md_mount(sin, pathname, args);
+	error = md_mount(sin, pathname, args, p);
 	if (error) {
 		printf("nfs_boot: mountd `%s', error=%d\n",
 		       ndm->ndm_host, error);
@@ -628,7 +631,7 @@
 	error = krpc_portmap(sin, NFS_PROG,
 		    (args->flags & NFSMNT_NFSV3) ? NFS_VER3 : NFS_VER2,
 		    (args->sotype == SOCK_STREAM) ? IPPROTO_TCP : IPPROTO_UDP,
-		    &port);
+		    &port, p);
 	if (port == htons(0))
 		error = EIO;
 	if (error) {
@@ -652,10 +655,11 @@
  * Also, sets sin->sin_port to the NFS service port.
  */
 static int
-md_mount(mdsin, path, argp)
+md_mount(mdsin, path, argp, procp)
 	struct sockaddr_in *mdsin;		/* mountd server address */
 	char *path;
 	struct nfs_args *argp;
+	struct proc *procp;
 {
 	/* The RPC structures */
 	struct rdata {
@@ -679,7 +683,7 @@
 		 * Get port number for MOUNTD.
 		 */
 		error = krpc_portmap(mdsin, RPCPROG_MNT, mntver,
-		                    IPPROTO_UDP, &mdsin->sin_port);
+		                    IPPROTO_UDP, &mdsin->sin_port, procp);
 		if (error)
 			continue;
 
@@ -690,7 +694,7 @@
 
 		/* Do RPC to mountd. */
 		error = krpc_call(mdsin, RPCPROG_MNT, mntver,
-		                  RPCMNT_MOUNT, &m, NULL);
+		                  RPCMNT_MOUNT, &m, NULL, procp);
 		if (error != EPROGMISMATCH)
 			break;
 		/* Try lower version of mountd. */
Index: nfs/nfs_bootdhcp.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_bootdhcp.c,v
retrieving revision 1.26
diff -u -r1.26 nfs_bootdhcp.c
--- nfs/nfs_bootdhcp.c	6 May 2004 12:32:59 -0000	1.26
+++ nfs/nfs_bootdhcp.c	19 May 2004 03:11:14 -0000
@@ -451,7 +451,7 @@
 	int vcilen;
 #endif
 
-	error = socreate(AF_INET, &so, SOCK_DGRAM, 0);
+	error = socreate(AF_INET, &so, SOCK_DGRAM, 0, procp);
 	if (error) {
 		printf("bootp: socreate, error=%d\n", error);
 		return (error);
@@ -538,7 +538,7 @@
 	/*
 	 * Bind the local endpoint to a bootp client port.
 	 */
-	if ((error = nfs_boot_sobind_ipport(so, IPPORT_BOOTPC))) {
+	if ((error = nfs_boot_sobind_ipport(so, IPPORT_BOOTPC, procp))) {
 		DPRINT("bind failed\n");
 		goto out;
 	}
@@ -607,7 +607,7 @@
 #endif
 
 	error = nfs_boot_sendrecv(so, nam, bootpset, m,
-				  bootpcheck, 0, 0, &bpc);
+				  bootpcheck, 0, 0, &bpc, procp);
 	if (error)
 		goto out;
 
@@ -633,7 +633,7 @@
 		bpc.expected_dhcpmsgtype = DHCPACK;
 
 		error = nfs_boot_sendrecv(so, nam, bootpset, m,
-					  bootpcheck, 0, 0, &bpc);
+					  bootpcheck, 0, 0, &bpc, procp);
 		if (error)
 			goto out;
 	}
Index: nfs/nfs_bootparam.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_bootparam.c,v
retrieving revision 1.23
diff -u -r1.23 nfs_bootparam.c
--- nfs/nfs_bootparam.c	29 Jun 2003 22:32:15 -0000	1.23
+++ nfs/nfs_bootparam.c	19 May 2004 03:11:14 -0000
@@ -94,9 +94,9 @@
 
 /* bootparam RPC */
 static int bp_whoami __P((struct sockaddr_in *bpsin,
-	struct in_addr *my_ip, struct in_addr *gw_ip));
+	struct in_addr *my_ip, struct in_addr *gw_ip, struct proc *p));
 static int bp_getfile __P((struct sockaddr_in *bpsin, char *key,
-	struct nfs_dlmount *ndm));
+	struct nfs_dlmount *ndm, struct proc *p));
 
 
 /*
@@ -180,7 +180,7 @@
 	sin->sin_addr.s_addr = INADDR_BROADCAST;
 
 	/* Do the RPC/bootparam/whoami. */
-	error = bp_whoami(sin, &my_ip, &gw_ip);
+	error = bp_whoami(sin, &my_ip, &gw_ip, procp);
 	if (error) {
 		printf("nfs_boot: bootparam whoami, error=%d\n", error);
 		goto delout;
@@ -192,7 +192,7 @@
 	 * Now fetch the server:pathname strings and server IP
 	 * for root and swap.  Missing swap is not fatal.
 	 */
-	error = bp_getfile(sin, "root", &nd->nd_root);
+	error = bp_getfile(sin, "root", &nd->nd_root, procp);
 	if (error) {
 		printf("nfs_boot: bootparam get root: %d\n", error);
 		goto delout;
@@ -201,7 +201,7 @@
 #ifndef NFS_BOOTPARAM_NOGATEWAY
 	gw_ndm = malloc(sizeof(*gw_ndm), M_NFSMNT, M_WAITOK);
 	memset((caddr_t)gw_ndm, 0, sizeof(*gw_ndm));
-	error = bp_getfile(sin, "gateway", gw_ndm);
+	error = bp_getfile(sin, "gateway", gw_ndm, procp);
 	if (error) {
 		/* No gateway supplied. No error, but try fallback. */
 		error = 0;
@@ -291,10 +291,11 @@
  * know about us (don't want to broadcast a getport call).
  */
 static int
-bp_whoami(bpsin, my_ip, gw_ip)
+bp_whoami(bpsin, my_ip, gw_ip, p)
 	struct sockaddr_in *bpsin;
 	struct in_addr *my_ip;
 	struct in_addr *gw_ip;
+	struct proc *p;
 {
 	/* RPC structures for PMAPPROC_CALLIT */
 	struct whoami_call {
@@ -334,7 +335,7 @@
 	bpsin->sin_port = htons(PMAPPORT);
 	from = NULL;
 	error = krpc_call(bpsin, PMAPPROG, PMAPVERS,
-			PMAPPROC_CALLIT, &m, &from);
+			PMAPPROC_CALLIT, &m, &from, p);
 	if (error)
 		return error;
 
@@ -398,10 +399,11 @@
  *	server pathname
  */
 static int
-bp_getfile(bpsin, key, ndm)
+bp_getfile(bpsin, key, ndm, p)
 	struct sockaddr_in *bpsin;
 	char *key;
 	struct nfs_dlmount *ndm;
+	struct proc *p;
 {
 	char pathname[MNAMELEN];
 	struct in_addr inaddr;
@@ -426,7 +428,7 @@
 
 	/* RPC: bootparam/getfile */
 	error = krpc_call(bpsin, BOOTPARAM_PROG, BOOTPARAM_VERS,
-	                  BOOTPARAM_GETFILE, &m, NULL);
+	                  BOOTPARAM_GETFILE, &m, NULL, p);
 	if (error)
 		return error;
 
Index: nfs/nfs_nqlease.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_nqlease.c,v
retrieving revision 1.55
diff -u -r1.55 nfs_nqlease.c
--- nfs/nfs_nqlease.c	21 Apr 2004 02:22:49 -0000	1.55
+++ nfs/nfs_nqlease.c	19 May 2004 03:11:14 -0000
@@ -270,7 +270,7 @@
 		} else {
 			lp->lc_flag |= LC_NONCACHABLE;
 			nqsrv_locklease(lp);
-			nqsrv_send_eviction(vp, lp, slp, nam, cred);
+			nqsrv_send_eviction(vp, lp, slp, nam, cred, procp);
 			nqsrv_waitfor_expiry(lp);
 			nqsrv_unlocklease(lp);
 		}
@@ -453,12 +453,13 @@
  * Send out eviction notice messages to all other hosts for the lease.
  */
 void
-nqsrv_send_eviction(vp, lp, slp, nam, cred)
+nqsrv_send_eviction(vp, lp, slp, nam, cred, p)
 	struct vnode *vp;
 	struct nqlease *lp;
 	struct nfssvc_sock *slp;
 	struct mbuf *nam;
 	struct ucred *cred;
+	struct proc *p;
 {
 	struct nqhost *lph = &lp->lc_host;
 	struct mbuf *m;
@@ -549,7 +550,7 @@
 				if (solockp)
 					*solockp |= NFSMNT_SNDLOCK;
 				(void) nfs_send(so, nam2, m,
-						(struct nfsreq *)0);
+						(struct nfsreq *)0, p);
 				if (solockp)
 					nfs_sndunlock(solockp);
 			}
@@ -888,9 +889,10 @@
  * Client vacated message function.
  */
 int
-nqnfs_vacated(vp, cred)
+nqnfs_vacated(vp, cred, p)
 	struct vnode *vp;
 	struct ucred *cred;
+	struct proc *p;
 {
 	caddr_t cp;
 	struct mbuf *m;
@@ -927,7 +929,7 @@
 	myrep.r_nmp = nmp;
 	if (nmp->nm_soflags & PR_CONNREQUIRED)
 		(void) nfs_sndlock(&nmp->nm_iflag, (struct nfsreq *)0);
-	(void) nfs_send(nmp->nm_so, nmp->nm_nam, m, &myrep);
+	(void) nfs_send(nmp->nm_so, nmp->nm_nam, m, &myrep, p);
 	if (nmp->nm_soflags & PR_CONNREQUIRED)
 		nfs_sndunlock(&nmp->nm_iflag);
 nfsmout:
@@ -1081,7 +1083,7 @@
 		    myrep.r_nmp = nmp;
 		    myrep.r_mrep = (struct mbuf *)0;
 		    myrep.r_procp = (struct proc *)0;
-		    (void) nfs_reply(&myrep);
+		    (void) nfs_reply(&myrep, p);
 		}
 
 		/*
@@ -1105,7 +1107,7 @@
 						(void) nfs_vinvalbuf(vp,
 						       V_SAVE, cred, p, 0);
 						np->n_flag &= ~NQNFSEVICTED;
-						(void) nqnfs_vacated(vp, cred);
+						(void) nqnfs_vacated(vp, cred, p);
 					} else if (vp->v_type == VREG) {
 						(void) VOP_FSYNC(vp, cred,
 						    FSYNC_WAIT, 0, 0, p);
Index: nfs/nfs_socket.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_socket.c,v
retrieving revision 1.104
diff -u -r1.104 nfs_socket.c
--- nfs/nfs_socket.c	10 May 2004 10:40:42 -0000	1.104
+++ nfs/nfs_socket.c	19 May 2004 03:11:16 -0000
@@ -154,9 +154,10 @@
  * We do not free the sockaddr if error.
  */
 int
-nfs_connect(nmp, rep)
+nfs_connect(nmp, rep, p)
 	struct nfsmount *nmp;
 	struct nfsreq *rep;
+	struct proc *p;
 {
 	struct socket *so;
 	int s, error, rcvreserve, sndreserve;
@@ -169,8 +170,8 @@
 
 	nmp->nm_so = (struct socket *)0;
 	saddr = mtod(nmp->nm_nam, struct sockaddr *);
-	error = socreate(saddr->sa_family, &nmp->nm_so, nmp->nm_sotype, 
-		nmp->nm_soproto);
+	error = socreate(saddr->sa_family, &nmp->nm_so,
+		nmp->nm_sotype, nmp->nm_soproto, p);
 	if (error)
 		goto bad;
 	so = nmp->nm_so;
@@ -235,7 +236,7 @@
 			goto bad;
 		}
 	} else {
-		error = soconnect(so, nmp->nm_nam);
+		error = soconnect(so, nmp->nm_nam, p);
 		if (error)
 			goto bad;
 
@@ -332,15 +333,16 @@
  * nb: Must be called with the nfs_sndlock() set on the mount point.
  */
 int
-nfs_reconnect(rep)
+nfs_reconnect(rep, p)
 	struct nfsreq *rep;
+	struct proc *p;
 {
 	struct nfsreq *rp;
 	struct nfsmount *nmp = rep->r_nmp;
 	int error;
 
 	nfs_disconnect(nmp);
-	while ((error = nfs_connect(nmp, rep)) != 0) {
+	while ((error = nfs_connect(nmp, rep, p)) != 0) {
 		if (error == EINTR || error == ERESTART)
 			return (EINTR);
 		(void) tsleep((caddr_t)&lbolt, PSOCK, "nfscn2", 0);
@@ -421,15 +423,25 @@
  * - do any cleanup required by recoverable socket errors (? ? ?)
  */
 int
-nfs_send(so, nam, top, rep)
+nfs_send(so, nam, top, rep, p)
 	struct socket *so;
 	struct mbuf *nam;
 	struct mbuf *top;
 	struct nfsreq *rep;
+	struct proc *p;
 {
 	struct mbuf *sendnam;
 	int error, soflags, flags;
 
+	/* XXX nfs_doio()/nfs_request() calls with  rep->r_procp == NULL */
+	if (p == NULL && rep->r_procp == NULL) {
+#ifdef DIAGNOSTIC
+		printf("nfs_send: proc botch: rep %p arg %p curproc %p\n",
+		       rep->r_procp, p, curproc );
+#endif
+		p = curproc;
+	}
+
 	if (rep) {
 		if (rep->r_flags & R_SOFTTERM) {
 			m_freem(top);
@@ -454,7 +466,7 @@
 		flags = 0;
 
 	error = (*so->so_send)(so, sendnam, (struct uio *)0, top,
-		(struct mbuf *)0, flags);
+		    (struct mbuf *)0, flags,  p);
 	if (error) {
 		if (rep) {
 			if (error == ENOBUFS && so->so_type == SOCK_DGRAM) {
@@ -514,10 +526,11 @@
  * we have read any of it, even if the system call has been interrupted.
  */
 int
-nfs_receive(rep, aname, mp)
+nfs_receive(rep, aname, mp, p)
 	struct nfsreq *rep;
 	struct mbuf **aname;
 	struct mbuf **mp;
+	struct proc *p;
 {
 	struct socket *so;
 	struct uio auio;
@@ -527,7 +540,6 @@
 	u_int32_t len;
 	struct mbuf **getnam;
 	int error, sotype, rcvflg;
-	struct proc *p = curproc;	/* XXX */
 
 	/*
 	 * Set up arguments for soreceive()
@@ -564,7 +576,7 @@
 		}
 		so = rep->r_nmp->nm_so;
 		if (!so) {
-			error = nfs_reconnect(rep); 
+			error = nfs_reconnect(rep, p); 
 			if (error) {
 				nfs_sndunlock(&rep->r_nmp->nm_iflag);
 				return (error);
@@ -574,10 +586,10 @@
 		while (rep->r_flags & R_MUSTRESEND) {
 			m = m_copym(rep->r_mreq, 0, M_COPYALL, M_WAIT);
 			nfsstats.rpcretries++;
-			error = nfs_send(so, rep->r_nmp->nm_nam, m, rep);
+			error = nfs_send(so, rep->r_nmp->nm_nam, m, rep, p);
 			if (error) {
 				if (error == EINTR || error == ERESTART ||
-				    (error = nfs_reconnect(rep)) != 0) {
+				    (error = nfs_reconnect(rep, p)) != 0) {
 					nfs_sndunlock(&rep->r_nmp->nm_iflag);
 					return (error);
 				}
@@ -689,7 +701,7 @@
 				 rep->r_nmp->nm_mountp->mnt_stat.f_mntfromname);
 			error = nfs_sndlock(&rep->r_nmp->nm_iflag, rep);
 			if (!error)
-				error = nfs_reconnect(rep);
+				error = nfs_reconnect(rep, p);
 			if (!error)
 				goto tryagain;
 			else
@@ -730,8 +742,9 @@
  */
 /* ARGSUSED */
 int
-nfs_reply(myrep)
+nfs_reply(myrep, procp)
 	struct nfsreq *myrep;
+	struct proc *procp;
 {
 	struct nfsreq *rep;
 	struct nfsmount *nmp = myrep->r_nmp;
@@ -760,7 +773,7 @@
 		 * Get the next Rpc reply off the socket
 		 */
 		nmp->nm_waiters++;
-		error = nfs_receive(myrep, &nam, &mrep);
+		error = nfs_receive(myrep, &nam, &mrep, procp);
 		nfs_rcvunlock(nmp);
 		if (error) {
 
@@ -1050,7 +1063,7 @@
 			error = nfs_sndlock(&nmp->nm_iflag, rep);
 		if (!error) {
 			m = m_copym(rep->r_mreq, 0, M_COPYALL, M_WAIT);
-			error = nfs_send(nmp->nm_so, nmp->nm_nam, m, rep);
+			error = nfs_send(nmp->nm_so, nmp->nm_nam, m, rep, procp);
 			if (nmp->nm_soflags & PR_CONNREQUIRED)
 				nfs_sndunlock(&nmp->nm_iflag);
 		}
@@ -1067,7 +1080,7 @@
 	 * Wait for the reply from our send or the timer's.
 	 */
 	if (!error || error == EPIPE)
-		error = nfs_reply(rep);
+		error = nfs_reply(rep, procp);
 
 	/*
 	 * RPC done, unlink the request.
Index: nfs/nfs_syscalls.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_syscalls.c,v
retrieving revision 1.74
diff -u -r1.74 nfs_syscalls.c
--- nfs/nfs_syscalls.c	17 Mar 2004 10:43:35 -0000	1.74
+++ nfs/nfs_syscalls.c	19 May 2004 03:11:16 -0000
@@ -750,7 +750,7 @@
 					(void) nfs_sndlock(solockp, NULL);
 				if (slp->ns_flag & SLP_VALID) {
 					error =
-					    nfs_send(so, nd->nd_nam2, m, NULL);
+					    nfs_send(so, nd->nd_nam2, m, NULL, p);
 				} else {
 					error = EPIPE;
 					m_freem(m);
Index: nfs/nfs_var.h
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_var.h,v
retrieving revision 1.44
diff -u -r1.44 nfs_var.h
--- nfs/nfs_var.h	10 May 2004 10:40:42 -0000	1.44
+++ nfs/nfs_var.h	19 May 2004 03:11:16 -0000
@@ -144,7 +144,7 @@
 int nqsrv_cmpnam __P((struct nfssvc_sock *, struct mbuf *, struct nqhost *));
 void nqsrv_send_eviction __P((struct vnode *, struct nqlease *,
 			      struct nfssvc_sock *, struct mbuf *,
-			      struct ucred *));
+			      struct ucred *, struct proc *));
 void nqsrv_waitfor_expiry __P((struct nqlease *));
 void nqnfs_serverd __P((void));
 int nqnfsrv_getlease __P((struct nfsrv_descript *, struct nfssvc_sock *,
@@ -152,7 +152,7 @@
 int nqnfsrv_vacated __P((struct nfsrv_descript *, struct nfssvc_sock *,
 			 struct proc *, struct mbuf **));
 int nqnfs_getlease __P((struct vnode *, int, struct ucred *, struct proc *));
-int nqnfs_vacated __P((struct vnode *, struct ucred *));
+int nqnfs_vacated __P((struct vnode *, struct ucred *, struct proc *));
 int nqnfs_callback __P((struct nfsmount *, struct mbuf *, struct mbuf *,
 			caddr_t));
 
@@ -210,14 +210,15 @@
 		      int));
 
 /* nfs_socket.c */
-int nfs_connect __P((struct nfsmount *, struct nfsreq *));
-int nfs_reconnect __P((struct nfsreq *));
+int nfs_connect __P((struct nfsmount *, struct nfsreq *, struct proc *));
+int nfs_reconnect __P((struct nfsreq *, struct proc *));
 void nfs_disconnect __P((struct nfsmount *));
 void nfs_safedisconnect __P((struct nfsmount *));
 int nfs_send __P((struct socket *, struct mbuf *, struct mbuf *,
-		  struct nfsreq *));
-int nfs_receive __P((struct nfsreq *, struct mbuf **, struct mbuf **));
-int nfs_reply __P((struct nfsreq *));
+		  struct nfsreq *, struct proc *));
+int nfs_receive __P((struct nfsreq *, struct mbuf **, struct mbuf **,
+		     struct proc *));
+int nfs_reply __P((struct nfsreq *, struct proc *));
 int nfs_request __P((struct nfsnode *, struct mbuf *, int, struct proc *,
 		     struct ucred *, struct mbuf **, struct mbuf **,
 		     caddr_t *, int *));
Index: nfs/nfs_vfsops.c
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfs_vfsops.c,v
retrieving revision 1.137
diff -u -r1.137 nfs_vfsops.c
--- nfs/nfs_vfsops.c	27 Apr 2004 17:37:31 -0000	1.137
+++ nfs/nfs_vfsops.c	19 May 2004 03:11:17 -0000
@@ -415,9 +415,10 @@
 }
 
 void
-nfs_decode_args(nmp, argp)
+nfs_decode_args(nmp, argp, p)
 	struct nfsmount *nmp;
 	struct nfs_args *argp;
+	struct proc *p;
 {
 	int s;
 	int adjsock;
@@ -538,7 +539,7 @@
 	if (nmp->nm_so && adjsock) {
 		nfs_safedisconnect(nmp);
 		if (nmp->nm_sotype == SOCK_DGRAM)
-			while (nfs_connect(nmp, (struct nfsreq *)0)) {
+			while (nfs_connect(nmp, (struct nfsreq *)0, p)) {
 				printf("nfs_args: retrying connect\n");
 				(void) tsleep((caddr_t)&lbolt,
 					      PSOCK, "nfscn3", 0);
@@ -629,7 +630,7 @@
 		    ~(NFSMNT_NFSV3|NFSMNT_NQNFS|NFSMNT_XLATECOOKIE)) |
 		    (nmp->nm_flag &
 			(NFSMNT_NFSV3|NFSMNT_NQNFS|NFSMNT_XLATECOOKIE));
-		nfs_decode_args(nmp, &args);
+		nfs_decode_args(nmp, &args, p);
 		return (0);
 	}
 	if (args.fhsize < 0 || args.fhsize > NFSX_V3FHMAX)
@@ -752,7 +753,7 @@
 	nmp->nm_sotype = argp->sotype;
 	nmp->nm_soproto = argp->proto;
 
-	nfs_decode_args(nmp, argp);
+	nfs_decode_args(nmp, argp, p);
 
 	mp->mnt_fs_bshift = ffs(MIN(nmp->nm_rsize, nmp->nm_wsize)) - 1;
 	mp->mnt_dev_bshift = DEV_BSHIFT;
@@ -762,7 +763,7 @@
 	 * the first request, in case the server is not responding.
 	 */
 	if (nmp->nm_sotype == SOCK_DGRAM &&
-		(error = nfs_connect(nmp, (struct nfsreq *)0)))
+		(error = nfs_connect(nmp, (struct nfsreq *)0, p)))
 		goto bad;
 
 	/*
Index: nfs/nfsdiskless.h
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfsdiskless.h,v
retrieving revision 1.22
diff -u -r1.22 nfsdiskless.h
--- nfs/nfsdiskless.h	1 May 2004 06:16:42 -0000	1.22
+++ nfs/nfsdiskless.h	19 May 2004 03:11:17 -0000
@@ -77,11 +77,11 @@
 void nfs_boot_flushrt __P((struct ifnet *));
 int nfs_boot_setrecvtimo __P((struct socket *));
 int nfs_boot_enbroadcast __P((struct socket *));
-int nfs_boot_sobind_ipport __P((struct socket *, u_int16_t));
+int nfs_boot_sobind_ipport __P((struct socket *, u_int16_t, struct proc *));
 int nfs_boot_sendrecv __P((struct socket *, struct mbuf *,
 			   int (*)(struct mbuf*, void*, int), struct mbuf*,
 			   int (*)(struct mbuf*, void*), struct mbuf**,
-			   struct mbuf**, void*));
+			   struct mbuf**, void*, struct proc *));
 
 int nfs_bootdhcp  __P((struct nfs_diskless *, struct proc *));
 int nfs_bootparam __P((struct nfs_diskless *, struct proc *));
Index: nfs/nfsmount.h
===================================================================
RCS file: /cvsroot/src/sys/nfs/nfsmount.h,v
retrieving revision 1.31
diff -u -r1.31 nfsmount.h
--- nfs/nfsmount.h	27 Apr 2004 17:37:31 -0000	1.31
+++ nfs/nfsmount.h	19 May 2004 03:11:17 -0000
@@ -180,7 +180,8 @@
 		struct mbuf *nam, const char *pth, const char *hst,
 		struct vnode **vpp, struct proc *p));
 int	nfs_mountroot __P((void));
-void	nfs_decode_args __P((struct nfsmount *, struct nfs_args *));
+void	nfs_decode_args __P((struct nfsmount *, struct nfs_args *,
+		struct proc *p));
 int	nfs_start __P((struct mount *mp, int flags, struct proc *p));
 int	nfs_unmount __P((struct mount *mp, int mntflags, struct proc *p));
 int	nfs_root __P((struct mount *mp, struct vnode **vpp));
Index: sys/domain.h
===================================================================
RCS file: /cvsroot/src/sys/sys/domain.h,v
retrieving revision 1.18
diff -u -r1.18 domain.h
--- sys/domain.h	22 Apr 2004 01:34:17 -0000	1.18
+++ sys/domain.h	19 May 2004 03:11:17 -0000
@@ -42,6 +42,7 @@
 /*
  * Forward structure declarations for function prototypes [sic].
  */
+struct	proc;
 struct	mbuf;
 struct	ifnet;
 
@@ -51,7 +52,7 @@
 	void	(*dom_init)		/* initialize domain data structures */
 			(void);
 	int	(*dom_externalize)	/* externalize access rights */
-			(struct mbuf *);
+			(struct mbuf *, struct proc *);
 	void	(*dom_dispose)		/* dispose of internalized rights */
 			(struct mbuf *);
 	const struct protosw *dom_protosw, *dom_protoswNPROTOSW;
Index: sys/socketvar.h
===================================================================
RCS file: /cvsroot/src/sys/sys/socketvar.h,v
retrieving revision 1.74
diff -u -r1.74 socketvar.h
--- sys/socketvar.h	22 Apr 2004 01:01:42 -0000	1.74
+++ sys/socketvar.h	19 May 2004 03:11:17 -0000
@@ -122,7 +122,7 @@
 	caddr_t		so_upcallarg;	/* Arg for above */
 	int		(*so_send) (struct socket *, struct mbuf *,
 					struct uio *, struct mbuf *,
-					struct mbuf *, int);
+					struct mbuf *, int, struct proc *);
 	int		(*so_receive) (struct socket *,
 					struct mbuf **,
 					struct uio *, struct mbuf **,
@@ -303,9 +303,9 @@
 void	socantrcvmore(struct socket *);
 void	socantsendmore(struct socket *);
 int	soclose(struct socket *);
-int	soconnect(struct socket *, struct mbuf *);
+int	soconnect(struct socket *, struct mbuf *, struct proc *);
 int	soconnect2(struct socket *, struct socket *);
-int	socreate(int, struct socket **, int, int);
+int	socreate(int, struct socket **, int, int, struct proc *);
 int	sodisconnect(struct socket *);
 void	sofree(struct socket *);
 int	sogetopt(struct socket *, int, int, struct mbuf **);
@@ -324,7 +324,7 @@
 int	soreserve(struct socket *, u_long, u_long);
 void	sorflush(struct socket *);
 int	sosend(struct socket *, struct mbuf *, struct uio *,
-	    struct mbuf *, struct mbuf *, int);
+	    struct mbuf *, struct mbuf *, int, struct proc *);
 int	sosetopt(struct socket *, int, int, struct mbuf *);
 int	soshutdown(struct socket *, int);
 void	sowakeup(struct socket *, struct sockbuf *, int);
Index: sys/un.h
===================================================================
RCS file: /cvsroot/src/sys/sys/un.h,v
retrieving revision 1.35
diff -u -r1.35 un.h
--- sys/un.h	18 Apr 2004 21:43:45 -0000	1.35
+++ sys/un.h	19 May 2004 03:11:17 -0000
@@ -79,7 +79,7 @@
 void	unp_mark (struct file *);
 void	unp_scan (struct mbuf *, void (*)(struct file *), int);
 void	unp_shutdown (struct unpcb *);
-int 	unp_externalize (struct mbuf *);
+int 	unp_externalize (struct mbuf *, struct proc *);
 int	unp_internalize (struct mbuf *, struct proc *);
 void 	unp_dispose (struct mbuf *);
 int	unp_output (struct mbuf *, struct mbuf *, struct unpcb *,