1 #include <sys/socket.h>
6 int socket(int domain, int type, int protocol)
8 int s = socketcall(socket, domain, type, protocol, 0, 0, 0);
9 if (s<0 && errno==EINVAL && (type&(SOCK_CLOEXEC|SOCK_NONBLOCK))) {
10 s = socketcall(socket, domain,
11 type & ~(SOCK_CLOEXEC|SOCK_NONBLOCK),
14 if (type & SOCK_CLOEXEC)
15 fcntl(s, F_SETFD, FD_CLOEXEC);
16 if (type & SOCK_NONBLOCK)
17 fcntl(s, F_SETFL, fcntl(s, F_GETFL) | O_NONBLOCK);