Skip to contentSkip to conversation

compat.h: Add SOCK_CLOEXEC and SOCK_NONBLOCK for older glibc.

PATCH New Vinson Lee 1 participant 1 message Aug 22, 2013

lore
Share & tools
lore

Vinson Lee

author
#0 lore raw

PATCH 1/1 compat.h: Add SOCK_CLOEXEC and SOCK_NONBLOCK for older glibc.

From: Vinson Lee <[email protected]>

This patch fixes these build errors with glibc before 2.9.

syscalls/socket.c: In function ‘gen_socket_args’:
syscalls/socket.c:82: error: ‘SOCK_CLOEXEC’ undeclared (first use in this function) syscalls/socket.c:82: error: (Each undeclared identifier is reported only once syscalls/socket.c:82: error: for each function it appears in.) syscalls/socket.c:84: error: ‘SOCK_NONBLOCK’ undeclared (first use in this function)

---
 include/compat.h |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
include/compat.h +8 -0
index fe5d0c7..ae57fcb 100644
@@ -93,6 +93,14 @@ enum {
 
 
 /* bits/socket.h */
+#ifndef SOCK_CLOEXEC
+#define SOCK_CLOEXEC	02000000
+#endif
+
+#ifndef SOCK_NONBLOCK
+#define SOCK_NONBLOCK	04000
+#endif
+
 #ifndef PF_RDS
 #define PF_RDS		21
 #endif
Signature · 1 line
1.7.4.1