Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/uipc_socket.c
Show First 20 Lines • Show All 1,038 Lines • ▼ Show 20 Lines | sofree(struct socket *so) | ||||
/* | /* | ||||
* From this point on, we assume that no other references to this | * From this point on, we assume that no other references to this | ||||
* socket exist anywhere else in the stack. Therefore, no locks need | * socket exist anywhere else in the stack. Therefore, no locks need | ||||
* to be acquired or held. | * to be acquired or held. | ||||
* | * | ||||
* We used to do a lot of socket buffer and socket locking here, as | * We used to do a lot of socket buffer and socket locking here, as | ||||
* well as invoke sorflush() and perform wakeups. The direct call to | * well as invoke sorflush() and perform wakeups. The direct call to | ||||
* dom_dispose() and sbrelease_internal() are an inlining of what was | * dom_dispose() and sbdestroy() are an inlining of what was | ||||
* necessary from sorflush(). | * necessary from sorflush(). | ||||
* | * | ||||
* Notice that the socket buffer and kqueue state are torn down | * Notice that the socket buffer and kqueue state are torn down | ||||
* before calling pru_detach. This means that protocols shold not | * before calling pru_detach. This means that protocols shold not | ||||
* assume they can perform socket wakeups, etc, in their detach code. | * assume they can perform socket wakeups, etc, in their detach code. | ||||
*/ | */ | ||||
if (!SOLISTENING(so)) { | if (!SOLISTENING(so)) { | ||||
sbdestroy(&so->so_snd, so); | sbdestroy(&so->so_snd, so); | ||||
▲ Show 20 Lines • Show All 921 Lines • ▼ Show 20 Lines | while (m != NULL && !(m->m_flags & M_NOTAVAIL) && uio->uio_resid > 0 | ||||
* record) when we drop priority; we must note any additions | * record) when we drop priority; we must note any additions | ||||
* to the sockbuf when we block interrupts again. | * to the sockbuf when we block interrupts again. | ||||
*/ | */ | ||||
if (mp == NULL) { | if (mp == NULL) { | ||||
SOCKBUF_LOCK_ASSERT(&so->so_rcv); | SOCKBUF_LOCK_ASSERT(&so->so_rcv); | ||||
SBLASTRECORDCHK(&so->so_rcv); | SBLASTRECORDCHK(&so->so_rcv); | ||||
SBLASTMBUFCHK(&so->so_rcv); | SBLASTMBUFCHK(&so->so_rcv); | ||||
SOCKBUF_UNLOCK(&so->so_rcv); | SOCKBUF_UNLOCK(&so->so_rcv); | ||||
error = uiomove(mtod(m, char *) + moff, (int)len, uio); | if ((m->m_flags & M_NOMAP) != 0) | ||||
error = m_unmappedtouio(m, moff, uio, (int)len); | |||||
else | |||||
error = uiomove(mtod(m, char *) + moff, | |||||
(int)len, uio); | |||||
SOCKBUF_LOCK(&so->so_rcv); | SOCKBUF_LOCK(&so->so_rcv); | ||||
if (error) { | if (error) { | ||||
/* | /* | ||||
* The MT_SONAME mbuf has already been removed | * The MT_SONAME mbuf has already been removed | ||||
* from the record, so it is necessary to | * from the record, so it is necessary to | ||||
* remove the data mbufs, if any, to preserve | * remove the data mbufs, if any, to preserve | ||||
* the invariant in the case of PR_ADDR that | * the invariant in the case of PR_ADDR that | ||||
* requires MT_SONAME mbufs at the head of | * requires MT_SONAME mbufs at the head of | ||||
▲ Show 20 Lines • Show All 2,169 Lines • Show Last 20 Lines |