| OLD | NEW |
| 1 #include <sys/socket.h> | 1 #include <sys/socket.h> |
| 2 #include <fcntl.h> | 2 #include <fcntl.h> |
| 3 #include <errno.h> | 3 #include <errno.h> |
| 4 #include "syscall.h" | 4 #include "syscall.h" |
| 5 | 5 |
| 6 int socket(int domain, int type, int protocol) { | 6 int socket(int domain, int type, int protocol) { |
| 7 int s = socketcall(socket, domain, type, protocol, 0, 0, 0); | 7 int s = syscall(SYS_socket, domain, type, protocol, 0, 0, 0); |
| 8 if (s < 0 && (errno == EINVAL || errno == EPROTONOSUPPORT) && | 8 if (s < 0 && (errno == EINVAL || errno == EPROTONOSUPPORT) && |
| 9 (type & (SOCK_CLOEXEC | SOCK_NONBLOCK))) { | 9 (type & (SOCK_CLOEXEC | SOCK_NONBLOCK))) { |
| 10 s = socketcall(socket, domain, type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK), | 10 s = syscall(SYS_socket, domain, type & ~(SOCK_CLOEXEC | SOCK_NONBLOCK), |
| 11 protocol, 0, 0, 0); | 11 protocol, 0, 0, 0); |
| 12 if (s < 0) | 12 if (s < 0) |
| 13 return s; | 13 return s; |
| 14 if (type & SOCK_CLOEXEC) | 14 if (type & SOCK_CLOEXEC) |
| 15 __syscall(SYS_fcntl, s, F_SETFD, FD_CLOEXEC); | 15 __syscall(SYS_fcntl, s, F_SETFD, FD_CLOEXEC); |
| 16 if (type & SOCK_NONBLOCK) | 16 if (type & SOCK_NONBLOCK) |
| 17 __syscall(SYS_fcntl, s, F_SETFL, O_NONBLOCK); | 17 __syscall(SYS_fcntl, s, F_SETFL, O_NONBLOCK); |
| 18 } | 18 } |
| 19 return s; | 19 return s; |
| 20 } | 20 } |
| OLD | NEW |