Commit 333ce8fc authored by Cyrill Gorcunov's avatar Cyrill Gorcunov Committed by Pavel Emelyanov

util-net: Add declaration of scm_fdset structure

This structure will serve for multiple fds transmission/receive.
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent ee82f0cf
#ifndef UTIL_NET_H_ #ifndef UTIL_NET_H_
#define UTIL_NET_H_ #define UTIL_NET_H_
#include <sys/socket.h>
#include <sys/un.h>
#define UNIX_PATH_MAX (sizeof(struct sockaddr_un) - \ #define UNIX_PATH_MAX (sizeof(struct sockaddr_un) - \
(size_t)((struct sockaddr_un *) 0)->sun_path) (size_t)((struct sockaddr_un *) 0)->sun_path)
...@@ -8,6 +11,23 @@ ...@@ -8,6 +11,23 @@
#define SO_PEEK_OFF 42 #define SO_PEEK_OFF 42
#endif #endif
/*
* Because of kernel doing kmalloc for user data passed
* in SCM messages, and there is 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)
struct scm_fdset {
struct msghdr hdr;
struct iovec iov;
char msg_buf[CR_SCM_MSG_SIZE];
int msg; /* We are to send at least one byte */
};
extern int send_fd(int sock, struct sockaddr_un *saddr, int len, int fd); extern int send_fd(int sock, struct sockaddr_un *saddr, int len, int fd);
extern int recv_fd(int sock); extern int recv_fd(int sock);
#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