2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-09-04 08:15:37 +00:00

util-net: Itroduce send_fds/recv_fds routines

We will need these helpers to transfer file
descriptors from dumpee to our space.

Also make send_fd/recv_fd to be a wrappers over
send_fds/revc_fds to not duplicate the code.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Cyrill Gorcunov
2012-03-28 23:44:00 +04:00
committed by Pavel Emelyanov
parent 5813cd0b55
commit d360133fa6
2 changed files with 61 additions and 15 deletions

View File

@@ -28,6 +28,23 @@ struct scm_fdset {
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 recv_fd(int sock);
extern int send_fds(int sock, struct sockaddr_un *saddr, int saddr_len, int *fds, int nr_fds);
extern int recv_fds(int sock, int *fds, int nr_fds);
static inline int send_fd(int sock, struct sockaddr_un *saddr, int saddr_len, int fd)
{
return send_fds(sock, saddr, saddr_len, &fd, 1);
}
static inline int recv_fd(int sock)
{
int fd, ret;
ret = recv_fds(sock, &fd, 1);
if (ret)
return -1;
return fd;
}
#endif