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:
committed by
Pavel Emelyanov
parent
5813cd0b55
commit
d360133fa6
@@ -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
|
||||
|
Reference in New Issue
Block a user