From 67d0fd64d0e1fea6dc455c3c7521137b91da9377 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Wed, 6 Jul 2016 20:30:05 +0200
Subject: [PATCH] WIP versions

---
 include/unistd.h | 19 ++++++++-----------
 sys/sys/unistd.h | 46 ++++++++++++++++++++++++++--------------------
 2 files changed, 34 insertions(+), 31 deletions(-)

diff --git a/include/unistd.h b/include/unistd.h
index 6f01a82..ee2b03a 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -97,22 +97,22 @@ typedef	__uint32_t	uid_t;		/* XXX __uid_t */
  * the POSIX standard; however, if the relevant sysconf() function
  * returns -1, the functions may be stubbed out.
  */
-#define	_POSIX_READER_WRITER_LOCKS	200112L
+#define	_POSIX_READER_WRITER_LOCKS	200809L
 #define	_POSIX_REGEXP			1	/* mandatory */
 #define	_POSIX_SHELL			1	/* mandatory */
-#define	_POSIX_SPAWN			200112L	/* [SPN] */
-#define	_POSIX_THREAD_ATTR_STACKADDR	200112L	/* [TSA] */
-#define	_POSIX_THREAD_ATTR_STACKSIZE	200112L	/* [TSS] */
+#define	_POSIX_SPAWN			200809L	/* [SPN] */
+#define	_POSIX_THREAD_ATTR_STACKADDR	200809L	/* [TSA] */
+#define	_POSIX_THREAD_ATTR_STACKSIZE	200809L	/* [TSS] */
 #define	_POSIX_THREAD_CPUTIME		-1	/* [TCT] */
-#define	_POSIX_THREAD_PRIO_INHERIT	200112L	/* [TPI] */
-#define	_POSIX_THREAD_PRIO_PROTECT	200112L	/* [TPP] */
-#define	_POSIX_THREAD_PRIORITY_SCHEDULING 200112L /* [TPS] */
+#define	_POSIX_THREAD_PRIO_INHERIT	200809L	/* [TPI] */
+#define	_POSIX_THREAD_PRIO_PROTECT	200809L	/* [TPP] */
+#define	_POSIX_THREAD_PRIORITY_SCHEDULING 200809L /* [TPS] */
 #define	_POSIX_THREAD_PROCESS_SHARED	-1	/* [TSH] */
 #define	_POSIX_THREAD_ROBUST_PRIO_INHERIT -1	/* [RPI] */
 #define	_POSIX_THREAD_ROBUST_PRIO_PROTECT -1	/* [RPP] */
 #define	_POSIX_THREAD_SAFE_FUNCTIONS	-1
 #define	_POSIX_THREAD_SPORADIC_SERVER	-1	/* [TSP] */
-#define	_POSIX_THREADS			200112L
+#define	_POSIX_THREADS			200809L
 #define	_POSIX_TRACE			-1	/* [TRC] obsolescent */
 #define	_POSIX_TRACE_EVENT_FILTER	-1	/* [TEF] obsolescent */
 #define	_POSIX_TRACE_INHERIT		-1	/* [TRI] obsolescent */
@@ -152,9 +152,6 @@ typedef	__uint32_t	uid_t;		/* XXX __uid_t */
 #define	_XOPEN_UNIX			-1
 #endif
 
-/* Define the POSIX.2 version we target for compliance. */
-#define	_POSIX2_VERSION		199212L
-
 /*
  * POSIX-style system configuration variable accessors (for the
  * sysconf function).  The kernel does not directly implement the
diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h
index e56c890..dadd747 100644
--- a/sys/sys/unistd.h
+++ b/sys/sys/unistd.h
@@ -36,6 +36,17 @@
 #include <sys/cdefs.h>
 #include <sys/types.h>
 
+/* Define the POSIX.1, POSIX.2 and XPG versions we target for compliance. */
+#ifndef _POSIX_VERSION
+#define	_POSIX_VERSION		200809L
+#endif
+#ifndef _POSIX2_VERSION
+#define	_POSIX2_VERSION		200809L
+#endif
+#ifndef _XOPEN_VERSION
+#define	_XOPEN_VERSION		700
+#endif
+
 /*
  * POSIX options and option groups we unconditionally do or don't
  * implement.  Those options which are implemented (or not) entirely
@@ -52,31 +63,31 @@
  */
 #define	_POSIX_ADVISORY_INFO		-1	/* [ADV] */
 #define	_POSIX_ASYNCHRONOUS_IO		0	/* mandatory */
-#define	_POSIX_BARRIERS			200112L	/* mandatory */
+#define	_POSIX_BARRIERS			200809L	/* mandatory */
 #define	_POSIX_CHOWN_RESTRICTED		1
 #define	_POSIX_CLOCK_SELECTION		-1	/* XXX mandatory */
 #define	_POSIX_CPUTIME			-1	/* [CPT] */
-#define	_POSIX_FSYNC			200112L	/* [FSC] */
+#define	_POSIX_FSYNC			200809L	/* [FSC] */
 #define	_POSIX_IPV6			0
 #define	_POSIX_JOB_CONTROL		1	/* mandatory */
-#define	_POSIX_MAPPED_FILES		200112L	/* mandatory */
+#define	_POSIX_MAPPED_FILES		200809L	/* mandatory */
 #define	_POSIX_MEMLOCK			-1	/* [ML] */
-#define	_POSIX_MEMLOCK_RANGE		200112L	/* [MLR] */
-#define	_POSIX_MEMORY_PROTECTION	200112L	/* mandatory */
-#define	_POSIX_MESSAGE_PASSING		200112L	/* [MSG] */
-#define	_POSIX_MONOTONIC_CLOCK		200112L	/* [MON] */
+#define	_POSIX_MEMLOCK_RANGE		200809L	/* [MLR] */
+#define	_POSIX_MEMORY_PROTECTION	200809L	/* mandatory */
+#define	_POSIX_MESSAGE_PASSING		200809L	/* [MSG] */
+#define	_POSIX_MONOTONIC_CLOCK		200809L	/* [MON] */
 #define	_POSIX_NO_TRUNC			1
 #define	_POSIX_PRIORITIZED_IO		-1	/* [PIO] */
-#define	_POSIX_PRIORITY_SCHEDULING	200112L	/* [PS] */
-#define	_POSIX_RAW_SOCKETS		200112L	/* [RS] */
-#define	_POSIX_REALTIME_SIGNALS		200112L	/* mandatory */
-#define	_POSIX_SEMAPHORES		200112L	/* mandatory */
-#define	_POSIX_SHARED_MEMORY_OBJECTS	200112L	/* [SHM] */
-#define	_POSIX_SPIN_LOCKS		200112L	/* mandatory */
+#define	_POSIX_PRIORITY_SCHEDULING	200809L	/* [PS] */
+#define	_POSIX_RAW_SOCKETS		200809L	/* [RS] */
+#define	_POSIX_REALTIME_SIGNALS		200809L	/* mandatory */
+#define	_POSIX_SEMAPHORES		200809L	/* mandatory */
+#define	_POSIX_SHARED_MEMORY_OBJECTS	200809L	/* [SHM] */
+#define	_POSIX_SPIN_LOCKS		200809L	/* mandatory */
 #define	_POSIX_SPORADIC_SERVER		-1	/* [SS] */
 #define	_POSIX_SYNCHRONIZED_IO		-1	/* [SIO] */
-#define	_POSIX_TIMEOUTS			200112L	/* mandatory */
-#define	_POSIX_TIMERS			200112L	/* mandatory */
+#define	_POSIX_TIMEOUTS			200809L	/* mandatory */
+#define	_POSIX_TIMERS			200809L	/* mandatory */
 #define	_POSIX_TYPED_MEMORY_OBJECTS	-1	/* [TYM] */
 #define	_POSIX_VDISABLE			0xff
 
@@ -97,11 +108,6 @@
 #define	_POSIX_SAVED_IDS	1 /* saved set-user-ID and set-group-ID */
 #endif
 
-/* Define the POSIX.1 version we target for compliance. */
-#ifndef _POSIX_VERSION
-#define	_POSIX_VERSION		200112L
-#endif
-
 /* access function */
 #define	F_OK		0	/* test for existence of file */
 #define	X_OK		0x01	/* test for execute or search permission */
-- 
2.9.2

