summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2014-12-21 01:43:39 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2014-12-21 01:43:39 +0000
commit31009f586a04251df0fb5853017ecfcaf70b307f (patch)
tree55848e7a769cfa4134c80933ed9527c11bfe44c0 /src
parent4557dacfbe04206c57e459b734016d2b6edfe7f3 (diff)
downloadskalibs-31009f586a04251df0fb5853017ecfcaf70b307f.tar.xz
So MSG_WAITALL can block even with MSG_DONTWAIT... wtfbsdseriously.
Only include MSG_WAITALL when it's tested nb, then. Also test yet another fix for the tryancilautoclose FreeBSD problem.
Diffstat (limited to 'src')
-rw-r--r--src/libunixonacid/unixmessage_receive.c13
-rw-r--r--src/libunixonacid/unixmessage_sender_flush.c3
-rw-r--r--src/sysdeps/tryancilautoclose.c19
3 files changed, 19 insertions, 16 deletions
diff --git a/src/libunixonacid/unixmessage_receive.c b/src/libunixonacid/unixmessage_receive.c
index 5c80082..d25195b 100644
--- a/src/libunixonacid/unixmessage_receive.c
+++ b/src/libunixonacid/unixmessage_receive.c
@@ -16,14 +16,21 @@
static int const awesomeflags =
#ifdef SKALIBS_HASMSGDONTWAIT
- MSG_WAITALL | MSG_DONTWAIT
-#elif defined (SKALIBS_HASNBWAITALL)
+ MSG_DONTWAIT
+#else
+ 0
+#endif
+ |
+#ifdef SKALIBS_HASNBWAITALL
MSG_WAITALL
#else
0
#endif
+ |
#ifdef SKALIBS_HASCMSGCLOEXEC
- | MSG_CMSG_CLOEXEC
+ MSG_CMSG_CLOEXEC
+#else
+ 0
#endif
;
diff --git a/src/libunixonacid/unixmessage_sender_flush.c b/src/libunixonacid/unixmessage_sender_flush.c
index 5c5ad2b..a115c58 100644
--- a/src/libunixonacid/unixmessage_sender_flush.c
+++ b/src/libunixonacid/unixmessage_sender_flush.c
@@ -1,6 +1,9 @@
/* ISC license. */
+#ifndef _XPG4_2
#define _XPG4_2
+#endif
+
#include <skalibs/sysdeps.h>
#include <skalibs/nonposix.h>
#include <sys/socket.h>
diff --git a/src/sysdeps/tryancilautoclose.c b/src/sysdeps/tryancilautoclose.c
index 53b768d..d0a2833 100644
--- a/src/sysdeps/tryancilautoclose.c
+++ b/src/sysdeps/tryancilautoclose.c
@@ -21,16 +21,9 @@
# include <sys/param.h>
#endif
-typedef struct ancilbuf_s ancilbuf_t, *ancilbuf_t_ref ;
-struct ancilbuf_s
-{
- struct cmsghdr h ;
- int fd ;
-} ;
-
static int ancil_send_fd (int sock, int fd)
{
- ancilbuf_t buf ;
+ char ancilbuf[CMSG_SPACE(sizeof(int))] ;
char s[8] = "blahblah" ;
struct iovec v = { .iov_base = s, .iov_len = 8 } ;
struct msghdr msghdr =
@@ -40,8 +33,8 @@ static int ancil_send_fd (int sock, int fd)
.msg_iov = &v,
.msg_iovlen = 1,
.msg_flags = 0,
- .msg_control = &buf,
- .msg_controllen = sizeof(ancilbuf_t)
+ .msg_control = ancilbuf,
+ .msg_controllen = sizeof(ancilbuf)
} ;
struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msghdr) ;
cmsg->cmsg_len = msghdr.msg_controllen ;
@@ -54,7 +47,7 @@ static int ancil_send_fd (int sock, int fd)
static int ancil_recv_fd (int sock)
{
- ancilbuf_t buf ;
+ char ancilbuf[CMSG_SPACE(sizeof(int))] ;
char s[8] ;
struct iovec v = { .iov_base = s, .iov_len = 8 } ;
struct msghdr msghdr =
@@ -64,8 +57,8 @@ static int ancil_recv_fd (int sock)
.msg_iov = &v,
.msg_iovlen = 1,
.msg_flags = 0,
- .msg_control = &buf,
- .msg_controllen = sizeof(ancilbuf_t)
+ .msg_control = ancilbuf,
+ .msg_controllen = sizeof(ancilbuf)
} ;
struct cmsghdr *cmsg = CMSG_FIRSTHDR(&msghdr) ;
cmsg->cmsg_len = msghdr.msg_controllen ;