summaryrefslogtreecommitdiffstats
path: root/if.h
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2016-03-11 13:44:42 +0000
committerRoy Marples <roy@marples.name>2016-03-11 13:44:42 +0000
commit9843976ae092495eb37e397a6f36432411010d00 (patch)
tree00d8f2d78a39057a42d2d9666c2f3e9d82639b5c /if.h
parentb48c14b7363ef246351f18458eb9a1657871f69a (diff)
downloaddhcpcd-9843976ae092495eb37e397a6f36432411010d00.tar.xz
Fix compile on older platforms which lack O_CLOEXEC.
Thanks to OBATA Akio.
Diffstat (limited to 'if.h')
-rw-r--r--if.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/if.h b/if.h
index 379a5a94..62de36f3 100644
--- a/if.h
+++ b/if.h
@@ -114,6 +114,19 @@ int if_managelink(struct dhcpcd_ctx *);
#define RTM_GET 0x4 /* Report Metrics */
#endif
+/* Define SOCK_CLOEXEC and SOCK_NONBLOCK for systems that lack it.
+ * xsocket() in if.c will map them to fctnl FD_CLOEXEC and O_NONBLOCK. */
+#ifdef SOCK_CLOEXEC
+# define HAVE_SOCK_CLOEXEC
+#else
+# define SOCK_CLOEXEC 0x10000000
+#endif
+#ifdef SOCK_NONBLOCK
+# define HAVE_SOCK_NONBLOCK
+#else
+# define SOCK_NONBLOCK 0x20000000
+#endif
+
#ifdef INET
extern const char *if_pfname;
int if_openrawsocket(struct interface *, uint16_t);