summaryrefslogtreecommitdiffstats
path: root/sys/kern/uipc_syscalls.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/uipc_syscalls.c')
-rw-r--r--sys/kern/uipc_syscalls.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index 662b3abd..5689aeb 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -64,6 +64,7 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <sys/uio.h>
#include <sys/vnode.h>
+#include <sys/vimage.h>
#ifdef KTRACE
#include <sys/ktrace.h>
#endif
@@ -264,7 +265,9 @@ listen(td, uap)
if (error)
goto done;
#endif
+ CURVNET_SET(so->so_vnet);
error = solisten(so, uap->backlog, td);
+ CURVNET_RESTORE();
#ifdef MAC
done:
#endif
@@ -429,7 +432,9 @@ kern_accept(struct thread *td, int s, struct sockaddr **name,
tmp = fflag & FASYNC;
(void) fo_ioctl(nfp, FIOASYNC, &tmp, td->td_ucred, td);
sa = 0;
+ CURVNET_SET(so->so_vnet);
error = soaccept(so, &sa);
+ CURVNET_RESTORE();
if (error) {
/*
* return a namelen of zero for older code which might
@@ -976,9 +981,11 @@ kern_recvit(td, s, mp, fromseg, controlp)
ktruio = cloneuio(&auio);
#endif
len = auio.uio_resid;
+ CURVNET_SET(so->so_vnet);
error = soreceive(so, &fromsa, &auio, (struct mbuf **)0,
(mp->msg_control || controlp) ? &control : (struct mbuf **)0,
&mp->msg_flags);
+ CURVNET_RESTORE();
if (error) {
if (auio.uio_resid != (int)len && (error == ERESTART ||
error == EINTR || error == EWOULDBLOCK))
@@ -1322,7 +1329,9 @@ kern_setsockopt(td, s, level, name, val, valseg, valsize)
error = getsock(td->td_proc->p_fd, s, &fp, NULL);
if (error == 0) {
so = fp->f_data;
+ CURVNET_SET(so->so_vnet);
error = sosetopt(so, &sopt);
+ CURVNET_RESTORE();
fdrop(fp, td);
}
return(error);
@@ -1400,7 +1409,9 @@ kern_getsockopt(td, s, level, name, val, valseg, valsize)
error = getsock(td->td_proc->p_fd, s, &fp, NULL);
if (error == 0) {
so = fp->f_data;
+ CURVNET_SET(so->so_vnet);
error = sogetopt(so, &sopt);
+ CURVNET_RESTORE();
*valsize = sopt.sopt_valsize;
fdrop(fp, td);
}
@@ -1463,7 +1474,9 @@ kern_getsockname(struct thread *td, int fd, struct sockaddr **sa,
return (error);
so = fp->f_data;
*sa = NULL;
+ CURVNET_SET(so->so_vnet);
error = (*so->so_proto->pr_usrreqs->pru_sockaddr)(so, sa);
+ CURVNET_RESTORE();
if (error)
goto bad;
if (*sa == NULL)
@@ -1564,7 +1577,9 @@ kern_getpeername(struct thread *td, int fd, struct sockaddr **sa,
goto done;
}
*sa = NULL;
+ CURVNET_SET(so->so_vnet);
error = (*so->so_proto->pr_usrreqs->pru_peeraddr)(so, sa);
+ CURVNET_RESTORE();
if (error)
goto bad;
if (*sa == NULL)
@@ -2176,9 +2191,11 @@ retry_space:
goto done;
}
SOCKBUF_UNLOCK(&so->so_snd);
+ CURVNET_SET(so->so_vnet);
/* Avoid error aliasing. */
err = (*so->so_proto->pr_usrreqs->pru_send)
(so, 0, m, NULL, NULL, td);
+ CURVNET_RESTORE();
if (err == 0) {
/*
* We need two counters to get the
OpenPOWER on IntegriCloud