aboutsummaryrefslogtreecommitdiff
path: root/apps/nc/compat/sys
diff options
context:
space:
mode:
Diffstat (limited to 'apps/nc/compat/sys')
-rw-r--r--apps/nc/compat/sys/socket.h31
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
11int _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
26int accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags);
27#endif
28
29#else
30#include <win32netcompat.h>
31#endif