Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/sctp_syscalls.c
Show First 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | #if (defined(INET) || defined(INET6)) && defined(SCTP) | ||||
*/ | */ | ||||
error = falloc(td, &nfp, &fd, 0); | error = falloc(td, &nfp, &fd, 0); | ||||
if (error != 0) | if (error != 0) | ||||
goto done; | goto done; | ||||
td->td_retval[0] = fd; | td->td_retval[0] = fd; | ||||
CURVNET_SET(head->so_vnet); | CURVNET_SET(head->so_vnet); | ||||
so = sonewconn(head, SS_ISCONNECTED); | so = sopeeloff(head); | ||||
if (so == NULL) { | if (so == NULL) { | ||||
error = ENOMEM; | error = ENOMEM; | ||||
goto noconnection; | goto noconnection; | ||||
} | } | ||||
/* | |||||
* Before changing the flags on the socket, we have to bump the | |||||
* reference count. Otherwise, if the protocol calls sofree(), | |||||
* the socket will be released due to a zero refcount. | |||||
*/ | |||||
SOCK_LOCK(so); | |||||
soref(so); /* file descriptor reference */ | |||||
SOCK_UNLOCK(so); | |||||
ACCEPT_LOCK(); | |||||
TAILQ_REMOVE(&head->so_comp, so, so_list); | |||||
head->so_qlen--; | |||||
so->so_state |= (head->so_state & SS_NBIO); | |||||
so->so_state &= ~SS_NOFDREF; | |||||
so->so_qstate &= ~SQ_COMP; | |||||
so->so_head = NULL; | |||||
ACCEPT_UNLOCK(); | |||||
finit(nfp, fflag, DTYPE_SOCKET, so, &socketops); | finit(nfp, fflag, DTYPE_SOCKET, so, &socketops); | ||||
error = sctp_do_peeloff(head, so, (sctp_assoc_t)uap->name); | error = sctp_do_peeloff(head, so, (sctp_assoc_t)uap->name); | ||||
if (error != 0) | if (error != 0) | ||||
goto noconnection; | goto noconnection; | ||||
if (head->so_sigio != NULL) | if (head->so_sigio != NULL) | ||||
fsetown(fgetown(&head->so_sigio), &so->so_sigio); | fsetown(fgetown(&head->so_sigio), &so->so_sigio); | ||||
noconnection: | noconnection: | ||||
▲ Show 20 Lines • Show All 412 Lines • Show Last 20 Lines |