From 6a1c2aef88b5c0b0929f8a576cb2182a8feaaf9f Mon Sep 17 00:00:00 2001 From: bluhm Date: Sat, 6 Aug 2022 15:57:58 +0000 Subject: [PATCH] Clean up the netlock macros. Merge NET_RLOCK_IN_SOFTNET and NET_RLOCK_IN_IOCTL, which have the same implementation. The R and W are hard to see, call the new macro NET_LOCK_SHARED. Rename the opposite assertion from NET_ASSERT_WLOCKED to NET_ASSERT_LOCKED_EXCLUSIVE. Update some outdated comments about net locking. OK mpi@ mvs@ --- sys/net/if.c | 40 +++++++++++++++++---------------------- sys/net/pf_ioctl.c | 6 +++--- sys/netinet/in.c | 6 +++--- sys/netinet/in_pcb.c | 4 ++-- sys/netinet/ip_input.c | 9 +++++---- sys/netinet/ip_ipsp.c | 4 ++-- sys/netinet/ip_mroute.c | 10 +++++----- sys/netinet/raw_ip.c | 4 ++-- sys/netinet/udp_usrreq.c | 4 ++-- sys/netinet6/in6.c | 6 +++--- sys/netinet6/in6_pcb.c | 4 ++-- sys/netinet6/ip6_input.c | 7 ++++--- sys/netinet6/ip6_mroute.c | 10 +++++----- sys/netinet6/nd6.c | 12 ++++++------ sys/netinet6/raw_ip6.c | 4 ++-- sys/sys/systm.h | 28 +++++++++++---------------- 16 files changed, 74 insertions(+), 84 deletions(-) diff --git a/sys/net/if.c b/sys/net/if.c index edd4aa69997..cdb43e83d15 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.661 2022/08/05 13:57:16 bluhm Exp $ */ +/* $OpenBSD: if.c,v 1.662 2022/08/06 15:57:58 bluhm Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -869,22 +869,16 @@ if_input_process(struct ifnet *ifp, struct mbuf_list *ml) enqueue_randomness(ml_len(ml) ^ (uintptr_t)MBUF_LIST_FIRST(ml)); /* - * We grab the NET_LOCK() before processing any packet to - * ensure there's no contention on the routing table lock. - * - * Without it we could race with a userland thread to insert - * a L2 entry in ip{6,}_output(). Such race would result in - * one of the threads sleeping *inside* the IP output path. - * - * Since we have a NET_LOCK() we also use it to serialize access - * to PF globals, pipex globals, unicast and multicast addresses - * lists and the socket layer. + * We grab the shared netlock for packet processing in the softnet + * threads. Packets can regrab the exclusive lock via queues. + * ioctl, sysctl, and socket syscall may use shared lock if access is + * read only or MP safe. Usually they hold the exclusive net lock. */ - NET_RLOCK_IN_SOFTNET(); + NET_LOCK_SHARED(); while ((m = ml_dequeue(ml)) != NULL) (*ifp->if_input)(ifp, m); - NET_RUNLOCK_IN_SOFTNET(); + NET_UNLOCK_SHARED(); } void @@ -2423,27 +2417,27 @@ ifioctl_get(u_long cmd, caddr_t data) switch(cmd) { case SIOCGIFCONF: - NET_RLOCK_IN_IOCTL(); + NET_LOCK_SHARED(); error = ifconf(data); - NET_RUNLOCK_IN_IOCTL(); + NET_UNLOCK_SHARED(); return (error); case SIOCIFGCLONERS: error = if_clone_list((struct if_clonereq *)data); return (error); case SIOCGIFGMEMB: - NET_RLOCK_IN_IOCTL(); + NET_LOCK_SHARED(); error = if_getgroupmembers(data); - NET_RUNLOCK_IN_IOCTL(); + NET_UNLOCK_SHARED(); return (error); case SIOCGIFGATTR: - NET_RLOCK_IN_IOCTL(); + NET_LOCK_SHARED(); error = if_getgroupattribs(data); - NET_RUNLOCK_IN_IOCTL(); + NET_UNLOCK_SHARED(); return (error); case SIOCGIFGLIST: - NET_RLOCK_IN_IOCTL(); + NET_LOCK_SHARED(); error = if_getgrouplist(data); - NET_RUNLOCK_IN_IOCTL(); + NET_UNLOCK_SHARED(); return (error); } @@ -2451,7 +2445,7 @@ ifioctl_get(u_long cmd, caddr_t data) if (ifp == NULL) return (ENXIO); - NET_RLOCK_IN_IOCTL(); + NET_LOCK_SHARED(); switch(cmd) { case SIOCGIFFLAGS: @@ -2519,7 +2513,7 @@ ifioctl_get(u_long cmd, caddr_t data) panic("invalid ioctl %lu", cmd); } - NET_RUNLOCK_IN_IOCTL(); + NET_UNLOCK_SHARED(); if_put(ifp); diff --git a/sys/net/pf_ioctl.c b/sys/net/pf_ioctl.c index 6909a394ed8..b540afc6fe2 100644 --- a/sys/net/pf_ioctl.c +++ b/sys/net/pf_ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pf_ioctl.c,v 1.384 2022/07/28 12:27:29 mbuhl Exp $ */ +/* $OpenBSD: pf_ioctl.c,v 1.385 2022/08/06 15:57:58 bluhm Exp $ */ /* * Copyright (c) 2001 Daniel Hartmeier @@ -3244,12 +3244,12 @@ pf_sysctl(void *oldp, size_t *oldlenp, void *newp, size_t newlen) { struct pf_status pfs; - NET_RLOCK_IN_IOCTL(); + NET_LOCK_SHARED(); PF_LOCK(); memcpy(&pfs, &pf_status, sizeof(struct pf_status)); pfi_update_status(pfs.ifname, &pfs); PF_UNLOCK(); - NET_RUNLOCK_IN_IOCTL(); + NET_UNLOCK_SHARED(); return sysctl_rdstruct(oldp, oldlenp, newp, &pfs, sizeof(pfs)); } diff --git a/sys/netinet/in.c b/sys/netinet/in.c index 74de12f1820..2ff41a56f9a 100644 --- a/sys/netinet/in.c +++ b/sys/netinet/in.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in.c,v 1.174 2022/05/05 08:43:37 claudio Exp $ */ +/* $OpenBSD: in.c,v 1.175 2022/08/06 15:57:59 bluhm Exp $ */ /* $NetBSD: in.c,v 1.26 1996/02/13 23:41:39 christos Exp $ */ /* @@ -569,7 +569,7 @@ in_ioctl_get(u_long cmd, caddr_t data, struct ifnet *ifp) return (error); } - NET_RLOCK_IN_IOCTL(); + NET_LOCK_SHARED(); TAILQ_FOREACH(ifa, &ifp->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family != AF_INET) @@ -620,7 +620,7 @@ in_ioctl_get(u_long cmd, caddr_t data, struct ifnet *ifp) } err: - NET_RUNLOCK_IN_IOCTL(); + NET_UNLOCK_SHARED(); return (error); } diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index cf8667b5fa3..f55eaf3e3fe 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.268 2022/06/28 09:32:27 bluhm Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.269 2022/08/06 15:57:59 bluhm Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -674,7 +674,7 @@ in_pcbnotifyall(struct inpcbtable *table, struct sockaddr *dst, u_int rtable, struct in_addr faddr; u_int rdomain; - NET_ASSERT_WLOCKED(); + NET_ASSERT_LOCKED_EXCLUSIVE(); if (dst->sa_family != AF_INET) return; diff --git a/sys/netinet/ip_input.c b/sys/netinet/ip_input.c index 8389ae05009..adab68741b0 100644 --- a/sys/netinet/ip_input.c +++ b/sys/netinet/ip_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_input.c,v 1.376 2022/08/04 18:05:09 bluhm Exp $ */ +/* $OpenBSD: ip_input.c,v 1.377 2022/08/06 15:57:59 bluhm Exp $ */ /* $NetBSD: ip_input.c,v 1.30 1996/03/16 23:53:58 christos Exp $ */ /* @@ -233,8 +233,8 @@ ip_init(void) /* * Enqueue packet for local delivery. Queuing is used as a boundary - * between the network layer (input/forward path) running with shared - * NET_RLOCK_IN_SOFTNET() and the transport layer needing it exclusively. + * between the network layer (input/forward path) running with + * NET_LOCK_SHARED() and the transport layer needing it exclusively. */ int ip_ours(struct mbuf **mp, int *offp, int nxt, int af) @@ -254,6 +254,7 @@ ip_ours(struct mbuf **mp, int *offp, int nxt, int af) /* * Dequeue and process locally delivered packets. + * This is called with exclusive NET_LOCK(). */ void ipintr(void) @@ -696,7 +697,7 @@ ip_deliver(struct mbuf **mp, int *offp, int nxt, int af) int nest = 0; #endif /* INET6 */ - NET_ASSERT_WLOCKED(); + NET_ASSERT_LOCKED_EXCLUSIVE(); /* pf might have modified stuff, might have to chksum */ switch (af) { diff --git a/sys/netinet/ip_ipsp.c b/sys/netinet/ip_ipsp.c index 99e82c2e44c..4f9d1b97a09 100644 --- a/sys/netinet/ip_ipsp.c +++ b/sys/netinet/ip_ipsp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipsp.c,v 1.272 2022/07/14 13:52:10 mvs Exp $ */ +/* $OpenBSD: ip_ipsp.c,v 1.273 2022/08/06 15:57:59 bluhm Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr), @@ -644,7 +644,7 @@ tdb_walk(u_int rdomain, int (*walker)(struct tdb *, void *, int), void *arg) * traversing the tdb_hnext list. Create a new tdb_walk list with * exclusive netlock protection. */ - NET_ASSERT_WLOCKED(); + NET_ASSERT_LOCKED_EXCLUSIVE(); SIMPLEQ_INIT(&tdblist); mtx_enter(&tdb_sadb_mtx); diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c index 124ded3c4c6..d070bfbf100 100644 --- a/sys/netinet/ip_mroute.c +++ b/sys/netinet/ip_mroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_mroute.c,v 1.135 2022/05/05 13:57:40 claudio Exp $ */ +/* $OpenBSD: ip_mroute.c,v 1.136 2022/08/06 15:57:59 bluhm Exp $ */ /* $NetBSD: ip_mroute.c,v 1.85 2004/04/26 01:31:57 matt Exp $ */ /* @@ -266,16 +266,16 @@ mrt_ioctl(struct socket *so, u_long cmd, caddr_t data) else switch (cmd) { case SIOCGETVIFCNT: - NET_RLOCK_IN_IOCTL(); + NET_LOCK_SHARED(); error = get_vif_cnt(inp->inp_rtableid, (struct sioc_vif_req *)data); - NET_RUNLOCK_IN_IOCTL(); + NET_UNLOCK_SHARED(); break; case SIOCGETSGCNT: - NET_RLOCK_IN_IOCTL(); + NET_LOCK_SHARED(); error = get_sg_cnt(inp->inp_rtableid, (struct sioc_sg_req *)data); - NET_RUNLOCK_IN_IOCTL(); + NET_UNLOCK_SHARED(); break; default: error = ENOTTY; diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c index 7e8a062d006..d5846ef0451 100644 --- a/sys/netinet/raw_ip.c +++ b/sys/netinet/raw_ip.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip.c,v 1.128 2022/05/15 09:12:20 dlg Exp $ */ +/* $OpenBSD: raw_ip.c,v 1.129 2022/08/06 15:57:59 bluhm Exp $ */ /* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */ /* @@ -152,7 +152,7 @@ rip_input(struct mbuf **mp, int *offp, int proto, int af) } } #endif - NET_ASSERT_WLOCKED(); + NET_ASSERT_LOCKED_EXCLUSIVE(); SIMPLEQ_INIT(&inpcblist); mtx_enter(&rawcbtable.inpt_mtx); TAILQ_FOREACH(inp, &rawcbtable.inpt_queue, inp_queue) { diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c index d0ef04a2b54..480cbcc7818 100644 --- a/sys/netinet/udp_usrreq.c +++ b/sys/netinet/udp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: udp_usrreq.c,v 1.279 2022/06/26 15:50:21 mvs Exp $ */ +/* $OpenBSD: udp_usrreq.c,v 1.280 2022/08/06 15:57:59 bluhm Exp $ */ /* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */ /* @@ -364,7 +364,7 @@ udp_input(struct mbuf **mp, int *offp, int proto, int af) * Locate pcb(s) for datagram. * (Algorithm copied from raw_intr().) */ - NET_ASSERT_WLOCKED(); + NET_ASSERT_LOCKED_EXCLUSIVE(); SIMPLEQ_INIT(&inpcblist); mtx_enter(&udbtable.inpt_mtx); TAILQ_FOREACH(inp, &udbtable.inpt_queue, inp_queue) { diff --git a/sys/netinet6/in6.c b/sys/netinet6/in6.c index 0f7a96af941..20ff9213535 100644 --- a/sys/netinet6/in6.c +++ b/sys/netinet6/in6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6.c,v 1.246 2022/02/25 23:51:04 guenther Exp $ */ +/* $OpenBSD: in6.c,v 1.247 2022/08/06 15:57:59 bluhm Exp $ */ /* $KAME: in6.c,v 1.372 2004/06/14 08:14:21 itojun Exp $ */ /* @@ -418,7 +418,7 @@ in6_ioctl_get(u_long cmd, caddr_t data, struct ifnet *ifp) return (error); } - NET_RLOCK_IN_IOCTL(); + NET_LOCK_SHARED(); if (sa6 != NULL) { error = in6_check_embed_scope(sa6, ifp->if_index); @@ -512,7 +512,7 @@ in6_ioctl_get(u_long cmd, caddr_t data, struct ifnet *ifp) } err: - NET_RUNLOCK_IN_IOCTL(); + NET_UNLOCK_SHARED(); return (error); } diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 115c8167cdf..bbd6f88afdc 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_pcb.c,v 1.117 2022/04/14 14:10:22 claudio Exp $ */ +/* $OpenBSD: in6_pcb.c,v 1.118 2022/08/06 15:57:59 bluhm Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -375,7 +375,7 @@ in6_pcbnotify(struct inpcbtable *table, struct sockaddr_in6 *dst, u_int32_t flowinfo; u_int rdomain; - NET_ASSERT_WLOCKED(); + NET_ASSERT_LOCKED_EXCLUSIVE(); if ((unsigned)cmd >= PRC_NCMDS) return; diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 7f3b8a60934..6a4c8c1d004 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_input.c,v 1.249 2022/07/24 22:38:25 bluhm Exp $ */ +/* $OpenBSD: ip6_input.c,v 1.250 2022/08/06 15:57:59 bluhm Exp $ */ /* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */ /* @@ -169,8 +169,8 @@ ip6_init(void) /* * Enqueue packet for local delivery. Queuing is used as a boundary - * between the network layer (input/forward path) running with shared - * NET_RLOCK_IN_SOFTNET() and the transport layer needing it exclusively. + * between the network layer (input/forward path) running with + * NET_LOCK_SHARED() and the transport layer needing it exclusively. */ int ip6_ours(struct mbuf **mp, int *offp, int nxt, int af) @@ -186,6 +186,7 @@ ip6_ours(struct mbuf **mp, int *offp, int nxt, int af) /* * Dequeue and process locally delivered packets. + * This is called with exclusive NET_LOCK(). */ void ip6intr(void) diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c index 006f6ad964a..d113ecfd338 100644 --- a/sys/netinet6/ip6_mroute.c +++ b/sys/netinet6/ip6_mroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_mroute.c,v 1.131 2022/05/05 13:57:41 claudio Exp $ */ +/* $OpenBSD: ip6_mroute.c,v 1.132 2022/08/06 15:57:59 bluhm Exp $ */ /* $NetBSD: ip6_mroute.c,v 1.59 2003/12/10 09:28:38 itojun Exp $ */ /* $KAME: ip6_mroute.c,v 1.45 2001/03/25 08:38:51 itojun Exp $ */ @@ -247,16 +247,16 @@ mrt6_ioctl(struct socket *so, u_long cmd, caddr_t data) switch (cmd) { case SIOCGETSGCNT_IN6: - NET_RLOCK_IN_IOCTL(); + NET_LOCK_SHARED(); error = get_sg6_cnt((struct sioc_sg_req6 *)data, inp->inp_rtableid); - NET_RUNLOCK_IN_IOCTL(); + NET_UNLOCK_SHARED(); break; case SIOCGETMIFCNT_IN6: - NET_RLOCK_IN_IOCTL(); + NET_LOCK_SHARED(); error = get_mif6_cnt((struct sioc_mif_req6 *)data, inp->inp_rtableid); - NET_RUNLOCK_IN_IOCTL(); + NET_UNLOCK_SHARED(); break; default: error = ENOTTY; diff --git a/sys/netinet6/nd6.c b/sys/netinet6/nd6.c index 2dbfa1ab866..dca4508a678 100644 --- a/sys/netinet6/nd6.c +++ b/sys/netinet6/nd6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nd6.c,v 1.242 2022/07/28 13:10:37 kn Exp $ */ +/* $OpenBSD: nd6.c,v 1.243 2022/08/06 15:57:59 bluhm Exp $ */ /* $KAME: nd6.c,v 1.280 2002/06/08 19:52:07 itojun Exp $ */ /* @@ -1022,9 +1022,9 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) switch (cmd) { case SIOCGIFINFO_IN6: - NET_RLOCK_IN_IOCTL(); + NET_LOCK_SHARED(); ndi->ndi = *ND_IFINFO(ifp); - NET_RUNLOCK_IN_IOCTL(); + NET_UNLOCK_SHARED(); return (0); case SIOCGNBRINFO_IN6: { @@ -1032,7 +1032,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) struct in6_addr nb_addr = nbi->addr; /* make local for safety */ time_t expire; - NET_RLOCK_IN_IOCTL(); + NET_LOCK_SHARED(); /* * XXX: KAME specific hack for scoped addresses * XXXX: for other scopes than link-local? @@ -1049,7 +1049,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) if (rt == NULL || (ln = (struct llinfo_nd6 *)rt->rt_llinfo) == NULL) { rtfree(rt); - NET_RUNLOCK_IN_IOCTL(); + NET_UNLOCK_SHARED(); return (EINVAL); } expire = ln->ln_rt->rt_expire; @@ -1064,7 +1064,7 @@ nd6_ioctl(u_long cmd, caddr_t data, struct ifnet *ifp) nbi->expire = expire; rtfree(rt); - NET_RUNLOCK_IN_IOCTL(); + NET_UNLOCK_SHARED(); return (0); } } diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 9bafa9a151b..04a4b45f92b 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip6.c,v 1.147 2022/03/23 00:16:07 bluhm Exp $ */ +/* $OpenBSD: raw_ip6.c,v 1.148 2022/08/06 15:57:59 bluhm Exp $ */ /* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */ /* @@ -164,7 +164,7 @@ rip6_input(struct mbuf **mp, int *offp, int proto, int af) } } #endif - NET_ASSERT_WLOCKED(); + NET_ASSERT_LOCKED_EXCLUSIVE(); SIMPLEQ_INIT(&inpcblist); mtx_enter(&rawin6pcbtable.inpt_mtx); TAILQ_FOREACH(in6p, &rawin6pcbtable.inpt_queue, inp_queue) { diff --git a/sys/sys/systm.h b/sys/sys/systm.h index 81c81e172ee..828812e3dd3 100644 --- a/sys/sys/systm.h +++ b/sys/sys/systm.h @@ -1,4 +1,4 @@ -/* $OpenBSD: systm.h,v 1.157 2022/07/12 17:12:31 jca Exp $ */ +/* $OpenBSD: systm.h,v 1.158 2022/08/06 15:57:59 bluhm Exp $ */ /* $NetBSD: systm.h,v 1.50 1996/06/09 04:55:09 briggs Exp $ */ /*- @@ -323,23 +323,17 @@ extern struct rwlock netlock; #define NET_UNLOCK() do { rw_exit_write(&netlock); } while (0) /* - * Reader version of NET_LOCK() to be used in "softnet" thread only. - + * Reader version of NET_LOCK(). * The "softnet" thread should be the only thread processing packets * without holding an exclusive lock. This is done to allow read-only * ioctl(2) to not block. - */ -#define NET_RLOCK_IN_SOFTNET() do { rw_enter_read(&netlock); } while (0) -#define NET_RUNLOCK_IN_SOFTNET()do { rw_exit_read(&netlock); } while (0) - -/* - * Reader version of NET_LOCK() to be used in ioctl/sysctl path only. - * - * Can be grabbed instead of the exclusive version when no field + * Shared lock can be grabbed instead of the exclusive version if no field * protected by the NET_LOCK() is modified by the ioctl/sysctl. + * Socket system call can use shared netlock if it has additional locks + * to protect socket and pcb data structures. */ -#define NET_RLOCK_IN_IOCTL() do { rw_enter_read(&netlock); } while (0) -#define NET_RUNLOCK_IN_IOCTL() do { rw_exit_read(&netlock); } while (0) +#define NET_LOCK_SHARED() do { rw_enter_read(&netlock); } while (0) +#define NET_UNLOCK_SHARED() do { rw_exit_read(&netlock); } while (0) #ifdef DIAGNOSTIC @@ -357,7 +351,7 @@ do { \ splassert_fail(RW_READ, _s, __func__); \ } while (0) -#define NET_ASSERT_WLOCKED() \ +#define NET_ASSERT_LOCKED_EXCLUSIVE() \ do { \ int _s = rw_status(&netlock); \ if ((splassert_ctl > 0) && (_s != RW_WRITE)) \ @@ -365,9 +359,9 @@ do { \ } while (0) #else /* DIAGNOSTIC */ -#define NET_ASSERT_UNLOCKED() do {} while (0) -#define NET_ASSERT_LOCKED() do {} while (0) -#define NET_ASSERT_WLOCKED() do {} while (0) +#define NET_ASSERT_UNLOCKED() do {} while (0) +#define NET_ASSERT_LOCKED() do {} while (0) +#define NET_ASSERT_LOCKED_EXCLUSIVE() do {} while (0) #endif /* !DIAGNOSTIC */ __returns_twice int setjmp(label_t *); -- 2.20.1