diff options
| author | Jakub Kicinski <kuba@kernel.org> | 2025-07-09 04:05:27 +0300 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2025-07-09 04:05:27 +0300 |
| commit | 042ef6aafd3fa22a0398c1c25c2dc742cba78eed (patch) | |
| tree | a7408f5361ad08f71f135cfe0fb1bc21f3351422 /include | |
| parent | d18e43dddf2e7f4d16764cca14032631ab8ef012 (diff) | |
| parent | e0f60ba041a0088a48a5064583e8c36306a8f7e3 (diff) | |
| download | linux-042ef6aafd3fa22a0398c1c25c2dc742cba78eed.tar.xz | |
Merge branch 'af_unix-introduce-so_inq-scm_inq'
Kuniyuki Iwashima says:
====================
af_unix: Introduce SO_INQ & SCM_INQ.
We have an application that uses almost the same code for TCP and
AF_UNIX (SOCK_STREAM).
The application uses TCP_INQ for TCP, but AF_UNIX doesn't have it
and requires an extra syscall, ioctl(SIOCINQ) or getsockopt(SO_MEMINFO)
as an alternative.
Also, ioctl(SIOCINQ) for AF_UNIX SOCK_STREAM is more expensive because
it needs to iterate all skb in the receive queue.
This series adds a cached field for SIOCINQ to speed it up and introduce
SO_INQ, the generic version of TCP_INQ to get the queue length as cmsg in
each recvmsg().
====================
Link: https://patch.msgid.link/20250702223606.1054680-1-kuniyu@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/af_unix.h | 2 | ||||
| -rw-r--r-- | include/uapi/asm-generic/socket.h | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index 1af1841b7601..34f53dde65ce 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h @@ -47,6 +47,8 @@ struct unix_sock { #define peer_wait peer_wq.wait wait_queue_entry_t peer_wake; struct scm_stat scm_stat; + int inq_len; + bool recvmsg_inq; #if IS_ENABLED(CONFIG_AF_UNIX_OOB) struct sk_buff *oob_skb; #endif diff --git a/include/uapi/asm-generic/socket.h b/include/uapi/asm-generic/socket.h index f333a0ac4ee4..53b5a8c002b1 100644 --- a/include/uapi/asm-generic/socket.h +++ b/include/uapi/asm-generic/socket.h @@ -147,6 +147,9 @@ #define SO_PASSRIGHTS 83 +#define SO_INQ 84 +#define SCM_INQ SO_INQ + #if !defined(__KERNEL__) #if __BITS_PER_LONG == 64 || (defined(__x86_64__) && defined(__ILP32__)) |
