Commit d3ea14a1 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Pavel Emelyanov

scm: Allow to pass flags argument to recv_fds()

This will be used to pass MSG_DONTWAIT in next patch.
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 6a3cfcd5
......@@ -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;
......
......@@ -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)
{
......
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