-/* $OpenBSD: uipc_socket.c,v 1.216 2018/02/19 08:59:52 mpi Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.217 2018/02/19 11:35:41 mpi Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
int
soconnect2(struct socket *so1, struct socket *so2)
{
- int error;
+ int s, error;
- soassertlocked(so1);
+ s = solock(so1);
error = (*so1->so_proto->pr_usrreq)(so1, PRU_CONNECT2, NULL,
(struct mbuf *)so2, NULL, curproc);
+ sounlock(s);
return (error);
}
-/* $OpenBSD: uipc_syscalls.c,v 1.165 2018/02/19 08:59:52 mpi Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.166 2018/02/19 11:35:41 mpi Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
struct filedesc *fdp = p->p_fd;
struct file *fp1, *fp2;
struct socket *so1, *so2;
- int s, type, cloexec, nonblock, fflag, error, sv[2];
+ int type, cloexec, nonblock, fflag, error, sv[2];
type = SCARG(uap, type) & ~(SOCK_CLOEXEC | SOCK_NONBLOCK);
cloexec = (SCARG(uap, type) & SOCK_CLOEXEC) ? UF_EXCLOSE : 0;
if (error)
goto free1;
- s = solock(so1);
error = soconnect2(so1, so2);
- sounlock(s);
if (error != 0)
goto free2;
/*
* Datagram socket connection is asymmetric.
*/
- s = solock(so2);
error = soconnect2(so2, so1);
- sounlock(s);
if (error != 0)
goto free2;
}
-/* $OpenBSD: fifo_vnops.c,v 1.62 2018/01/02 06:38:45 guenther Exp $ */
+/* $OpenBSD: fifo_vnops.c,v 1.63 2018/02/19 11:35:41 mpi Exp $ */
/* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */
/*
return (error);
}
fip->fi_writesock = wso;
- /*
- * XXXSMP
- * We only lock `wso' because AF_LOCAL sockets are
- * still relying on the KERNEL_LOCK().
- */
- s = solock(wso);
if ((error = soconnect2(wso, rso)) != 0) {
- sounlock(s);
(void)soclose(wso);
(void)soclose(rso);
free(fip, M_VNODE, sizeof *fip);
return (error);
}
fip->fi_readers = fip->fi_writers = 0;
+ s = solock(wso);
wso->so_state |= SS_CANTSENDMORE;
wso->so_snd.sb_lowat = PIPE_BUF;
} else {