From 23bdcb4ad4ef19d99b729e5282fd15df6300a3b5 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Sun, 21 Dec 2014 00:26:40 +0000 Subject: So the non-portable MSG_DONTWAIT may alleviate the problem... might as well use it on architectures that support it. --- src/libunixonacid/unixmessage_receive.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'src/libunixonacid/unixmessage_receive.c') diff --git a/src/libunixonacid/unixmessage_receive.c b/src/libunixonacid/unixmessage_receive.c index 502b523..5c80082 100644 --- a/src/libunixonacid/unixmessage_receive.c +++ b/src/libunixonacid/unixmessage_receive.c @@ -14,19 +14,18 @@ #include #include -#ifdef SKALIBS_HASOKWAITALL -# ifdef SKALIBS_HASCMSGCLOEXEC -# define RECV(fd, hdr) recvmsg(fd, (hdr), MSG_WAITALL | MSG_CMSG_CLOEXEC) -# else -# define RECV(fd, hdr) recvmsg(fd, (hdr), MSG_WAITALL) -# endif +static int const awesomeflags = +#ifdef SKALIBS_HASMSGDONTWAIT + MSG_WAITALL | MSG_DONTWAIT +#elif defined (SKALIBS_HASNBWAITALL) + MSG_WAITALL #else -# ifdef SKALIBS_HASCMSGCLOEXEC -# define RECV(fd, hdr) recvmsg(fd, (hdr), MSG_CMSG_CLOEXEC) -# else -# define RECV(fd, hdr) recvmsg(fd, (hdr), 0) -# endif + 0 #endif +#ifdef SKALIBS_HASCMSGCLOEXEC + | MSG_CMSG_CLOEXEC +#endif + ; static int unixmessage_receiver_fill (unixmessage_receiver_t *b) { @@ -51,7 +50,7 @@ static int unixmessage_receiver_fill (unixmessage_receiver_t *b) cbuffer_wpeek(&b->mainb, v) ; iovec_from_siovec(iov, v, 2) ; } - r = RECV(b->fd, &msghdr) ; + r = recvmsg(b->fd, &msghdr, awesomeflags) ; if (r <= 0) return r ; { struct cmsghdr *c = CMSG_FIRSTHDR(&msghdr) ; -- cgit v1.2.3