linux/include/uapi/asm-generic
Kuniyuki Iwashima df30285b36 af_unix: Introduce SO_INQ.
We have an application that uses almost the same code for TCP and
AF_UNIX (SOCK_STREAM).

TCP can use TCP_INQ, but AF_UNIX doesn't have it and requires an
extra syscall, ioctl(SIOCINQ) or getsockopt(SO_MEMINFO) as an
alternative.

Let's introduce the generic version of TCP_INQ.

If SO_INQ is enabled, recvmsg() will put a cmsg of SCM_INQ that
contains the exact value of ioctl(SIOCINQ).  The cmsg is also
included when msg->msg_get_inq is non-zero to make sockets
io_uring-friendly.

Note that SOCK_CUSTOM_SOCKOPT is flagged only for SOCK_STREAM to
override setsockopt() for SOL_SOCKET.

By having the flag in struct unix_sock, instead of struct sock, we
can later add SO_INQ support for TCP and reuse tcp_sk(sk)->recvmsg_inq.

Note also that supporting custom getsockopt() for SOL_SOCKET will need
preparation for other SOCK_CUSTOM_SOCKOPT users (UDP, vsock, MPTCP).

Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20250702223606.1054680-7-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-07-08 18:05:25 -07:00
..
Kbuild
auxvec.h
bitsperlong.h uapi: introduce uapi-friendly macros for GENMASK 2024-02-08 08:41:03 -05:00
bpf_perf_event.h
errno-base.h
errno.h
fcntl.h fs: get rid of __FMODE_NONOTIFY kludge 2024-12-09 11:34:29 +01:00
hugetlb_encode.h hugetlb_encode.h: fix undefined behaviour (34 << 26) 2022-10-03 14:02:55 -07:00
int-l64.h
int-ll64.h
ioctl.h UAPI/ioctl: Improve parameter name of ioctl request definition helpers 2024-10-28 21:44:22 +00:00
ioctls.h
ipcbuf.h
kvm_para.h
mman-common.h mm/pkey: Add PKEY_UNRESTRICTED macro 2025-02-17 18:11:18 +00:00
mman.h mman: Add map_shadow_stack() flags 2024-10-04 12:04:33 +01:00
msgbuf.h
param.h
poll.h
posix_types.h
resource.h
sembuf.h
setup.h
shmbuf.h
siginfo.h posix-timers: Move sequence logic into struct k_itimer 2024-11-07 02:14:45 +01:00
signal-defs.h
signal.h
socket.h af_unix: Introduce SO_INQ. 2025-07-08 18:05:25 -07:00
sockios.h
stat.h
statfs.h
swab.h
termbits-common.h serial: Support for RS-485 multipoint addresses 2022-06-27 14:44:20 +02:00
termbits.h
termios.h
types.h uapi: Add missing _UAPI prefix to <asm-generic/types.h> include guard 2022-12-01 16:22:06 +01:00
ucontext.h
unistd.h fs: add open_tree_attr() 2025-02-12 12:12:28 +01:00