about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRoland McGrath <roland@hack.frob.com>2013-08-27 10:32:30 -0700
committerRoland McGrath <roland@hack.frob.com>2013-08-27 10:32:30 -0700
commit8cc3269f95fa7faa8f448d741f68cbc40efbf4ee (patch)
tree40bc35ac079df256442f853f5d45486e8c86d246
parent45b8acccaf43ec06d31413c75a8f1737ae3ff0e2 (diff)
downloadglibc-8cc3269f95fa7faa8f448d741f68cbc40efbf4ee.tar.gz
glibc-8cc3269f95fa7faa8f448d741f68cbc40efbf4ee.tar.xz
glibc-8cc3269f95fa7faa8f448d741f68cbc40efbf4ee.zip
Flesh out 4.4 bits/socket.h with SOCK_CLOEXEC, SOCK_NONBLOCK.
-rw-r--r--ChangeLog6
-rw-r--r--sysdeps/unix/bsd/bsd4.4/bits/socket.h18
2 files changed, 23 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d9cf3780ff..d565a692b3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-08-27  Roland McGrath  <roland@hack.frob.com>
+
+	* sysdeps/unix/bsd/bsd4.4/bits/socket.h (enum __socket_type):
+	Add SOCK_CLOEXEC, SOCK_NONBLOCK with values from FreeBSD.
+	(SOCK_MAX, SOCK_TYPE_MASK): New macros.
+
 2013-08-27  Andreas Schwab  <schwab@suse.de>
 
 	[BZ #15736]
diff --git a/sysdeps/unix/bsd/bsd4.4/bits/socket.h b/sysdeps/unix/bsd/bsd4.4/bits/socket.h
index 849d2fc3e9..78c54a0f9e 100644
--- a/sysdeps/unix/bsd/bsd4.4/bits/socket.h
+++ b/sysdeps/unix/bsd/bsd4.4/bits/socket.h
@@ -50,9 +50,25 @@ enum __socket_type
 #define SOCK_RAW SOCK_RAW
   SOCK_RDM = 4,			/* Reliably-delivered messages.  */
 #define SOCK_RDM SOCK_RDM
-  SOCK_SEQPACKET = 5		/* Sequenced, reliable, connection-based,
+  SOCK_SEQPACKET = 5,		/* Sequenced, reliable, connection-based,
 				   datagrams of fixed maximum length.  */
 #define SOCK_SEQPACKET SOCK_SEQPACKET
+
+#define SOCK_MAX (SOCK_SEQPACKET + 1)
+  /* Mask which covers at least up to SOCK_MASK-1.
+     The remaining bits are used as flags. */
+#define SOCK_TYPE_MASK 0xf
+
+  /* Flags to be ORed into the type parameter of socket and socketpair and
+     used for the flags parameter of accept4.  */
+
+  SOCK_CLOEXEC = 0x10000000,	/* Atomically set close-on-exec flag for the
+				   new descriptor(s).  */
+#define SOCK_CLOEXEC SOCK_CLOEXEC
+
+  SOCK_NONBLOCK = 0x20000000	/* Atomically mark descriptor(s) as
+				   non-blocking.  */
+#define SOCK_NONBLOCK SOCK_NONBLOCK
 };
 
 /* Protocol families.  */