From f66edccffdc4a9276ae9dced69fa6fb74ee1f97e Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 8 Nov 2009 22:11:35 +0100 Subject: fd_util: added O_NONBLOCK functions Changed the wrappers for pipe(), socket(), accept(). On WIN32, this does not work for pipe(). --- src/fd_util.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/fd_util.h') diff --git a/src/fd_util.h b/src/fd_util.h index 2dfc151f..d9e811d5 100644 --- a/src/fd_util.h +++ b/src/fd_util.h @@ -49,23 +49,27 @@ creat_cloexec(const char *path_fs, int mode); /** * Wrapper for pipe(), which sets the CLOEXEC flag (atomically if * supported by the OS). + * + * On systems that supports it (everybody except for Windows), it also + * sets the NONBLOCK flag. */ int -pipe_cloexec(int fd[2]); +pipe_cloexec_nonblock(int fd[2]); /** - * Wrapper for socket(), which sets the CLOEXEC flag (atomically if - * supported by the OS). + * Wrapper for socket(), which sets the CLOEXEC and the NONBLOCK flag + * (atomically if supported by the OS). */ int -socket_cloexec(int domain, int type, int protocol); +socket_cloexec_nonblock(int domain, int type, int protocol); /** - * Wrapper for accept(), which sets the CLOEXEC flag (atomically if - * supported by the OS). + * Wrapper for accept(), which sets the CLOEXEC and the NONBLOCK flags + * (atomically if supported by the OS). */ int -accept_cloexec(int fd, struct sockaddr *address, size_t *address_length_r); +accept_cloexec_nonblock(int fd, struct sockaddr *address, + size_t *address_length_r); /** * Wrapper for inotify_init(), which sets the CLOEXEC flag (atomically -- cgit v1.2.3