From 8c90be2a29053ac613dfe0c11a423da16c7c4520 Mon Sep 17 00:00:00 2001 From: Brent Cook Date: Sun, 13 Sep 2015 11:56:41 -0500 Subject: allow nc to build on linux and os x --- apps/nc/compat/sys/socket.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 apps/nc/compat/sys/socket.h (limited to 'apps/nc/compat/sys') 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 @@ +/* + * Public domain + * sys/socket.h compatibility shim + */ + +#ifndef _WIN32 +#include_next + +#if !defined(SOCK_NONBLOCK) || !defined(SOCK_CLOEXEC) +#define NEED_SOCKET_FLAGS +int _socket(int domain, int type, int protocol); +#ifndef SOCKET_FLAGS_PRIV +#define socket(d, t, p) _socket(d, t, p) +#endif +#endif + +#ifndef SOCK_NONBLOCK +#define SOCK_NONBLOCK 0x4000 /* set O_NONBLOCK */ +#endif + +#ifndef SOCK_CLOEXEC +#define SOCK_CLOEXEC 0x8000 /* set FD_CLOEXEC */ +#endif + +#ifndef HAVE_ACCEPT4 +int accept4(int s, struct sockaddr *addr, socklen_t *addrlen, int flags); +#endif + +#else +#include +#endif -- cgit v1.2.3-55-g6feb