This is done through IORING_OP_RECVMSG. This opcode uses the same sqe->msg_flags that IORING_OP_SENDMSG added, and we pass in the msghdr struct in the sqe->addr field as well. We use MSG_DONTWAIT to force an inline fast path if recvmsg() doesn't block, and punt to async execution if it would have.
Showing the changes to include/linux (1 of 4 files). Show all
Unified · Split
| @@ -378,6 +378,9 @@ extern int __sys_sendmmsg(int fd, struct mmsghdr __user *mmsg, · 377 unmodified lines | ||
| 378 | 378 | extern long __sys_sendmsg_sock(struct socket *sock, |
| 379 | 379 | struct user_msghdr __user *msg, |
| 380 | 380 | unsigned int flags); |
| 381 | +extern long __sys_recvmsg_sock(struct socket *sock, | |
| 382 | + struct user_msghdr __user *msg, | |
| 383 | + unsigned int flags); | |
| 381 | 384 | |
| 382 | 385 | /* helpers which do the actual work for syscalls */ |
| 383 | 386 | extern int __sys_recvfrom(int fd, void __user *ubuf, size_t size, |