Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/uipc_socket.c
Show First 20 Lines • Show All 1,465 Lines • ▼ Show 20 Lines | sosend_generic(struct socket *so, struct sockaddr *addr, struct uio *uio, | ||||
error = sblock(&so->so_snd, SBLOCKWAIT(flags)); | error = sblock(&so->so_snd, SBLOCKWAIT(flags)); | ||||
if (error) | if (error) | ||||
goto out; | goto out; | ||||
restart: | restart: | ||||
do { | do { | ||||
SOCKBUF_LOCK(&so->so_snd); | SOCKBUF_LOCK(&so->so_snd); | ||||
if (so->so_snd.sb_state & SBS_CANTSENDMORE) { | |||||
SOCKBUF_UNLOCK(&so->so_snd); | |||||
error = EPIPE; | |||||
goto release; | |||||
} | |||||
if (so->so_error) { | if (so->so_error) { | ||||
error = so->so_error; | error = so->so_error; | ||||
so->so_error = 0; | so->so_error = 0; | ||||
SOCKBUF_UNLOCK(&so->so_snd); | SOCKBUF_UNLOCK(&so->so_snd); | ||||
goto release; | |||||
} | |||||
if (so->so_snd.sb_state & SBS_CANTSENDMORE) { | |||||
SOCKBUF_UNLOCK(&so->so_snd); | |||||
error = EPIPE; | |||||
goto release; | goto release; | ||||
} | } | ||||
if ((so->so_state & SS_ISCONNECTED) == 0) { | if ((so->so_state & SS_ISCONNECTED) == 0) { | ||||
/* | /* | ||||
* `sendto' and `sendmsg' is allowed on a connection- | * `sendto' and `sendmsg' is allowed on a connection- | ||||
* based socket if it supports implied connect. | * based socket if it supports implied connect. | ||||
* Return ENOTCONN if not connected and no address is | * Return ENOTCONN if not connected and no address is | ||||
* supplied. | * supplied. | ||||
▲ Show 20 Lines • Show All 2,635 Lines • Show Last 20 Lines |