Make sobind() take a struct proc *. It already took curproc and trunk
authorfvdl <fvdl@NetBSD.org>
Sun, 10 Dec 2000 23:16:28 +0000
branchtrunk
changeset 73123 3a3a452b50b3
parent 73122 73abf751c4ce
child 73124 56554a1faa04
Make sobind() take a struct proc *. It already took curproc and passed it down to the appropriate usrreq function, and this allows usage for contexts that need to be explicitly different from curproc (like in the NFS code when binding to a reserved port).
sys/kern/uipc_socket.c
sys/kern/uipc_syscalls.c
sys/nfs/nfs_boot.c
sys/nfs/nfs_socket.c
--- a/sys/kern/uipc_socket.c	Sun Dec 10 23:13:42 2000 +0000
+++ b/sys/kern/uipc_socket.c	Sun Dec 10 23:16:28 2000 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket.c,v 1.50 2000/03/30 09:27:14 augustss Exp $	*/
+/*	$NetBSD: uipc_socket.c,v 1.51 2000/12/10 23:16:28 fvdl Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1990, 1993
@@ -126,11 +126,11 @@
 }
 
 int
-sobind(so, nam)
+sobind(so, nam, p)
 	struct socket *so;
 	struct mbuf *nam;
+	struct proc *p;
 {
-	struct proc *p = curproc;		/* XXX */
 	int s = splsoftnet();
 	int error;
 
--- a/sys/kern/uipc_syscalls.c	Sun Dec 10 23:13:42 2000 +0000
+++ b/sys/kern/uipc_syscalls.c	Sun Dec 10 23:16:28 2000 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_syscalls.c,v 1.55 2000/11/24 21:38:28 jdolecek Exp $	*/
+/*	$NetBSD: uipc_syscalls.c,v 1.56 2000/12/10 23:16:28 fvdl Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -132,7 +132,7 @@
 		FILE_UNUSE(fp, p);
 		return (error);
 	}
-	error = sobind((struct socket *)fp->f_data, nam);
+	error = sobind((struct socket *)fp->f_data, nam, p);
 	m_freem(nam);
 	FILE_UNUSE(fp, p);
 	return (error);
--- a/sys/nfs/nfs_boot.c	Sun Dec 10 23:13:42 2000 +0000
+++ b/sys/nfs/nfs_boot.c	Sun Dec 10 23:16:28 2000 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_boot.c,v 1.54 2000/09/19 17:04:51 bjh21 Exp $	*/
+/*	$NetBSD: nfs_boot.c,v 1.55 2000/12/10 23:17:01 fvdl Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1997 The NetBSD Foundation, Inc.
@@ -360,7 +360,7 @@
 	sin->sin_family = AF_INET;
 	sin->sin_addr.s_addr = INADDR_ANY;
 	sin->sin_port = htons(port);
-	error = sobind(so, m);
+	error = sobind(so, m, curproc);
 	m_freem(m);
 	return (error);
 }
--- a/sys/nfs/nfs_socket.c	Sun Dec 10 23:13:42 2000 +0000
+++ b/sys/nfs/nfs_socket.c	Sun Dec 10 23:16:28 2000 +0000
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_socket.c,v 1.62 2000/09/27 18:36:03 fvdl Exp $	*/
+/*	$NetBSD: nfs_socket.c,v 1.63 2000/12/10 23:17:01 fvdl Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993, 1995
@@ -186,7 +186,7 @@
 		sin->sin_addr.s_addr = INADDR_ANY;
 		tport = IPPORT_RESERVED - 1;
 		sin->sin_port = htons(tport);
-		while ((error = sobind(so, m)) == EADDRINUSE &&
+		while ((error = sobind(so, m, &proc0)) == EADDRINUSE &&
 		       --tport > IPPORT_RESERVED / 2)
 			sin->sin_port = htons(tport);
 		m_freem(m);
@@ -202,7 +202,7 @@
 		sin6->sin6_addr = in6addr_any;
 		tport = IPV6PORT_RESERVED - 1;
 		sin6->sin6_port = htons(tport);
-		while ((error = sobind(so, m)) == EADDRINUSE &&
+		while ((error = sobind(so, m, &proc0)) == EADDRINUSE &&
 		       --tport > IPV6PORT_RESERVED / 2)
 			sin6->sin6_port = htons(tport);
 		m_freem(m);