Commit 165203b3 authored by Pavel Emelyanov's avatar Pavel Emelyanov

scm: Move scm_fdset structure into include/common

Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 7279c0e7
......@@ -11,33 +11,9 @@
#define SO_PEEK_OFF 42
#endif
/*
* 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)
#define SCM_FDSET_HAS_OPTS
struct fd_opts {
char flags;
struct {
u32 uid;
u32 euid;
u32 signum;
u32 pid_type;
u32 pid;
} fown;
};
struct scm_fdset {
struct msghdr hdr;
struct iovec iov;
char msg_buf[CR_SCM_MSG_SIZE];
struct fd_opts opts[CR_SCM_MAX_FD];
};
#include "common/scm.h"
extern int send_fds(int sock, struct sockaddr_un *saddr, int saddr_len,
int *fds, int nr_fds, bool with_flags);
......
......@@ -24,6 +24,4 @@
#include "common/bug.h"
#define SCM_FDSET_HAS_OPTS
#include "common/scm-code.c"
#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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment