00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef FD_UTIL_H
00037 #define FD_UTIL_H
00038
00039 #include "check.h"
00040
00041 #include <stdbool.h>
00042 #include <stddef.h>
00043
00044 #ifndef WIN32
00045 #if !defined(_GNU_SOURCE) && (defined(HAVE_PIPE2) || defined(HAVE_ACCEPT4))
00046 #define _GNU_SOURCE
00047 #endif
00048
00049 #include <sys/types.h>
00050 #endif
00051
00052 struct sockaddr;
00053
00058 int
00059 dup_cloexec(int oldfd);
00060
00065 int
00066 open_cloexec(const char *path_fs, int flags, int mode);
00067
00072 int
00073 pipe_cloexec(int fd[2]);
00074
00082 int
00083 pipe_cloexec_nonblock(int fd[2]);
00084
00085 #ifndef WIN32
00086
00091 int
00092 socketpair_cloexec(int domain, int type, int protocol, int sv[2]);
00093
00098 int
00099 socketpair_cloexec_nonblock(int domain, int type, int protocol, int sv[2]);
00100
00101 #endif
00102
00107 int
00108 socket_cloexec_nonblock(int domain, int type, int protocol);
00109
00114 int
00115 accept_cloexec_nonblock(int fd, struct sockaddr *address,
00116 size_t *address_length_r);
00117
00118
00119 #ifndef WIN32
00120
00121 struct msghdr;
00122
00127 ssize_t
00128 recvmsg_cloexec(int sockfd, struct msghdr *msg, int flags);
00129
00130 #endif
00131
00132 #ifdef HAVE_INOTIFY_INIT
00133
00138 int
00139 inotify_init_cloexec(void);
00140
00141 #endif
00142
00146 int
00147 close_socket(int fd);
00148
00149 #endif