diff options
author | Pavel Emelyanov <xemul@virtuozzo.com> | 2016-11-02 03:38:28 +0300 |
---|---|---|
committer | Pavel Emelyanov <xemul@virtuozzo.com> | 2016-12-12 16:07:26 +0300 |
commit | 165203b3c63fcc88c8ff0c157cf0166b2e283157 (patch) | |
tree | a3dce6f303cd788ef698a3a1fdcd57aafd7ea331 /include | |
parent | 7279c0e7b46a557419a3fecd5c49f0272c89190f (diff) |
scm: Move scm_fdset structure into include/common
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/common/scm.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/include/common/scm.h b/include/common/scm.h new file mode 100644 index 000000000..e68aa2da6 --- /dev/null +++ b/include/common/scm.h @@ -0,0 +1,44 @@ +#ifndef __COMMON_SCM_H__ +#define __COMMON_SCM_H__ + +#include <stdint.h> + +/* + * Because of kernel doing kmalloc for user data passed + * in SCM messages, and there is kernel's SCM_MAX_FD as a limit + * for descriptors passed at once we're trying to reduce + * the pressue on kernel memory manager and use predefined + * known to work well size of the message buffer. + */ +#define CR_SCM_MSG_SIZE (1024) +#define CR_SCM_MAX_FD (252) + +#ifdef SCM_FDSET_HAS_OPTS +struct fd_opts { + char flags; + struct { + uint32_t uid; + uint32_t euid; + uint32_t signum; + uint32_t pid_type; + uint32_t pid; + } fown; +}; +#endif + +struct scm_fdset { + struct msghdr hdr; + struct iovec iov; + char msg_buf[CR_SCM_MSG_SIZE]; +#ifdef SCM_FDSET_HAS_OPTS + struct fd_opts opts[CR_SCM_MAX_FD]; +#else + char dummy; +#endif +}; + +#ifndef F_GETOWNER_UIDS +#define F_GETOWNER_UIDS 17 +#endif + +#endif |