2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 13:28:27 +00:00

scm: Allow to pass flags argument to recv_fds()

This will be used to pass MSG_DONTWAIT in next patch.

Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Kirill Tkhai 2017-01-25 12:46:28 +03:00 committed by Pavel Emelyanov
parent 6a3cfcd550
commit d3ea14a125
2 changed files with 9 additions and 4 deletions

View File

@ -75,7 +75,7 @@ int send_fds(int sock, struct sockaddr_un *saddr, int len,
return 0;
}
int recv_fds(int sock, int *fds, int nr_fds, void *data, unsigned ch_size)
int __recv_fds(int sock, int *fds, int nr_fds, void *data, unsigned ch_size, int flags)
{
struct scm_fdset fdset;
struct cmsghdr *cmsg;
@ -88,7 +88,7 @@ int recv_fds(int sock, int *fds, int nr_fds, void *data, unsigned ch_size)
min_fd = min(CR_SCM_MAX_FD, nr_fds - i);
scm_fdset_init_chunk(&fdset, min_fd, data, ch_size);
ret = __sys(recvmsg)(sock, &fdset.hdr, 0);
ret = __sys(recvmsg)(sock, &fdset.hdr, flags);
if (ret <= 0)
return ret ? __sys_err(ret) : -ENOMSG;

View File

@ -27,8 +27,13 @@ struct scm_fdset {
extern int send_fds(int sock, struct sockaddr_un *saddr, int len,
int *fds, int nr_fds, void *data, unsigned ch_size);
extern int recv_fds(int sock, int *fds, int nr_fds,
void *data, unsigned ch_size);
extern int __recv_fds(int sock, int *fds, int nr_fds,
void *data, unsigned ch_size, int flags);
static inline int recv_fds(int sock, int *fds, int nr_fds,
void *data, unsigned ch_size)
{
return __recv_fds(sock, fds, nr_fds, data, ch_size, 0);
}
static inline int send_fd(int sock, struct sockaddr_un *saddr, int saddr_len, int fd)
{