From e557bab0dcaf35f003fa755b74e4c80000e05e42 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 9 Dec 2020 17:16:40 +0000 Subject: Get rid of webipc.h and DJBUNIX_FLAG_* Decent semantic header separation is hard. It's always an ongoing process. Here socket.h always included webipc.h for listen(), and webipc.h always included djbunix.h for socket_internal() and socketpair_internal(). That's ugh. Just move all the socket stuff into one socket header. Of course, djbunix.h is still needed most of the time for fd_close() and other operations on fds, but those are generic anyway. Also, O_CLOEXEC exists everywhere now, so we can use it as well as O_NONBLOCK instead of redefining the flags in djbunix.h. --- src/libstddjb/pipe_internal.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src/libstddjb/pipe_internal.c') diff --git a/src/libstddjb/pipe_internal.c b/src/libstddjb/pipe_internal.c index 598ab9c..dc7cfe6 100644 --- a/src/libstddjb/pipe_internal.c +++ b/src/libstddjb/pipe_internal.c @@ -6,26 +6,28 @@ #include #include -#include + #include int pipe_internal (int *p, unsigned int flags) { - return pipe2(p, ((flags & DJBUNIX_FLAG_COE) ? O_CLOEXEC : 0) | ((flags & DJBUNIX_FLAG_NB) ? O_NONBLOCK : 0)) ; + return pipe2(p, flags) ; } #else #include +#include + #include int pipe_internal (int *p, unsigned int flags) { int pi[2] ; if (pipe(pi) < 0) return -1 ; - if (flags & DJBUNIX_FLAG_COE) + if (flags & O_CLOEXEC) if ((coe(pi[0]) < 0) || (coe(pi[1]) < 0)) goto err ; - if (flags & DJBUNIX_FLAG_NB) + if (flags & O_NONBLOCK) if ((ndelay_on(pi[0]) < 0) || (ndelay_on(pi[1]) < 0)) goto err ; p[0] = pi[0] ; p[1] = pi[1] ; return 0 ; -- cgit v1.3.1