From dc4eea68b5652e54a979d346a961971a9957f41b Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Fri, 16 Dec 2016 11:32:05 +0100 Subject: [PATCH] unix.7: Document ETOOMANYREFS for SCM_RIGHTS send exceeding RLIMIT_NOFILE limit Reviewed-by: Willy Tarreau Signed-off-by: Michael Kerrisk --- man7/unix.7 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/man7/unix.7 b/man7/unix.7 index 05681f031..3f41ad4cc 100644 --- a/man7/unix.7 +++ b/man7/unix.7 @@ -534,6 +534,33 @@ versus .TP .B ESOCKTNOSUPPORT Unknown socket type. +.TP +.B ETOOMANYREFS +This error can occur for +.BR sendmsg (2) +when sending a file descriptor as ancilary data over +a UNIX domain socket (see the description of +.BR SCM_RIGHTS , +above). +It occurs if the number of "in-flight" file descriptors exceeds the +.B RLIMIT_NOFILE +resource limit and the caller does not have the +.BR CAP_SYS_RESOURCE +capability. +An in-flight file descriptor is one that has been sent using +.BR sendmsg (2) +but has not yet been accepted in the recipient process using +.BR recvmsg (2). + +This error is diagnosed since Linux 4.5. +.\" commit 712f4aad406bb1ed67f3f98d04c044191f0ff593 +In earlier kernel versions, +it was possible to place an unlimited number of file descriptors in flight, +by sending each file descriptor with +.BR sendmsg (2) +and then closing the file descriptor so that it was not accounted against the +.B RLIMIT_NOFILE +resource limit. .PP Other errors can be generated by the generic socket layer or by the filesystem while generating a filesystem socket object.