aboutsummaryrefslogtreecommitdiff
path: root/sys/sys
diff options
context:
space:
mode:
authorPeter Dufault <dufault@FreeBSD.org>1998-03-08 17:25:38 +0000
committerPeter Dufault <dufault@FreeBSD.org>1998-03-08 17:25:38 +0000
commitaac4ad2c994742defc0623bd489206743241552c (patch)
tree0dff9523762d4433c9265778cf79490f9378d188 /sys/sys
parentaac18d035f1c8256522613d417dc9ae2731641ec (diff)
downloadsrc-aac4ad2c994742defc0623bd489206743241552c.tar.gz
src-aac4ad2c994742defc0623bd489206743241552c.zip
Reviewed by: bde
Changes to support building with _POSIX_SOURCE set to 199309L: 1. Add sys/_posix.h to handle those preprocessor defs that POSIX says have effects when defined before including any header files; 2. Change POSIX4_VISIBLE back to _POSIX4_VISIBLE 3. Add _POSIX4_VISIBLE_HISTORICALLY for pre-existing BSD features now defined in POSIX. These show up when: _POSIX_SOURCE and _POSIX_C_SOURCE are not set or _POSIX_C_SOURCE is set >= 199309L and vanish when: _POSIX_SOURCE is set or _POSIX_C_SOURCE is < 199309L. 4. Explain these in man 9 posix4; 5. Include _posix.h and conditionalize on new feature test.
Notes
Notes: svn path=/head/; revision=34319
Diffstat (limited to 'sys/sys')
-rw-r--r--sys/sys/_posix.h73
-rw-r--r--sys/sys/aio.h36
-rw-r--r--sys/sys/mman.h12
-rw-r--r--sys/sys/posix4.h18
-rw-r--r--sys/sys/rtprio.h13
-rw-r--r--sys/sys/semaphore.h4
-rw-r--r--sys/sys/unistd.h45
7 files changed, 96 insertions, 105 deletions
diff --git a/sys/sys/_posix.h b/sys/sys/_posix.h
new file mode 100644
index 000000000000..daf4fe2814e2
--- /dev/null
+++ b/sys/sys/_posix.h
@@ -0,0 +1,73 @@
+#ifndef _SYS__POSIX_H_
+#define _SYS__POSIX_H_
+
+/*-
+ * Copyright (c) 1998 HD Associates, Inc.
+ * All rights reserved.
+ * contact: dufault@hda.com
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id: $
+ */
+
+/*
+ * This is a stand alone header file to set up for feature specification
+ * defined to take place before the inclusion of any standard header.
+ * It should only handle pre-processor defines.
+ *
+ * See section B.2.7 of 1003.1b-1993
+ *
+ */
+
+#ifndef _POSIX_VERSION
+#define _POSIX_VERSION 199009L
+#endif
+
+/* Test for visibility of pre-existing POSIX.4 features that should really
+ * be conditional. If _POSIX_C_SOURCE and _POSIX_SOURCE are not
+ * defined then permit the pre-existing features to show up:
+ */
+#if !defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
+#define _POSIX4_VISIBLE_HISTORICALLY
+#endif
+
+/* Test for visibility of additional POSIX.4 features:
+ */
+#if _POSIX_VERSION >= 199309L && \
+ (!defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE >= 199309L)
+#define _POSIX4_VISIBLE
+#define _POSIX4_VISIBLE_HISTORICALLY
+#endif
+
+/* I'm not sure if I'm allowed to do this, but at least initially
+ * it may catch some teething problems:
+ */
+
+#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE > _POSIX_VERSION)
+#error _POSIX_C_SOURCE > _POSIX_VERSION
+#endif
+
+#define POSIX4_VISIBLE You missed the leading _!!
+#define POSIX4_VISIBLE_FORCEABLY You left the old define in the code!!
+
+#endif /* _SYS__POSIX_H_ */
diff --git a/sys/sys/aio.h b/sys/sys/aio.h
index 4b1604b404a5..09627da41789 100644
--- a/sys/sys/aio.h
+++ b/sys/sys/aio.h
@@ -16,40 +16,11 @@
* bad that happens because of using this software isn't the responsibility
* of the author. This software is distributed AS-IS.
*
- * $Id: aio.h,v 1.2 1997/07/17 04:49:43 dyson Exp $
+ * $Id: aio.h,v 1.3 1997/12/08 02:18:14 dyson Exp $
*/
#include <sys/types.h>
-/**************************************************************************/
-/* Additions to signal.h -- hack alert. */
-/**************************************************************************/
-/*
- * sigval structure:
- */
-union sigval {
- int sival_int;
- void *sival_ptr;
-};
-
-/*
- * this is the sigevent structure:
- */
-struct sigevent {
- int sigev_notify; /* Notification */
- int sigev_signo; /* Signal number */
- union sigval sigev_value; /* Not used yet in FreeBSD */
-};
-
-/*
- * values for sigev_notify:
- */
-#define SIGEV_NONE 0 /* Don't post a signal */
-#define SIGEV_SIGNAL 1 /* Post specified signal */
-
-/**************************************************************************/
-/* Actual AIO header */
-/**************************************************************************/
/*
* Returned by aio_cancel:
* (Note that FreeBSD's aio is not cancellable -- yet.)
@@ -72,11 +43,6 @@ struct sigevent {
#define LIO_WAIT 0x1
/*
- * Maximum number of allowed LIO operations
- */
-#define AIO_LISTIO_MAX 16
-
-/*
* Private mode bit for aio.
* (This bit is set by the library routine
* to allow the kernel to support sync
diff --git a/sys/sys/mman.h b/sys/sys/mman.h
index f0b609f3ea71..764ef357b96b 100644
--- a/sys/sys/mman.h
+++ b/sys/sys/mman.h
@@ -31,12 +31,14 @@
* SUCH DAMAGE.
*
* @(#)mman.h 8.2 (Berkeley) 1/9/95
- * $Id: mman.h,v 1.20 1997/12/31 01:22:00 alex Exp $
+ * $Id: mman.h,v 1.21 1998/03/04 10:26:35 dufault Exp $
*/
#ifndef _SYS_MMAN_H_
#define _SYS_MMAN_H_
+#include <sys/_posix.h>
+
/*
* Protections are chosen from these bits, or-ed together
*/
@@ -63,14 +65,14 @@
#define MAP_NOEXTEND 0x0100 /* for MAP_FILE, don't change file size */
#define MAP_HASSEMAPHORE 0x0200 /* region may contain semaphores */
-#ifdef POSIX4_VISIBLE
+#ifdef _POSIX4_VISIBLE
/*
* Process memory locking
*/
#define MCL_CURRENT 0x0001 /* Lock only current memory */
#define MCL_FUTURE 0x0002 /* Lock all future memory as well */
-#endif /* POSIX4_VISIBLE */
+#endif /* _POSIX4_VISIBLE */
/*
* Error return from mmap()
@@ -115,12 +117,12 @@
#include <sys/cdefs.h>
__BEGIN_DECLS
-#ifdef POSIX4_VISIBLE
+#ifdef _POSIX4_VISIBLE
int mlockall __P((int));
int munlockall __P((void));
int shm_open __P((const char *, int, mode_t));
int shm_unlink __P((const char *));
-#endif /* POSIX4_VISIBLE */
+#endif /* _POSIX4_VISIBLE */
int mlock __P((const void *, size_t));
#ifndef _MMAP_DECLARED
#define _MMAP_DECLARED
diff --git a/sys/sys/posix4.h b/sys/sys/posix4.h
index 5037b03bbd7e..99ba8822a2b0 100644
--- a/sys/sys/posix4.h
+++ b/sys/sys/posix4.h
@@ -33,22 +33,14 @@
*
*/
-#if defined(_POSIX_VERSION) && _POSIX_VERSION >= 199309L
+#include <sys/_posix.h>
+
+#ifdef _POSIX4_VISIBLE
+
#include <sys/param.h>
#include <sys/ioccom.h>
#include <sched.h>
-/*
- * This defines POSIX4_VISIBLE to indicate posix4 extensions should show up.
- * You should test this when you add a posix4 extension to a header
- * that exists in POSIX.1. Try "man 9 posix4".
- */
-
-#if !defined(_POSIX_C_SOURCE) || \
- defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309L
-#define POSIX4_VISIBLE
-#endif
-
/*
*
* March 1, 1998: Details from here on change and this header file
@@ -296,5 +288,5 @@ int kmunlock(int *, void *, const void *, size_t );
{ "timer_max", CTLTYPE_INT }, \
}
-#endif /* _POSIX_VERSION >= 199309L */
+#endif /* _POSIX4_VISIBLE */
#endif /* _POSIX4_POSIX4_H_ */
diff --git a/sys/sys/rtprio.h b/sys/sys/rtprio.h
index 5b6830def121..c4a031ce999b 100644
--- a/sys/sys/rtprio.h
+++ b/sys/sys/rtprio.h
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: rtprio.h,v 1.4 1997/02/22 09:45:48 peter Exp $
+ * $Id: rtprio.h,v 1.5 1998/03/04 10:26:39 dufault Exp $
*/
#ifndef _SYS_RTPRIO_H_
@@ -44,23 +44,14 @@
#define RTP_PRIO_NORMAL 1
#define RTP_PRIO_IDLE 2
-/* RTP_PRIO_FIFO is Posix 4 SCHED_FIFO.
- * Careful: These are based on the kernel config POSIX4 and not
- * the compile time test _POSIX_PRIORITY_SCHEDULING since they
- * set the behavior of the system.
+/* RTP_PRIO_FIFO is POSIX.4 SCHED_FIFO.
*/
-#ifdef POSIX4
#define RTP_PRIO_FIFO_BIT 4
#define RTP_PRIO_FIFO (RTP_PRIO_REALTIME | RTP_PRIO_FIFO_BIT)
#define RTP_PRIO_BASE(P) ((P) & ~RTP_PRIO_FIFO_BIT)
#define RTP_PRIO_IS_REALTIME(P) (RTP_PRIO_BASE(P) == RTP_PRIO_REALTIME)
#define RTP_PRIO_NEED_RR(P) ((P) != RTP_PRIO_FIFO)
-#else
-#define RTP_PRIO_BASE(P) (P)
-#define RTP_PRIO_IS_REALTIME(P) (P == RTP_PRIO_REALTIME)
-#define RTP_PRIO_NEED_RR(P) (1)
-#endif
/* priority range */
#define RTP_PRIO_MIN 0 /* Highest priority */
diff --git a/sys/sys/semaphore.h b/sys/sys/semaphore.h
index fbcab1312593..a24ac35180e5 100644
--- a/sys/sys/semaphore.h
+++ b/sys/sys/semaphore.h
@@ -36,7 +36,7 @@
*
*/
-#ifdef POSIX4_INCLUDE_MAYBES
+#ifdef _POSIX4_INCLUDE_MAYBES
#include <sys/types.h>
#include <fcntl.h>
#endif
@@ -46,6 +46,7 @@ typedef int sem_t;
#ifndef KERNEL
#include <sys/cdefs.h>
+__BEGIN_DECLS
int sem_init __P(sem_t *, int, unsigned int));
int sem_destroy __P((sem_t *));
sem_t sem_open __P((const char *, int, ...));
@@ -55,6 +56,7 @@ int sem_wait((sem_t *));
int sem_trywait((sem_t *));
int sem_post((sem_t *));
int sem_getvalue((sem_t *, int *));
+__END_DECLS
#endif /* KERNEL */
diff --git a/sys/sys/unistd.h b/sys/sys/unistd.h
index e31a7d3d7384..9ac2c03c4ae4 100644
--- a/sys/sys/unistd.h
+++ b/sys/sys/unistd.h
@@ -31,12 +31,14 @@
* SUCH DAMAGE.
*
* @(#)unistd.h 8.2 (Berkeley) 1/7/94
- * $Id: unistd.h,v 1.14 1997/06/16 00:29:26 dyson Exp $
+ * $Id: unistd.h,v 1.15 1998/03/04 10:26:46 dufault Exp $
*/
#ifndef _SYS_UNISTD_H_
#define _SYS_UNISTD_H_
+#include <sys/_posix.h>
+
/* compile-time symbolic constants */
#define _POSIX_JOB_CONTROL /* implementation supports job control */
@@ -50,47 +52,10 @@
#define _POSIX_SAVED_IDS /* saved set-user-ID and set-group-ID */
#endif
-#ifdef POSIX4
-
-/* Select POSIX.4 regardless.
- * Don't undef first - we want an error on conflicts.
- */
-
-#define _POSIX_VERSION 199309L
-#endif
-
-#ifndef _POSIX_VERSION
-#define _POSIX_VERSION 199009L
-#endif
-
-#if _POSIX_VERSION > 199009L
-/*
- * Set it up so that all new headers can assume _POSIX_C_SOURCE is the
- * only thing that must be looked at to determine the feature set,
- * and so that old headers don't have to change:
- */
-#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
-/*
- * Default to latest:
- */
-#define _POSIX_C_SOURCE _POSIX_VERSION
-#endif
-
-#if defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE)
-/*
- * Define _POSIX_SOURCE for older headers:
- */
-#define _POSIX_SOURCE
-#endif
-
#if _POSIX_VERSION >= 199309L
#include <posix4/posix4.h>
#endif
-#endif /* _POSIX_VERSION */
-
-
-
#define _POSIX2_VERSION 199212L
/* execution-time symbolic constants */
@@ -162,7 +127,7 @@
/* configurable system strings */
#define _CS_PATH 1
-#ifdef POSIX4_VISIBLE
+#ifdef _POSIX4_VISIBLE
#if 0
/* Not until the dust settles after the header commit
@@ -205,7 +170,7 @@
#define _PC_PRIO_IO 54
#define _PC_SYNC_IO 55
-#endif /* POSIX4_VISIBLE */
+#endif /* _POSIX4_VISIBLE */
#ifndef _POSIX_SOURCE
/*