Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linux/linux_socket.c
Show First 20 Lines • Show All 1,457 Lines • ▼ Show 20 Lines | linux_recvmmsg(struct thread *td, struct linux_recvmmsg_args *args) | ||||
if (args->timeout) { | if (args->timeout) { | ||||
error = copyin(args->timeout, <s, sizeof(struct l_timespec)); | error = copyin(args->timeout, <s, sizeof(struct l_timespec)); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
error = linux_to_native_timespec(&ts, <s); | error = linux_to_native_timespec(&ts, <s); | ||||
if (error != 0) | if (error != 0) | ||||
return (error); | return (error); | ||||
getnanotime(&tts); | getnanotime(&tts); | ||||
timespecadd(&tts, &ts); | timespecadd(&tts, &ts, &tts); | ||||
} | } | ||||
msg = PTRIN(args->msg); | msg = PTRIN(args->msg); | ||||
datagrams = 0; | datagrams = 0; | ||||
while (datagrams < args->vlen) { | while (datagrams < args->vlen) { | ||||
error = linux_recvmsg_common(td, args->s, &msg->msg_hdr, | error = linux_recvmsg_common(td, args->s, &msg->msg_hdr, | ||||
args->flags & ~LINUX_MSG_WAITFORONE, &bsd_msg); | args->flags & ~LINUX_MSG_WAITFORONE, &bsd_msg); | ||||
if (error != 0) | if (error != 0) | ||||
Show All 12 Lines | while (datagrams < args->vlen) { | ||||
if (args->flags & LINUX_MSG_WAITFORONE) | if (args->flags & LINUX_MSG_WAITFORONE) | ||||
args->flags |= LINUX_MSG_DONTWAIT; | args->flags |= LINUX_MSG_DONTWAIT; | ||||
/* | /* | ||||
* See BUGS section of recvmmsg(2). | * See BUGS section of recvmmsg(2). | ||||
*/ | */ | ||||
if (args->timeout) { | if (args->timeout) { | ||||
getnanotime(&ts); | getnanotime(&ts); | ||||
timespecsub(&ts, &tts); | timespecsub(&ts, &tts, &ts); | ||||
if (!timespecisset(&ts) || ts.tv_sec > 0) | if (!timespecisset(&ts) || ts.tv_sec > 0) | ||||
break; | break; | ||||
} | } | ||||
/* Out of band data, return right away. */ | /* Out of band data, return right away. */ | ||||
if (bsd_msg.msg_flags & MSG_OOB) | if (bsd_msg.msg_flags & MSG_OOB) | ||||
break; | break; | ||||
} | } | ||||
if (error == 0) | if (error == 0) | ||||
▲ Show 20 Lines • Show All 261 Lines • Show Last 20 Lines |