Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/uipc_socket.c
Show First 20 Lines • Show All 922 Lines • ▼ Show 20 Lines | solisten_proto_check(struct socket *so) | ||||
if (!sx_try_xlock(&so->so_snd_sx)) | if (!sx_try_xlock(&so->so_snd_sx)) | ||||
return (EAGAIN); | return (EAGAIN); | ||||
if (!sx_try_xlock(&so->so_rcv_sx)) { | if (!sx_try_xlock(&so->so_rcv_sx)) { | ||||
sx_xunlock(&so->so_snd_sx); | sx_xunlock(&so->so_snd_sx); | ||||
return (EAGAIN); | return (EAGAIN); | ||||
} | } | ||||
mtx_lock(&so->so_snd_mtx); | mtx_lock(&so->so_snd_mtx); | ||||
mtx_lock(&so->so_rcv_mtx); | mtx_lock(&so->so_rcv_mtx); | ||||
/* Interlock with soo_aio_queue(). */ | |||||
if ((so->so_snd.sb_flags & (SB_AIO | SB_AIO_RUNNING)) != 0 || | |||||
(so->so_rcv.sb_flags & (SB_AIO | SB_AIO_RUNNING)) != 0) { | |||||
solisten_proto_abort(so); | |||||
return (EINVAL); | |||||
} | |||||
return (0); | return (0); | ||||
} | } | ||||
/* | /* | ||||
* Undo the setup done by solisten_proto_check(). | * Undo the setup done by solisten_proto_check(). | ||||
*/ | */ | ||||
void | void | ||||
solisten_proto_abort(struct socket *so) | solisten_proto_abort(struct socket *so) | ||||
▲ Show 20 Lines • Show All 3,555 Lines • Show Last 20 Lines |