diff options
author | Brent Cook <bcook@openbsd.org> | 2015-09-13 11:56:41 -0500 |
---|---|---|
committer | Brent Cook <bcook@openbsd.org> | 2015-09-13 18:42:15 -0500 |
commit | 8c90be2a29053ac613dfe0c11a423da16c7c4520 (patch) | |
tree | cf31a8e35cd9793f5f6f622b0ffcce61bbad8652 /apps/nc/compat/sys/socket.h | |
parent | 627b0261a81bb18ef95156baa37101ddcb14e356 (diff) | |
download | portable-8c90be2a29053ac613dfe0c11a423da16c7c4520.tar.gz portable-8c90be2a29053ac613dfe0c11a423da16c7c4520.tar.bz2 portable-8c90be2a29053ac613dfe0c11a423da16c7c4520.zip |
allow nc to build on linux and os x
Diffstat (limited to 'apps/nc/compat/sys/socket.h')
-rw-r--r-- | apps/nc/compat/sys/socket.h | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/apps/nc/compat/sys/socket.h b/apps/nc/compat/sys/socket.h new file mode 100644 index 0000000..13eb380 --- /dev/null +++ b/apps/nc/compat/sys/socket.h | |||
@@ -0,0 +1,31 @@ | |||
1 | /* | ||
2 | * Public domain | ||
3 | * sys/socket.h compatibility shim | ||
4 | */ | ||
5 | |||
6 | #ifndef _WIN32 | ||
7 | #include_next <sys/socket.h> | ||
8 | |||
9 | #if !defined(SOCK_NONBLOCK) || !defined(SOCK_CLOEXEC) | ||
10 | #define NEED_SOCKET_FLAGS | ||
11 | int _socket(int domain, int type, int protocol); | ||
12 | #ifndef SOCKET_FLAGS_PRIV | ||
13 | #define socket(d, t, p) _socket(d, t, p) | ||
14 | #endif | ||
15 | #endif | ||
16 | |||
17 | #ifndef SOCK_NONBLOCK | ||
18 | #define SOCK_NONBLOCK 0x4000 /* set O_NONBLOCK */ | ||
19 | #endif | ||
20 | |||
21 | #ifndef SOCK_CLOEXEC | ||
22 | #define SOCK_CLOEXEC 0x8000 /* set FD_CLOEXEC */ | ||
23 | #endif | ||
24 | |||
25 | #ifndef HAVE_ACCEPT4 | ||
26 | int accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags); | ||
27 | #endif | ||
28 | |||
29 | #else | ||
30 | #include <win32netcompat.h> | ||
31 | #endif | ||