1 #define SOCKET_FLAGS_PRIV
3 #include <sys/socket.h>
5 #ifdef NEED_SOCKET_FLAGS
10 _socket(int domain, int type, int protocol)
12 int s = socket(domain, type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK), protocol);
17 if (type & SOCK_CLOEXEC) {
18 flags = fcntl(s, F_GETFD);
19 fcntl(s, F_SETFD, flags | FD_CLOEXEC);
22 if (type & SOCK_NONBLOCK) {
23 flags = fcntl(s, F_GETFL);
24 fcntl(s, F_SETFL, flags | O_NONBLOCK);