diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2018-06-06 06:55:23 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2018-06-06 06:55:23 +0000 |
commit | 74ae735dc00571554d21c96495d3f4db8cf61232 (patch) | |
tree | 8d455bd05235d0e6943ea13b550f240dd5d41b5a /sys/kern/uipc_socket2.c | |
parent | 4bfe4a74ff0d1a4718c00b31d4e10011a2b9470e (diff) |
Pass the socket to sounlock(), this prepare the terrain for per-socket
locking.
ok visa@, bluhm@
Diffstat (limited to 'sys/kern/uipc_socket2.c')
-rw-r--r-- | sys/kern/uipc_socket2.c | 33 |
1 files changed, 23 insertions, 10 deletions
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 8bb11fd97a1..5291bde56aa 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket2.c,v 1.93 2018/05/07 15:51:53 mpi Exp $ */ +/* $OpenBSD: uipc_socket2.c,v 1.94 2018/06/06 06:55:22 mpi Exp $ */ /* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */ /* @@ -277,25 +277,38 @@ solock(struct socket *so) { int s = 0; - if ((so->so_proto->pr_domain->dom_family != PF_UNIX) && - (so->so_proto->pr_domain->dom_family != PF_ROUTE) && - (so->so_proto->pr_domain->dom_family != PF_KEY)) + switch (so->so_proto->pr_domain->dom_family) { + case PF_INET: + case PF_INET6: + s = -42; NET_LOCK(); - else { + break; + case PF_UNIX: + case PF_ROUTE: + case PF_KEY: + default: KERNEL_LOCK(); - s = -42; + break; } return (s); } void -sounlock(int s) +sounlock(struct socket *so, int s) { - if (s != -42) - NET_UNLOCK(); - else { + switch (so->so_proto->pr_domain->dom_family) { + case PF_INET: + case PF_INET6: + if (s == -42) + NET_UNLOCK(); + break; + case PF_UNIX: + case PF_ROUTE: + case PF_KEY: + default: KERNEL_UNLOCK(); + break; } } |