From 84245c071807d6ad799492bef6a2e838a13a44e3 Mon Sep 17 00:00:00 2001 From: claudio Date: Mon, 6 Jun 2022 14:45:41 +0000 Subject: [PATCH] Simplify solock() and sounlock(). There is no reason to return a value for the lock operation and to pass a value to the unlock operation. sofree() still needs an extra flag to know if sounlock() should be called or not. But sofree() is called less often and mostly without keeping the lock. OK mpi@ mvs@ --- sys/kern/sys_socket.c | 18 +++--- sys/kern/uipc_socket.c | 109 +++++++++++++++++---------------- sys/kern/uipc_socket2.c | 13 +--- sys/kern/uipc_syscalls.c | 50 +++++++-------- sys/kern/uipc_usrreq.c | 22 +++---- sys/miscfs/fifofs/fifo_vnops.c | 39 ++++++------ sys/net/if_pflow.c | 7 +-- sys/net/if_vxlan.c | 9 ++- sys/net/if_wg.c | 8 +-- sys/net/pfkeyv2.c | 52 ++++++++-------- sys/net/rtsock.c | 16 +++-- sys/netinet/in_pcb.c | 4 +- sys/nfs/krpc_subr.c | 24 ++++---- sys/nfs/nfs_socket.c | 10 +-- sys/nfs/nfs_syscalls.c | 10 +-- sys/sys/socketvar.h | 12 +--- 16 files changed, 192 insertions(+), 211 deletions(-) diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c index cc0ccb55ca1..c1adf1a929f 100644 --- a/sys/kern/sys_socket.c +++ b/sys/kern/sys_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sys_socket.c,v 1.49 2022/02/25 23:51:03 guenther Exp $ */ +/* $OpenBSD: sys_socket.c,v 1.50 2022/06/06 14:45:41 claudio Exp $ */ /* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */ /* @@ -86,7 +86,7 @@ int soo_ioctl(struct file *fp, u_long cmd, caddr_t data, struct proc *p) { struct socket *so = (struct socket *)fp->f_data; - int s, error = 0; + int error = 0; switch (cmd) { @@ -94,7 +94,7 @@ soo_ioctl(struct file *fp, u_long cmd, caddr_t data, struct proc *p) break; case FIOASYNC: - s = solock(so); + solock(so); if (*(int *)data) { so->so_rcv.sb_flags |= SB_ASYNC; so->so_snd.sb_flags |= SB_ASYNC; @@ -102,7 +102,7 @@ soo_ioctl(struct file *fp, u_long cmd, caddr_t data, struct proc *p) so->so_rcv.sb_flags &= ~SB_ASYNC; so->so_snd.sb_flags &= ~SB_ASYNC; } - sounlock(so, s); + sounlock(so); break; case FIONREAD: @@ -154,9 +154,8 @@ soo_poll(struct file *fp, int events, struct proc *p) { struct socket *so = fp->f_data; int revents = 0; - int s; - s = solock(so); + solock(so); if (events & (POLLIN | POLLRDNORM)) { if (soreadable(so)) revents |= events & (POLLIN | POLLRDNORM); @@ -182,7 +181,7 @@ soo_poll(struct file *fp, int events, struct proc *p) so->so_snd.sb_flags |= SB_SEL; } } - sounlock(so, s); + sounlock(so); return (revents); } @@ -190,11 +189,10 @@ int soo_stat(struct file *fp, struct stat *ub, struct proc *p) { struct socket *so = fp->f_data; - int s; memset(ub, 0, sizeof (*ub)); ub->st_mode = S_IFSOCK; - s = solock(so); + solock(so); if ((so->so_state & SS_CANTRCVMORE) == 0 || so->so_rcv.sb_cc != 0) ub->st_mode |= S_IRUSR | S_IRGRP | S_IROTH; if ((so->so_state & SS_CANTSENDMORE) == 0) @@ -203,7 +201,7 @@ soo_stat(struct file *fp, struct stat *ub, struct proc *p) ub->st_gid = so->so_egid; (void) ((*so->so_proto->pr_usrreq)(so, PRU_SENSE, (struct mbuf *)ub, NULL, NULL, p)); - sounlock(so, s); + sounlock(so); return (0); } diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c index caff3c17100..fc2421e9ca1 100644 --- a/sys/kern/uipc_socket.c +++ b/sys/kern/uipc_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket.c,v 1.277 2022/05/09 14:49:55 visa Exp $ */ +/* $OpenBSD: uipc_socket.c,v 1.278 2022/06/06 14:45:41 claudio Exp $ */ /* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */ /* @@ -163,7 +163,7 @@ socreate(int dom, struct socket **aso, int type, int proto) struct proc *p = curproc; /* XXX */ const struct protosw *prp; struct socket *so; - int error, s; + int error; if (proto) prp = pffindproto(dom, proto, type); @@ -191,15 +191,15 @@ socreate(int dom, struct socket **aso, int type, int proto) so->so_snd.sb_timeo_nsecs = INFSLP; so->so_rcv.sb_timeo_nsecs = INFSLP; - s = solock(so); + solock(so); error = (*prp->pr_attach)(so, proto); if (error) { so->so_state |= SS_NOFDREF; /* sofree() calls sounlock(). */ - sofree(so, s); + sofree(so, 0); return (error); } - sounlock(so, s); + sounlock(so); *aso = so; return (0); } @@ -245,12 +245,13 @@ solisten(struct socket *so, int backlog) #define SOSP_FREEING_READ 1 #define SOSP_FREEING_WRITE 2 void -sofree(struct socket *so, int s) +sofree(struct socket *so, int keep_lock) { soassertlocked(so); if (so->so_pcb || (so->so_state & SS_NOFDREF) == 0) { - sounlock(so, s); + if (!keep_lock) + sounlock(so); return; } if (so->so_head) { @@ -260,7 +261,8 @@ sofree(struct socket *so, int s) * indicated that the listening socket was ready. */ if (!soqremque(so, 0)) { - sounlock(so, s); + if (!keep_lock) + sounlock(so); return; } } @@ -287,7 +289,8 @@ sofree(struct socket *so, int s) #endif /* SOCKET_SPLICE */ sbrelease(so, &so->so_snd); sorflush(so); - sounlock(so, s); + if (!keep_lock) + sounlock(so); #ifdef SOCKET_SPLICE if (so->so_sp) { /* Reuse splice idle, sounsplice() has been called before. */ @@ -318,9 +321,9 @@ int soclose(struct socket *so, int flags) { struct socket *so2; - int s, error = 0; + int error = 0; - s = solock(so); + solock(so); /* Revoke async IO early. There is a final revocation in sofree(). */ sigio_free(&so->so_sigio); if (so->so_state & SS_ISCONNECTED) { @@ -367,7 +370,7 @@ discard: panic("soclose NOFDREF: so %p, so_type %d", so, so->so_type); so->so_state |= SS_NOFDREF; /* sofree() calls sounlock(). */ - sofree(so, s); + sofree(so, 0); return (error); } @@ -427,12 +430,12 @@ soconnect(struct socket *so, struct mbuf *nam) int soconnect2(struct socket *so1, struct socket *so2) { - int s, error; + int error; - s = solock(so1); + solock(so1); error = (*so1->so_proto->pr_usrreq)(so1, PRU_CONNECT2, NULL, (struct mbuf *)so2, NULL, curproc); - sounlock(so1, s); + sounlock(so1); return (error); } @@ -478,7 +481,7 @@ sosend(struct socket *so, struct mbuf *addr, struct uio *uio, struct mbuf *top, { long space, clen = 0; size_t resid; - int error, s; + int error; int atomic = sosendallatonce(so) || top; if (uio) @@ -512,7 +515,7 @@ sosend(struct socket *so, struct mbuf *addr, struct uio *uio, struct mbuf *top, #define snderr(errno) { error = errno; goto release; } - s = solock(so); + solock(so); restart: if ((error = sblock(so, &so->so_snd, SBLOCKWAIT(flags))) != 0) goto out; @@ -565,9 +568,9 @@ restart: if (flags & MSG_EOR) top->m_flags |= M_EOR; } else { - sounlock(so, s); + sounlock(so); error = m_getuio(&top, atomic, space, uio); - s = solock(so); + solock(so); if (error) goto release; space -= top->m_pkthdr.len; @@ -594,7 +597,7 @@ release: so->so_state &= ~SS_ISSENDING; sbunlock(so, &so->so_snd); out: - sounlock(so, s); + sounlock(so); m_freem(top); m_freem(control); return (error); @@ -727,7 +730,7 @@ soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio, struct mbuf *m, **mp; struct mbuf *cm; u_long len, offset, moff; - int flags, error, s, type, uio_error = 0; + int flags, error, type, uio_error = 0; const struct protosw *pr = so->so_proto; struct mbuf *nextrecord; size_t resid, orig_resid = uio->uio_resid; @@ -743,10 +746,10 @@ soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio, flags = 0; if (flags & MSG_OOB) { m = m_get(M_WAIT, MT_DATA); - s = solock(so); + solock(so); error = (*pr->pr_usrreq)(so, PRU_RCVOOB, m, (struct mbuf *)(long)(flags & MSG_PEEK), NULL, curproc); - sounlock(so, s); + sounlock(so); if (error) goto bad; do { @@ -761,10 +764,10 @@ bad: if (mp) *mp = NULL; - s = solock(so); + solock(so); restart: if ((error = sblock(so, &so->so_rcv, SBLOCKWAIT(flags))) != 0) { - sounlock(so, s); + sounlock(so); return (error); } @@ -832,7 +835,7 @@ restart: sbunlock(so, &so->so_rcv); error = sbwait(so, &so->so_rcv); if (error) { - sounlock(so, s); + sounlock(so); return (error); } goto restart; @@ -901,11 +904,11 @@ dontblock: sbsync(&so->so_rcv, nextrecord); if (controlp) { if (pr->pr_domain->dom_externalize) { - sounlock(so, s); + sounlock(so); error = (*pr->pr_domain->dom_externalize) (cm, controllen, flags); - s = solock(so); + solock(so); } *controlp = cm; } else { @@ -979,9 +982,9 @@ dontblock: SBLASTRECORDCHK(&so->so_rcv, "soreceive uiomove"); SBLASTMBUFCHK(&so->so_rcv, "soreceive uiomove"); resid = uio->uio_resid; - sounlock(so, s); + sounlock(so); uio_error = uiomove(mtod(m, caddr_t) + moff, len, uio); - s = solock(so); + solock(so); if (uio_error) uio->uio_resid = resid - len; } else @@ -1065,7 +1068,7 @@ dontblock: error = sbwait(so, &so->so_rcv); if (error) { sbunlock(so, &so->so_rcv); - sounlock(so, s); + sounlock(so); return (0); } if ((m = so->so_rcv.sb_mb) != NULL) @@ -1111,7 +1114,7 @@ dontblock: *flagsp |= flags; release: sbunlock(so, &so->so_rcv); - sounlock(so, s); + sounlock(so); return (error); } @@ -1119,9 +1122,9 @@ int soshutdown(struct socket *so, int how) { const struct protosw *pr = so->so_proto; - int s, error = 0; + int error = 0; - s = solock(so); + solock(so); switch (how) { case SHUT_RD: sorflush(so); @@ -1137,7 +1140,7 @@ soshutdown(struct socket *so, int how) error = EINVAL; break; } - sounlock(so, s); + sounlock(so); return (error); } @@ -1300,7 +1303,7 @@ sosplice(struct socket *so, int fd, off_t max, struct timeval *tv) * socket when sosplice() returns. The dance could be avoided by * grabbing the socket lock inside this function. */ - sounlock(so, SL_LOCKED); + sounlock(so); FRELE(fp, curproc); solock(so); return (error); @@ -1327,23 +1330,21 @@ void soidle(void *arg) { struct socket *so = arg; - int s; - s = solock(so); + solock(so); if (so->so_rcv.sb_flags & SB_SPLICE) { so->so_error = ETIMEDOUT; sounsplice(so, so->so_sp->ssp_socket, 0); } - sounlock(so, s); + sounlock(so); } void sotask(void *arg) { struct socket *so = arg; - int s; - s = solock(so); + solock(so); if (so->so_rcv.sb_flags & SB_SPLICE) { /* * We may not sleep here as sofree() and unsplice() may be @@ -1352,7 +1353,7 @@ sotask(void *arg) */ somove(so, M_DONTWAIT); } - sounlock(so, s); + sounlock(so); /* Avoid user land starvation. */ yield(); @@ -2047,9 +2048,8 @@ soo_kqfilter(struct file *fp, struct knote *kn) { struct socket *so = kn->kn_fp->f_data; struct sockbuf *sb; - int s; - s = solock(so); + solock(so); switch (kn->kn_filter) { case EVFILT_READ: if (so->so_options & SO_ACCEPTCONN) @@ -2067,12 +2067,12 @@ soo_kqfilter(struct file *fp, struct knote *kn) sb = &so->so_rcv; break; default: - sounlock(so, s); + sounlock(so); return (EINVAL); } klist_insert_locked(&sb->sb_sel.si_note, kn); - sounlock(so, s); + sounlock(so); return (0); } @@ -2215,11 +2215,11 @@ int filt_somodify(struct kevent *kev, struct knote *kn) { struct socket *so = kn->kn_fp->f_data; - int rv, s; + int rv; - s = solock(so); + solock(so); rv = knote_modify(kev, kn); - sounlock(so, s); + sounlock(so); return (rv); } @@ -2228,11 +2228,11 @@ int filt_soprocess(struct knote *kn, struct kevent *kev) { struct socket *so = kn->kn_fp->f_data; - int rv, s; + int rv; - s = solock(so); + solock(so); rv = knote_process(kn, kev); - sounlock(so, s); + sounlock(so); return (rv); } @@ -2250,7 +2250,8 @@ klist_solock(void *arg) { struct socket *so = arg; - return (solock(so)); + solock(so); + return (1); } void @@ -2258,7 +2259,7 @@ klist_sounlock(void *arg, int ls) { struct socket *so = arg; - sounlock(so, ls); + sounlock(so); } const struct klistops socket_klistops = { diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index 135bad945e9..106e24521b6 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_socket2.c,v 1.122 2022/05/09 14:49:55 visa Exp $ */ +/* $OpenBSD: uipc_socket2.c,v 1.123 2022/06/06 14:45:41 claudio Exp $ */ /* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */ /* @@ -276,7 +276,7 @@ socantrcvmore(struct socket *so) sorwakeup(so); } -int +void solock(struct socket *so) { switch (so->so_proto->pr_domain->dom_family) { @@ -291,18 +291,11 @@ solock(struct socket *so) rw_enter_write(&so->so_lock); break; } - - return (SL_LOCKED); } void -sounlock(struct socket *so, int s) +sounlock(struct socket *so) { - KASSERT(s == SL_LOCKED || s == SL_NOUNLOCK); - - if (s != SL_LOCKED) - return; - switch (so->so_proto->pr_domain->dom_family) { case PF_INET: case PF_INET6: diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c index 07dfe468d1b..a2590014ae9 100644 --- a/sys/kern/uipc_syscalls.c +++ b/sys/kern/uipc_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_syscalls.c,v 1.194 2021/10/24 00:02:25 jsg Exp $ */ +/* $OpenBSD: uipc_syscalls.c,v 1.195 2022/06/06 14:45:41 claudio Exp $ */ /* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */ /* @@ -159,7 +159,7 @@ sys_bind(struct proc *p, void *v, register_t *retval) struct file *fp; struct mbuf *nam; struct socket *so; - int s, error; + int error; if ((error = getsock(p, SCARG(uap, s), &fp)) != 0) return (error); @@ -176,9 +176,9 @@ sys_bind(struct proc *p, void *v, register_t *retval) if (KTRPOINT(p, KTR_STRUCT)) ktrsockaddr(p, mtod(nam, caddr_t), SCARG(uap, namelen)); #endif - s = solock(so); + solock(so); error = sobind(so, nam, p); - sounlock(so, s); + sounlock(so); m_freem(nam); out: FRELE(fp, p); @@ -194,14 +194,14 @@ sys_listen(struct proc *p, void *v, register_t *retval) } */ *uap = v; struct file *fp; struct socket *so; - int s, error; + int error; if ((error = getsock(p, SCARG(uap, s), &fp)) != 0) return (error); so = fp->f_data; - s = solock(so); + solock(so); error = solisten(so, SCARG(uap, backlog)); - sounlock(so, s); + sounlock(so); FRELE(fp, p); return (error); } @@ -244,7 +244,7 @@ doaccept(struct proc *p, int sock, struct sockaddr *name, socklen_t *anamelen, struct file *fp, *headfp; struct mbuf *nam; socklen_t namelen; - int error, s, tmpfd; + int error, tmpfd; struct socket *head, *so; int cloexec, nflag; @@ -268,7 +268,7 @@ doaccept(struct proc *p, int sock, struct sockaddr *name, socklen_t *anamelen, nam = m_get(M_WAIT, MT_SONAME); head = headfp->f_data; - s = solock(head); + solock(head); if (isdnssocket(head) || (head->so_options & SO_ACCEPTCONN) == 0) { error = EINVAL; goto out; @@ -316,7 +316,7 @@ doaccept(struct proc *p, int sock, struct sockaddr *name, socklen_t *anamelen, fp->f_data = so; error = soaccept(so, nam); out: - sounlock(head, s); + sounlock(head); if (!error && name != NULL) error = copyaddrout(p, nam, name, namelen, anamelen); if (!error) { @@ -348,7 +348,7 @@ sys_connect(struct proc *p, void *v, register_t *retval) struct file *fp; struct socket *so; struct mbuf *nam; - int error, s, interrupted = 0; + int error, interrupted = 0; if ((error = getsock(p, SCARG(uap, s), &fp)) != 0) return (error); @@ -365,7 +365,7 @@ sys_connect(struct proc *p, void *v, register_t *retval) if (KTRPOINT(p, KTR_STRUCT)) ktrsockaddr(p, mtod(nam, caddr_t), SCARG(uap, namelen)); #endif - s = solock(so); + solock(so); if (isdnssocket(so)) { error = dns_portcheck(p, so, mtod(nam, void *), nam->m_len); if (error) @@ -399,7 +399,7 @@ bad: if (!interrupted) so->so_state &= ~SS_ISCONNECTING; unlock: - sounlock(so, s); + sounlock(so); m_freem(nam); out: FRELE(fp, p); @@ -931,7 +931,7 @@ sys_setsockopt(struct proc *p, void *v, register_t *retval) struct file *fp; struct mbuf *m = NULL; struct socket *so; - int s, error; + int error; if ((error = getsock(p, SCARG(uap, s), &fp)) != 0) @@ -964,9 +964,9 @@ sys_setsockopt(struct proc *p, void *v, register_t *retval) m->m_len = SCARG(uap, valsize); } so = fp->f_data; - s = solock(so); + solock(so); error = sosetopt(so, SCARG(uap, level), SCARG(uap, name), m); - sounlock(so, s); + sounlock(so); bad: m_freem(m); FRELE(fp, p); @@ -987,7 +987,7 @@ sys_getsockopt(struct proc *p, void *v, register_t *retval) struct mbuf *m = NULL; socklen_t valsize; struct socket *so; - int s, error; + int error; if ((error = getsock(p, SCARG(uap, s), &fp)) != 0) return (error); @@ -1003,9 +1003,9 @@ sys_getsockopt(struct proc *p, void *v, register_t *retval) valsize = 0; m = m_get(M_WAIT, MT_SOOPTS); so = fp->f_data; - s = solock(so); + solock(so); error = sogetopt(so, SCARG(uap, level), SCARG(uap, name), m); - sounlock(so, s); + sounlock(so); if (error == 0 && SCARG(uap, val) && valsize && m != NULL) { if (valsize > m->m_len) valsize = m->m_len; @@ -1035,7 +1035,7 @@ sys_getsockname(struct proc *p, void *v, register_t *retval) struct socket *so; struct mbuf *m = NULL; socklen_t len; - int error, s; + int error; if ((error = getsock(p, SCARG(uap, fdes), &fp)) != 0) return (error); @@ -1047,9 +1047,9 @@ sys_getsockname(struct proc *p, void *v, register_t *retval) if (error) goto bad; m = m_getclr(M_WAIT, MT_SONAME); - s = solock(so); + solock(so); error = (*so->so_proto->pr_usrreq)(so, PRU_SOCKADDR, NULL, m, NULL, p); - sounlock(so, s); + sounlock(so); if (error) goto bad; error = copyaddrout(p, m, SCARG(uap, asa), len, SCARG(uap, alen)); @@ -1074,7 +1074,7 @@ sys_getpeername(struct proc *p, void *v, register_t *retval) struct socket *so; struct mbuf *m = NULL; socklen_t len; - int error, s; + int error; if ((error = getsock(p, SCARG(uap, fdes), &fp)) != 0) return (error); @@ -1090,9 +1090,9 @@ sys_getpeername(struct proc *p, void *v, register_t *retval) if (error) goto bad; m = m_getclr(M_WAIT, MT_SONAME); - s = solock(so); + solock(so); error = (*so->so_proto->pr_usrreq)(so, PRU_PEERADDR, NULL, m, NULL, p); - sounlock(so, s); + sounlock(so); if (error) goto bad; error = copyaddrout(p, m, SCARG(uap, asa), len, SCARG(uap, alen)); diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index c3c3d01bdac..372a473a75c 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_usrreq.c,v 1.164 2022/04/11 18:18:17 mvs Exp $ */ +/* $OpenBSD: uipc_usrreq.c,v 1.165 2022/06/06 14:45:41 claudio Exp $ */ /* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */ /* @@ -237,7 +237,7 @@ uipc_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, case PRU_SEND: if (control) { - sounlock(so, SL_LOCKED); + sounlock(so); error = unp_internalize(control, p); solock(so); if (error) @@ -328,7 +328,7 @@ uipc_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, * uipc_usrreq() releasing it here would lead to a * double unlock. */ - sofree(so, SL_NOUNLOCK); + sofree(so, 1); break; case PRU_SENSE: { @@ -451,7 +451,7 @@ uipc_attach(struct socket *so, int proto) * listening socket protected by vnode(9) lock. The peer socket * has 'UNP_CONNECTING' flag set. */ - sounlock(so, SL_LOCKED); + sounlock(so); rw_enter_write(&unp_gc_lock); LIST_INSERT_HEAD(&unp_head, unp, unp_link); rw_exit_write(&unp_gc_lock); @@ -521,7 +521,7 @@ unp_detach(struct unpcb *unp) * Enforce `unp_gc_lock' -> `solock()' lock order. * Enforce `i_lock' -> `unp_lock' lock order. */ - sounlock(so, SL_LOCKED); + sounlock(so); rw_enter_write(&unp_gc_lock); LIST_REMOVE(unp, unp_link); @@ -576,7 +576,7 @@ unp_bind(struct unpcb *unp, struct mbuf *nam, struct proc *p) * because the file descriptor reference is still held. */ - sounlock(unp->unp_socket, SL_LOCKED); + sounlock(unp->unp_socket); nam2 = m_getclr(M_WAITOK, MT_SONAME); nam2->m_len = sizeof(struct sockaddr_un); @@ -668,7 +668,7 @@ unp_connect(struct socket *so, struct mbuf *nam, struct proc *p) * because the file descriptor reference is still held. */ - sounlock(so, SL_LOCKED); + sounlock(so); KERNEL_LOCK(); error = namei(&nd); @@ -714,7 +714,7 @@ unp_connect(struct socket *so, struct mbuf *nam, struct proc *p) } error = unp_connect2(so, so2); put_locked: - sounlock(so, SL_LOCKED); + sounlock(so); put: vput(vp); unlock: @@ -1217,7 +1217,7 @@ unp_gc(void *arg __unused) so = unp->unp_socket; solock(so); unp_scan(so->so_rcv.sb_mb, unp_remove_gcrefs); - sounlock(so, SL_LOCKED); + sounlock(so); } /* @@ -1241,7 +1241,7 @@ unp_gc(void *arg __unused) so = unp->unp_socket; solock(so); unp_scan(so->so_rcv.sb_mb, unp_restore_gcrefs); - sounlock(so, SL_LOCKED); + sounlock(so); KASSERT(nunref > 0); nunref--; @@ -1264,7 +1264,7 @@ unp_gc(void *arg __unused) so = unp->unp_socket; solock(so); unp_scan(so->so_rcv.sb_mb, unp_discard); - sounlock(so, SL_LOCKED); + sounlock(so); } } } diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c index ac1fd436d4d..79cb08d3b38 100644 --- a/sys/miscfs/fifofs/fifo_vnops.c +++ b/sys/miscfs/fifofs/fifo_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fifo_vnops.c,v 1.93 2022/02/16 13:19:33 visa Exp $ */ +/* $OpenBSD: fifo_vnops.c,v 1.94 2022/06/06 14:45:41 claudio Exp $ */ /* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */ /* @@ -149,7 +149,7 @@ fifo_open(void *v) struct vnode *vp = ap->a_vp; struct fifoinfo *fip; struct socket *rso, *wso; - int s, error; + int error; if ((fip = vp->v_fifoinfo) == NULL) { fip = malloc(sizeof(*fip), M_VNODE, M_WAITOK); @@ -175,13 +175,13 @@ fifo_open(void *v) return (error); } fip->fi_readers = fip->fi_writers = 0; - s = solock(wso); + solock(wso); wso->so_state |= SS_CANTSENDMORE; wso->so_snd.sb_lowat = PIPE_BUF; } else { rso = fip->fi_readsock; wso = fip->fi_writesock; - s = solock(wso); + solock(wso); } if (ap->a_mode & FREAD) { fip->fi_readers++; @@ -195,7 +195,7 @@ fifo_open(void *v) fip->fi_writers++; if ((ap->a_mode & O_NONBLOCK) && fip->fi_readers == 0) { error = ENXIO; - sounlock(wso, s); + sounlock(wso); goto bad; } if (fip->fi_writers == 1) { @@ -204,7 +204,7 @@ fifo_open(void *v) wakeup(&fip->fi_readers); } } - sounlock(wso, s); + sounlock(wso); if ((ap->a_mode & O_NONBLOCK) == 0) { if ((ap->a_mode & FREAD) && fip->fi_writers == 0) { VOP_UNLOCK(vp); @@ -320,12 +320,11 @@ fifo_poll(void *v) struct socket *wso = ap->a_vp->v_fifoinfo->fi_writesock; int events = 0; int revents = 0; - int s; /* * FIFOs don't support out-of-band or high priority data. */ - s = solock(rso); + solock(rso); if (ap->a_fflag & FREAD) events |= ap->a_events & (POLLIN | POLLRDNORM); if (ap->a_fflag & FWRITE) @@ -355,7 +354,7 @@ fifo_poll(void *v) wso->so_snd.sb_flags |= SB_SEL; } } - sounlock(rso, s); + sounlock(rso); return (revents); } @@ -379,7 +378,7 @@ fifo_close(void *v) struct vop_close_args *ap = v; struct vnode *vp = ap->a_vp; struct fifoinfo *fip = vp->v_fifoinfo; - int s, error1 = 0, error2 = 0; + int error1 = 0, error2 = 0; if (fip == NULL) return (0); @@ -388,20 +387,20 @@ fifo_close(void *v) if (--fip->fi_readers == 0) { struct socket *wso = fip->fi_writesock; - s = solock(wso); + solock(wso); socantsendmore(wso); - sounlock(wso, s); + sounlock(wso); } } if (ap->a_fflag & FWRITE) { if (--fip->fi_writers == 0) { struct socket *rso = fip->fi_readsock; - s = solock(rso); + solock(rso); /* SS_ISDISCONNECTED will result in POLLHUP */ rso->so_state |= SS_ISDISCONNECTED; socantrcvmore(rso); - sounlock(rso, s); + sounlock(rso); } } if (fip->fi_readers == 0 && fip->fi_writers == 0) { @@ -642,11 +641,11 @@ int filt_fifomodify(struct kevent *kev, struct knote *kn) { struct socket *so = kn->kn_hook; - int rv, s; + int rv; - s = solock(so); + solock(so); rv = knote_modify(kev, kn); - sounlock(so, s); + sounlock(so); return (rv); } @@ -655,11 +654,11 @@ int filt_fifoprocess(struct knote *kn, struct kevent *kev) { struct socket *so = kn->kn_hook; - int rv, s; + int rv; - s = solock(so); + solock(so); rv = knote_process(kn, kev); - sounlock(so, s); + sounlock(so); return (rv); } diff --git a/sys/net/if_pflow.c b/sys/net/if_pflow.c index 02672d0b781..e627e69bc46 100644 --- a/sys/net/if_pflow.c +++ b/sys/net/if_pflow.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_pflow.c,v 1.93 2020/08/21 22:59:27 kn Exp $ */ +/* $OpenBSD: if_pflow.c,v 1.94 2022/06/06 14:45:41 claudio Exp $ */ /* * Copyright (c) 2011 Florian Obser @@ -431,7 +431,6 @@ pflow_set(struct pflow_softc *sc, struct pflowreq *pflowr) return (error); if (pflowvalidsockaddr(sc->sc_flowsrc, 1)) { struct mbuf *m; - int s; MGET(m, M_WAIT, MT_SONAME); m->m_len = sc->sc_flowsrc->sa_len; @@ -439,9 +438,9 @@ pflow_set(struct pflow_softc *sc, struct pflowreq *pflowr) memcpy(sa, sc->sc_flowsrc, sc->sc_flowsrc->sa_len); - s = solock(so); + solock(so); error = sobind(so, m, p); - sounlock(so, s); + sounlock(so); m_freem(m); if (error) { soclose(so, MSG_DONTWAIT); diff --git a/sys/net/if_vxlan.c b/sys/net/if_vxlan.c index f057fa21c8f..51503c12994 100644 --- a/sys/net/if_vxlan.c +++ b/sys/net/if_vxlan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vxlan.c,v 1.90 2022/02/26 04:46:34 dlg Exp $ */ +/* $OpenBSD: if_vxlan.c,v 1.91 2022/06/06 14:45:41 claudio Exp $ */ /* * Copyright (c) 2021 David Gwynne @@ -902,7 +902,6 @@ vxlan_tep_add_addr(struct vxlan_softc *sc, const union vxlan_addr *addr, struct sockaddr_in6 *sin6; #endif int error; - int s; vt = vxlan_tep_get(sc, addr); if (vt != NULL) { @@ -935,7 +934,7 @@ vxlan_tep_add_addr(struct vxlan_softc *sc, const union vxlan_addr *addr, if (error != 0) goto free; - s = solock(so); + solock(so); sotoinpcb(so)->inp_upcall = vxlan_input; sotoinpcb(so)->inp_upcall_arg = vt; @@ -979,7 +978,7 @@ vxlan_tep_add_addr(struct vxlan_softc *sc, const union vxlan_addr *addr, if (error != 0) goto close; - sounlock(so, s); + sounlock(so); rw_assert_wrlock(&vxlan_lock); TAILQ_INSERT_TAIL(&vxlan_teps, vt, vt_entry); @@ -989,7 +988,7 @@ vxlan_tep_add_addr(struct vxlan_softc *sc, const union vxlan_addr *addr, return (0); close: - sounlock(so, s); + sounlock(so); soclose(so, MSG_DONTWAIT); free: free(vt, M_DEVBUF, sizeof(*vt)); diff --git a/sys/net/if_wg.c b/sys/net/if_wg.c index 0fa78a668a8..21ae19f616c 100644 --- a/sys/net/if_wg.c +++ b/sys/net/if_wg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wg.c,v 1.24 2022/03/17 18:51:56 tb Exp $ */ +/* $OpenBSD: if_wg.c,v 1.25 2022/06/06 14:45:41 claudio Exp $ */ /* * Copyright (C) 2015-2020 Jason A. Donenfeld . All Rights Reserved. @@ -680,7 +680,7 @@ wg_socket_open(struct socket **so, int af, in_port_t *port, struct sockaddr_in6 *sin6; #endif struct sockaddr_in *sin; - int ret, s; + int ret; m_inithdr(&mhostnam); m_inithdr(&mrtable); @@ -714,7 +714,7 @@ wg_socket_open(struct socket **so, int af, in_port_t *port, if ((ret = socreate(af, so, SOCK_DGRAM, 0)) != 0) return ret; - s = solock(*so); + solock(*so); sotoinpcb(*so)->inp_upcall = wg_input; sotoinpcb(*so)->inp_upcall_arg = upcall_arg; @@ -724,7 +724,7 @@ wg_socket_open(struct socket **so, int af, in_port_t *port, *rtable = sotoinpcb(*so)->inp_rtableid; } } - sounlock(*so, s); + sounlock(*so); if (ret != 0) wg_socket_close(so); diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c index 9121fad2492..c918b2f8fbc 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2.c,v 1.233 2022/03/13 21:38:32 bluhm Exp $ */ +/* $OpenBSD: pfkeyv2.c,v 1.234 2022/06/06 14:45:41 claudio Exp $ */ /* * @(#)COPYRIGHT 1.1 (NRL) 17 January 1995 @@ -147,7 +147,7 @@ struct pkpcb { }; #define sotokeycb(so) ((struct pkpcb *)(so)->so_pcb) #define keylock(kp) solock((kp)->kcb_socket) -#define keyunlock(kp, s) sounlock((kp)->kcb_socket, s) +#define keyunlock(kp) sounlock((kp)->kcb_socket) struct dump_state { @@ -316,7 +316,7 @@ pfkeyv2_detach(struct socket *so) kcb_list); rw_exit(&pkptable.pkp_lk); - sounlock(so, SL_LOCKED); + sounlock(so); /* wait for all references to drop */ refcnt_finalize(&kp->kcb_refcnt, "pfkeyrefs"); solock(so); @@ -438,7 +438,7 @@ pfkeyv2_output(struct mbuf *mbuf, struct socket *so, * descriptor reference is still held. */ - sounlock(so, SL_LOCKED); + sounlock(so); error = pfkeyv2_send(so, message, mbuf->m_pkthdr.len); solock(so); @@ -479,7 +479,7 @@ int pfkeyv2_sendmessage(void **headers, int mode, struct socket *so, u_int8_t satype, int count, u_int rdomain) { - int i, j, rval, s; + int i, j, rval; void *p, *buffer = NULL; struct mbuf *packet; struct pkpcb *kp; @@ -524,9 +524,9 @@ pfkeyv2_sendmessage(void **headers, int mode, struct socket *so, * Send message to the specified socket, plus all * promiscuous listeners. */ - s = solock(so); + solock(so); pfkey_sendup(sotokeycb(so), packet, 0); - sounlock(so, s); + sounlock(so); /* * Promiscuous messages contain the original message @@ -553,10 +553,10 @@ pfkeyv2_sendmessage(void **headers, int mode, struct socket *so, if (kp->kcb_socket == so || kp->kcb_rdomain != rdomain) continue; - s = keylock(kp); + keylock(kp); if (kp->kcb_flags & PFKEYV2_SOCKETFLAGS_PROMISC) pfkey_sendup(kp, packet, 1); - keyunlock(kp, s); + keyunlock(kp); } SRPL_LEAVE(&sr); m_freem(packet); @@ -571,7 +571,7 @@ pfkeyv2_sendmessage(void **headers, int mode, struct socket *so, if (kp->kcb_rdomain != rdomain) continue; - s = keylock(kp); + keylock(kp); if (kp->kcb_flags & PFKEYV2_SOCKETFLAGS_REGISTERED) { if (!satype) { /* Just send to everyone registered */ @@ -582,7 +582,7 @@ pfkeyv2_sendmessage(void **headers, int mode, struct socket *so, pfkey_sendup(kp, packet, 1); } } - keyunlock(kp, s); + keyunlock(kp); } SRPL_LEAVE(&sr); /* Free last/original copy of the packet */ @@ -607,11 +607,11 @@ pfkeyv2_sendmessage(void **headers, int mode, struct socket *so, if (kp->kcb_rdomain != rdomain) continue; - s = keylock(kp); + keylock(kp); if ((kp->kcb_flags & PFKEYV2_SOCKETFLAGS_PROMISC) && !(kp->kcb_flags & PFKEYV2_SOCKETFLAGS_REGISTERED)) pfkey_sendup(kp, packet, 1); - keyunlock(kp, s); + keyunlock(kp); } SRPL_LEAVE(&sr); m_freem(packet); @@ -623,9 +623,9 @@ pfkeyv2_sendmessage(void **headers, int mode, struct socket *so, if (kp->kcb_rdomain != rdomain) continue; - s = keylock(kp); + keylock(kp); pfkey_sendup(kp, packet, 1); - keyunlock(kp, s); + keyunlock(kp); } SRPL_LEAVE(&sr); m_freem(packet); @@ -1145,7 +1145,7 @@ pfkeyv2_send(struct socket *so, void *message, int len) struct srp_ref sr; struct sadb_x_rdomain *srdomain; u_int rdomain = 0; - int promisc, s; + int promisc; mtx_enter(&pfkeyv2_mtx); promisc = npromisc; @@ -1192,10 +1192,10 @@ pfkeyv2_send(struct socket *so, void *message, int len) if (bkp->kcb_rdomain != kp->kcb_rdomain) continue; - s = keylock(bkp); + keylock(bkp); if (bkp->kcb_flags & PFKEYV2_SOCKETFLAGS_PROMISC) pfkey_sendup(bkp, packet, 1); - keyunlock(bkp, s); + keyunlock(bkp); } SRPL_LEAVE(&sr); @@ -1630,14 +1630,14 @@ pfkeyv2_send(struct socket *so, void *message, int len) break; case SADB_REGISTER: - s = keylock(kp); + keylock(kp); if (!(kp->kcb_flags & PFKEYV2_SOCKETFLAGS_REGISTERED)) { kp->kcb_flags |= PFKEYV2_SOCKETFLAGS_REGISTERED; mtx_enter(&pfkeyv2_mtx); nregistered++; mtx_leave(&pfkeyv2_mtx); } - keyunlock(kp, s); + keyunlock(kp); freeme_sz = sizeof(struct sadb_supported) + sizeof(ealgs); if (!(freeme = malloc(freeme_sz, M_PFKEY, M_NOWAIT | M_ZERO))) { @@ -1664,10 +1664,10 @@ pfkeyv2_send(struct socket *so, void *message, int len) } /* Keep track what this socket has registered for */ - s = keylock(kp); + keylock(kp); kp->kcb_reg |= (1 << ((struct sadb_msg *)message)->sadb_msg_satype); - keyunlock(kp, s); + keyunlock(kp); ssup = (struct sadb_supported *) freeme2; ssup->sadb_supported_len = freeme2_sz / sizeof(uint64_t); @@ -2043,9 +2043,9 @@ pfkeyv2_send(struct socket *so, void *message, int len) if (!smsg->sadb_msg_seq || (smsg->sadb_msg_seq == kp->kcb_pid)) { - s = keylock(bkp); + keylock(bkp); pfkey_sendup(bkp, packet, 1); - keyunlock(bkp, s); + keyunlock(bkp); } } SRPL_LEAVE(&sr); @@ -2057,7 +2057,7 @@ pfkeyv2_send(struct socket *so, void *message, int len) goto ret; } - s = keylock(kp); + keylock(kp); i = (kp->kcb_flags & PFKEYV2_SOCKETFLAGS_PROMISC) ? 1 : 0; j = smsg->sadb_msg_satype ? 1 : 0; @@ -2077,7 +2077,7 @@ pfkeyv2_send(struct socket *so, void *message, int len) mtx_leave(&pfkeyv2_mtx); } } - keyunlock(kp, s); + keyunlock(kp); } break; diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index bf0f9c01ce2..bb2c1224593 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.327 2022/03/09 17:29:52 claudio Exp $ */ +/* $OpenBSD: rtsock.c,v 1.328 2022/06/06 14:45:41 claudio Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -350,7 +350,7 @@ route_detach(struct socket *so) rop_list); rw_exit(&rtptable.rtp_lk); - sounlock(so, SL_LOCKED); + sounlock(so); /* wait for all references to drop */ refcnt_finalize(&rop->rop_refcnt, "rtsockrefs"); @@ -448,11 +448,10 @@ void rtm_senddesync_timer(void *xso) { struct socket *so = xso; - int s; - s = solock(so); + solock(so); rtm_senddesync(so); - sounlock(so, s); + sounlock(so); } void @@ -502,7 +501,6 @@ route_input(struct mbuf *m0, struct socket *so0, sa_family_t sa_family) struct rt_msghdr *rtm; struct mbuf *m = m0; struct srp_ref sr; - int s; /* ensure that we can access the rtm_type via mtod() */ if (m->m_len < offsetof(struct rt_msghdr, rtm_type) + 1) { @@ -522,7 +520,7 @@ route_input(struct mbuf *m0, struct socket *so0, sa_family_t sa_family) so = rop->rop_socket; - s = solock(so); + solock(so); /* * Check to see if we don't want our own messages and @@ -579,7 +577,7 @@ route_input(struct mbuf *m0, struct socket *so0, sa_family_t sa_family) rtm_sendup(so, m); next: - sounlock(so, s); + sounlock(so); } SRPL_LEAVE(&sr); @@ -709,7 +707,7 @@ route_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr, * descriptor reference is still held. */ - sounlock(so, SL_LOCKED); + sounlock(so); len = m->m_pkthdr.len; if (len < offsetof(struct rt_msghdr, rtm_hdrlen) + 1 || diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index a725b171da1..09989987250 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.266 2022/05/15 09:12:20 dlg Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.267 2022/06/06 14:45:41 claudio Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -570,7 +570,7 @@ in_pcbdetach(struct inpcb *inp) * sockets, do not release it to not introduce new sleeping * points. */ - sofree(so, SL_NOUNLOCK); + sofree(so, 1); m_freem(inp->inp_options); if (inp->inp_route.ro_rt) { rtfree(inp->inp_route.ro_rt); diff --git a/sys/nfs/krpc_subr.c b/sys/nfs/krpc_subr.c index d20536f09ea..eb35b5f6c1d 100644 --- a/sys/nfs/krpc_subr.c +++ b/sys/nfs/krpc_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: krpc_subr.c,v 1.36 2019/01/22 22:45:04 bluhm Exp $ */ +/* $OpenBSD: krpc_subr.c,v 1.37 2022/06/06 14:45:41 claudio Exp $ */ /* $NetBSD: krpc_subr.c,v 1.12.4.1 1996/06/07 00:52:26 cgd Exp $ */ /* @@ -211,7 +211,7 @@ krpc_call(struct sockaddr_in *sa, u_int prog, u_int vers, u_int func, struct rpc_call *call; struct rpc_reply *reply; struct uio auio; - int s, error, rcvflg, timo, secs, len, authlen; + int error, rcvflg, timo, secs, len, authlen; static u_int32_t xid = 0; char addr[INET_ADDRSTRLEN]; int *ip; @@ -239,9 +239,9 @@ krpc_call(struct sockaddr_in *sa, u_int prog, u_int vers, u_int func, tv.tv_usec = 0; memcpy(mtod(m, struct timeval *), &tv, sizeof tv); m->m_len = sizeof(tv); - s = solock(so); + solock(so); error = sosetopt(so, SOL_SOCKET, SO_RCVTIMEO, m); - sounlock(so, s); + sounlock(so); m_freem(m); if (error) goto out; @@ -255,9 +255,9 @@ krpc_call(struct sockaddr_in *sa, u_int prog, u_int vers, u_int func, on = mtod(m, int32_t *); m->m_len = sizeof(*on); *on = 1; - s = solock(so); + solock(so); error = sosetopt(so, SOL_SOCKET, SO_BROADCAST, m); - sounlock(so, s); + sounlock(so); m_freem(m); if (error) goto out; @@ -272,9 +272,9 @@ krpc_call(struct sockaddr_in *sa, u_int prog, u_int vers, u_int func, mopt->m_len = sizeof(int); ip = mtod(mopt, int *); *ip = IP_PORTRANGE_LOW; - s = solock(so); + solock(so); error = sosetopt(so, IPPROTO_IP, IP_PORTRANGE, mopt); - sounlock(so, s); + sounlock(so); m_freem(mopt); if (error) goto out; @@ -286,9 +286,9 @@ krpc_call(struct sockaddr_in *sa, u_int prog, u_int vers, u_int func, sin->sin_family = AF_INET; sin->sin_addr.s_addr = INADDR_ANY; sin->sin_port = htons(0); - s = solock(so); + solock(so); error = sobind(so, m, &proc0); - sounlock(so, s); + sounlock(so); m_freem(m); if (error) { printf("bind failed\n"); @@ -299,9 +299,9 @@ krpc_call(struct sockaddr_in *sa, u_int prog, u_int vers, u_int func, mopt->m_len = sizeof(int); ip = mtod(mopt, int *); *ip = IP_PORTRANGE_DEFAULT; - s = solock(so); + solock(so); error = sosetopt(so, IPPROTO_IP, IP_PORTRANGE, mopt); - sounlock(so, s); + sounlock(so); m_freem(mopt); if (error) goto out; diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c index aa93938383d..44f99d60a8f 100644 --- a/sys/nfs/nfs_socket.c +++ b/sys/nfs/nfs_socket.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_socket.c,v 1.141 2022/05/22 04:52:17 visa Exp $ */ +/* $OpenBSD: nfs_socket.c,v 1.142 2022/06/06 14:45:41 claudio Exp $ */ /* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */ /* @@ -234,7 +234,7 @@ int nfs_connect(struct nfsmount *nmp, struct nfsreq *rep) { struct socket *so; - int s, error, rcvreserve, sndreserve; + int error, rcvreserve, sndreserve; struct sockaddr *saddr; struct sockaddr_in *sin; struct mbuf *nam = NULL, *mopt = NULL; @@ -258,7 +258,7 @@ nfs_connect(struct nfsmount *nmp, struct nfsreq *rep) MGET(nam, M_WAIT, MT_SONAME); so = nmp->nm_so; - s = solock(so); + solock(so); nmp->nm_soflags = so->so_proto->pr_flags; /* @@ -365,7 +365,7 @@ nfs_connect(struct nfsmount *nmp, struct nfsreq *rep) goto bad; so->so_rcv.sb_flags |= SB_NOINTR; so->so_snd.sb_flags |= SB_NOINTR; - sounlock(so, s); + sounlock(so); m_freem(mopt); m_freem(nam); @@ -378,7 +378,7 @@ nfs_connect(struct nfsmount *nmp, struct nfsreq *rep) return (0); bad: - sounlock(so, s); + sounlock(so); m_freem(mopt); m_freem(nam); diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c index 6dc6a22a50b..b9eecb0430b 100644 --- a/sys/nfs/nfs_syscalls.c +++ b/sys/nfs/nfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nfs_syscalls.c,v 1.117 2021/03/11 13:31:35 jsg Exp $ */ +/* $OpenBSD: nfs_syscalls.c,v 1.118 2022/06/06 14:45:41 claudio Exp $ */ /* $NetBSD: nfs_syscalls.c,v 1.19 1996/02/18 11:53:52 fvdl Exp $ */ /* @@ -229,7 +229,7 @@ nfssvc_addsock(struct file *fp, struct mbuf *mynam) struct nfssvc_sock *slp; struct socket *so; struct nfssvc_sock *tslp; - int s, error; + int error; so = (struct socket *)fp->f_data; tslp = NULL; @@ -247,10 +247,10 @@ nfssvc_addsock(struct file *fp, struct mbuf *mynam) siz = NFS_MAXPACKET + sizeof (u_long); else siz = NFS_MAXPACKET; - s = solock(so); + solock(so); error = soreserve(so, siz, siz); if (error) { - sounlock(so, s); + sounlock(so); m_freem(mynam); return (error); } @@ -279,7 +279,7 @@ nfssvc_addsock(struct file *fp, struct mbuf *mynam) so->so_rcv.sb_timeo_nsecs = INFSLP; so->so_snd.sb_flags &= ~SB_NOINTR; so->so_snd.sb_timeo_nsecs = INFSLP; - sounlock(so, s); + sounlock(so); if (tslp) slp = tslp; else { diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h index 5d9ff7d40a9..142eb0af05f 100644 --- a/sys/sys/socketvar.h +++ b/sys/sys/socketvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: socketvar.h,v 1.101 2021/11/06 05:26:33 visa Exp $ */ +/* $OpenBSD: socketvar.h,v 1.102 2022/06/06 14:45:41 claudio Exp $ */ /* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */ /*- @@ -155,12 +155,6 @@ struct socket { #include -/* - * Values for sounlock()/sofree(). - */ -#define SL_NOUNLOCK 0x00 -#define SL_LOCKED 0x42 - void soassertlocked(struct socket *); /* @@ -336,8 +330,8 @@ void sowwakeup(struct socket *); int sockargs(struct mbuf **, const void *, size_t, int); int sosleep_nsec(struct socket *, void *, int, const char *, uint64_t); -int solock(struct socket *); -void sounlock(struct socket *, int); +void solock(struct socket *); +void sounlock(struct socket *); int sendit(struct proc *, int, struct msghdr *, int, register_t *); int recvit(struct proc *, int, struct msghdr *, caddr_t, register_t *); -- 2.20.1