summaryrefslogtreecommitdiffstats
path: root/sys/sys/socket.h
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2014-08-31 01:42:36 +0000
committerguenther <guenther@openbsd.org>2014-08-31 01:42:36 +0000
commitb65639bd219b95b988677e8920af7a5b157bf154 (patch)
tree95e750bdd8bd7c588849acf13e4b9cb25704c49f /sys/sys/socket.h
parentFinally ``revert'' to the recent pexecute interface, now that we do not need (diff)
downloadwireguard-openbsd-b65639bd219b95b988677e8920af7a5b157bf154.tar.xz
wireguard-openbsd-b65639bd219b95b988677e8920af7a5b157bf154.zip
Add additional kernel interfaces for setting close-on-exec on fds
when creating them: pipe2(), dup3(), accept4(), MSG_CMSG_CLOEXEC, SOCK_CLOEXEC. Includes SOCK_NONBLOCK support. ok matthew@
Diffstat (limited to 'sys/sys/socket.h')
-rw-r--r--sys/sys/socket.h40
1 files changed, 28 insertions, 12 deletions
diff --git a/sys/sys/socket.h b/sys/sys/socket.h
index aca2e639de4..e1c89489844 100644
--- a/sys/sys/socket.h
+++ b/sys/sys/socket.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: socket.h,v 1.83 2013/04/02 03:38:24 guenther Exp $ */
+/* $OpenBSD: socket.h,v 1.84 2014/08/31 01:42:36 guenther Exp $ */
/* $NetBSD: socket.h,v 1.14 1996/02/09 18:25:36 christos Exp $ */
/*
@@ -81,6 +81,17 @@ typedef __ssize_t ssize_t;
#define SOCK_SEQPACKET 5 /* sequenced packet stream */
/*
+ * Socket creation flags
+ */
+#if __BSD_VISIBLE
+#define SOCK_CLOEXEC 0x8000 /* set FD_CLOEXEC */
+#define SOCK_NONBLOCK 0x4000 /* set O_NONBLOCK */
+#endif
+#ifdef _KERNEL
+#define SOCK_NONBLOCK_INHERIT 0x2000 /* inherit O_NONBLOCK from listener */
+#endif
+
+/*
* Option flags per-socket.
*/
#define SO_DEBUG 0x0001 /* turn on debugging info recording */
@@ -414,17 +425,18 @@ struct msghdr {
int msg_flags; /* flags on received message */
};
-#define MSG_OOB 0x1 /* process out-of-band data */
-#define MSG_PEEK 0x2 /* peek at incoming message */
-#define MSG_DONTROUTE 0x4 /* send without using routing tables */
-#define MSG_EOR 0x8 /* data completes record */
-#define MSG_TRUNC 0x10 /* data discarded before delivery */
-#define MSG_CTRUNC 0x20 /* control data lost before delivery */
-#define MSG_WAITALL 0x40 /* wait for full request or error */
-#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */
-#define MSG_BCAST 0x100 /* this message rec'd as broadcast */
-#define MSG_MCAST 0x200 /* this message rec'd as multicast */
-#define MSG_NOSIGNAL 0x400 /* do not send SIGPIPE */
+#define MSG_OOB 0x1 /* process out-of-band data */
+#define MSG_PEEK 0x2 /* peek at incoming message */
+#define MSG_DONTROUTE 0x4 /* send without using routing tables */
+#define MSG_EOR 0x8 /* data completes record */
+#define MSG_TRUNC 0x10 /* data discarded before delivery */
+#define MSG_CTRUNC 0x20 /* control data lost before delivery */
+#define MSG_WAITALL 0x40 /* wait for full request or error */
+#define MSG_DONTWAIT 0x80 /* this message should be nonblocking */
+#define MSG_BCAST 0x100 /* this message rec'd as broadcast */
+#define MSG_MCAST 0x200 /* this message rec'd as multicast */
+#define MSG_NOSIGNAL 0x400 /* do not send SIGPIPE */
+#define MSG_CMSG_CLOEXEC 0x800 /* set FD_CLOEXEC on received fds */
/*
* Header for ancillary data objects in msg_control buffer.
@@ -509,6 +521,10 @@ int socket(int, int, int);
int socketpair(int, int, int, int *);
#if __BSD_VISIBLE
+int accept4(int, struct sockaddr *__restrict, socklen_t *__restrict, int);
+#endif
+
+#if __BSD_VISIBLE
int getpeereid(int, uid_t *, gid_t *);
int getrtable(void);
int setrtable(int);