Does SCM_RIGHTS limit on fd array apply to a particular cmsghdr or the whole ancillary data?

From: Wolfgang Draxinger
Date: Wed Dec 09 2020 - 14:31:31 EST


Hi,

in the documentation on SCM_RIGHTS the maximum number of file
descriptors that can be passed is described as (release 5.09 of the
Linux man-pages project):

| SCM_RIGHTS
| Send or receive a set of open file descriptors from another
| process. The data portion contains an integer array of the file
| descriptors.
| (...)
| The kernel constant SCM_MAX_FD defines a limit on the number of
| file descriptors in the array. Attempting to send an array
| larger than this limit causes sendmsg(2) to fail with
the error | EINVAL.

In my reading this might be interpreted as SCM_MAX_FD per SCM_RIGHTS
cmsghdr, xor SCM_MAX_FD per sendmsg. It would be good to know, which one
it is. So which is the proper strategy if I have to pass more than
SCM_MAX_FD file descriptors between processes?


Cheers,
Wolfgang