mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-22 08:53:41 +01:00
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.
This commit is contained in:
parent
aac18d035f
commit
aac4ad2c99
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=34319
@ -31,11 +31,12 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)limits.h 8.2 (Berkeley) 1/4/94
|
||||
* $Id: limits.h,v 1.5 1997/12/27 22:56:41 steve Exp $
|
||||
* $Id: limits.h,v 1.6 1998/03/04 10:23:24 dufault Exp $
|
||||
*/
|
||||
|
||||
#ifndef _LIMITS_H_
|
||||
#define _LIMITS_H_
|
||||
#include <sys/_posix.h>
|
||||
|
||||
#ifndef _ANSI_SOURCE
|
||||
#define _POSIX_ARG_MAX 4096
|
||||
@ -61,14 +62,15 @@
|
||||
#define _POSIX2_LINE_MAX 2048
|
||||
#define _POSIX2_RE_DUP_MAX 255
|
||||
|
||||
#ifdef POSIX4_VISIBLE
|
||||
|
||||
#define _POSIX_AIO_LISTIO_MAX 2
|
||||
#ifdef _POSIX4_VISIBLE
|
||||
|
||||
#define _POSIX_AIO_LISTIO_MAX 16
|
||||
#define _POSIX_AIO_MAX 1
|
||||
#define _POSIX_DELAYTIMER_MAX 32
|
||||
#define _POSIX_MQ_OPEN_MAX 8
|
||||
#define _POSIX_MQ_PRIO_MAX 32
|
||||
#define _POSIX_RTSIG_MAX 8
|
||||
#define _POSIX_RTSIG_MAX 0
|
||||
#define _POSIX_SEM_NSEMS_MAX 256
|
||||
#define _POSIX_SEM_VALUE_MAX 32767
|
||||
#define _POSIX_SIGQUEUE_MAX 32
|
||||
@ -76,6 +78,10 @@
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef _POSIX4_VISIBLE_HISTORICALLY
|
||||
#define AIO_LISTIO_MAX 16
|
||||
#endif
|
||||
|
||||
#endif /* !_ANSI_SOURCE */
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE)
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/signal.h>
|
||||
#include <machine/ansi.h>
|
||||
#include <sys/_posix.h>
|
||||
|
||||
#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
|
||||
extern __const char *__const sys_signame[NSIG];
|
||||
@ -63,10 +64,39 @@ int signanosleep __P((const struct timespec *, struct timespec *,
|
||||
int sigpending __P((sigset_t *));
|
||||
int sigprocmask __P((int, const sigset_t *, sigset_t *));
|
||||
int sigsuspend __P((const sigset_t *));
|
||||
#ifdef POSIX4_VISIBLE
|
||||
|
||||
#ifdef _POSIX4_VISIBLE_HISTORICALLY
|
||||
|
||||
/* Async event notification */
|
||||
|
||||
union sigval {
|
||||
int sival_int;
|
||||
void *sival_ptr;
|
||||
};
|
||||
struct sigevent {
|
||||
int sigev_notify; /* Notification type */
|
||||
int sigev_signo; /* Signal number */
|
||||
union sigval sigev_value; /* Signal value */
|
||||
};
|
||||
#define SIGEV_NONE 0 /* No async notification */
|
||||
#define SIGEV_SIGNAL 1 /* Queue signal with value */
|
||||
|
||||
#endif /* _POSIX4_VISIBLE_HISTORICALLY */
|
||||
|
||||
#ifdef _POSIX4_VISIBLE
|
||||
|
||||
typedef struct siginfo {
|
||||
int si_signo; /* Signal number */
|
||||
int si_code; /* Cause of the signal */
|
||||
union sigval si_value; /* Signal value */
|
||||
} siginfo_t;
|
||||
|
||||
__BEGIN_DECLS
|
||||
int sigqueue __P((_BSD_PID_T_, int, const union sigval));
|
||||
int sigtimedwait __P((const sig_set_t *, siginfo_t *));
|
||||
int sigwaitinfo __P((const sig_set_t *, siginfo_t *));
|
||||
int sigtimedwait __P((const sigset_t *, siginfo_t *));
|
||||
int sigwaitinfo __P((const sigset_t *, siginfo_t *));
|
||||
__END_DECLS
|
||||
|
||||
#endif
|
||||
#ifndef _POSIX_SOURCE
|
||||
int killpg __P((_BSD_PID_T_, int));
|
||||
|
@ -176,7 +176,7 @@ sysconf(name)
|
||||
mib[1] = USER_POSIX2_UPE;
|
||||
goto yesno;
|
||||
|
||||
#ifdef POSIX4
|
||||
#if _POSIX_VERSION >= 199309L
|
||||
/* POSIX.4 */
|
||||
|
||||
case _SC_ASYNCHRONOUS_IO:
|
||||
@ -279,7 +279,7 @@ sysconf(name)
|
||||
mib[0] = CTL_POSIX4;
|
||||
mib[1] = CTL_POSIX4_TIMER_MAX;
|
||||
goto yesno;
|
||||
#endif /* POSIX4 */
|
||||
#endif /* _POSIX_VERSION >= 199309L */
|
||||
|
||||
yesno: if (sysctl(mib, 2, &value, &len, NULL, 0) == -1)
|
||||
return (-1);
|
||||
|
@ -22,7 +22,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $Id: posix4.9,v 1.8 1998/01/02 19:22:52 alex Exp $
|
||||
.\" $Id: posix4.9,v 1.1 1998/03/04 10:23:50 dufault Exp $
|
||||
.Dd March 1, 1998
|
||||
.Dt POSIX.4 9
|
||||
.Os FreeBSD 3.0
|
||||
@ -32,17 +32,21 @@
|
||||
.Sh DESCRIPTION
|
||||
POSIX.4 adds real time extensions and some commonly used
|
||||
Berkeley extensions to POSIX.1
|
||||
This section contains information about the the
|
||||
POSIX.4 extensions to the system.
|
||||
This section contains preliminary information about avoiding conflicts
|
||||
and adding support for the required ability to specify the interface
|
||||
version.
|
||||
.Sh STATUS
|
||||
March 1, 1998 adds the header file changes to 3.0. There should be no
|
||||
visible differences as long as _POSIX_VERSION is left at 199009L and
|
||||
no one builds kernels with a POSIX4 option.
|
||||
March 7, 1998: adding header file changes to 3.0. There should be no
|
||||
visible differences as long as _POSIX_VERSION is left undefined.
|
||||
Defining _POSIX_VERSION, even to the current value of 199009L, will
|
||||
change the behavior of the system per the POSIX spec: if you define
|
||||
_POSIX_VERSION to be 199009L then any extensions
|
||||
already added to the system (for example,
|
||||
John Dyson's aio work) may no longer be visible - this is happening
|
||||
slowly.
|
||||
.Pp
|
||||
If you are working with something defined in POSIX.4 then there is a good
|
||||
chance we conflict. If you have the time then set
|
||||
_POSIX_VERSION to 199309L in /etc/make.conf and see that your work
|
||||
fits with mine.
|
||||
In spite of what I said at first, don't set _POSIX_VERSION into the
|
||||
future until I say it is working.
|
||||
.Pp
|
||||
Since this only brings in the headers I'm only explaining the feature
|
||||
test options.
|
||||
@ -70,37 +74,46 @@ in the name space, i.e., if _POSIX_VERSION is 199309L (POSIX.4) but
|
||||
_POSIX_C_SOURCE is 199009L (POSIX.1) then only POSIX.1 features should
|
||||
appear.
|
||||
.Sh PROPERLY HIDING EXTENSIONS
|
||||
The following test macros are set up in <sys/_posix.h>. They should
|
||||
used by system header files to avoid the kind of tests you see in
|
||||
<sys/_posix.h>. Source programs should not use these FreeBSD specific
|
||||
implementation details and should test _POSIX_VERSION.
|
||||
These should not be used in the kernel either - the kernel should be
|
||||
immune to the user land setting of _POSIX_VERSION. The POSIX4 option can
|
||||
be used in the kernel to limit inclusion of new code, but make sure
|
||||
things work properly when a POSIX.4 program is run on a kernel without
|
||||
the POSIX4 option.
|
||||
.Bd -literal -offset 0i
|
||||
POSIX4_VISIBLE
|
||||
_POSIX4_VISIBLE
|
||||
.Ed
|
||||
is a test macro that tries to sort out when extensions should be
|
||||
visible.
|
||||
is a test macro that sorts out when extensions should be
|
||||
visible. It is defined in <sys/_posix.h>.
|
||||
.Pp
|
||||
In normal C program development
|
||||
only _POSIX_VERSION is set, permitting BSD extensions to
|
||||
appear to the programs. However, when adding new functionality mandated
|
||||
by POSIX.4, it
|
||||
is important to satisfy the requirements added by the
|
||||
new _POSIX_C_SOURCE macro. POSIX4_VISIBLE (not a standard feature test macro)
|
||||
new _POSIX_C_SOURCE macro. _POSIX4_VISIBLE (not a standard feature test macro)
|
||||
is defined in sys/unistd.h when the combination of _POSIX_VERSION,
|
||||
_POSIX_SOURCE, and _POSIX_C_SOURCE indicate the extensions are in scope.
|
||||
_POSIX_SOURCE, and _POSIX_C_SOURCE indicate that the extensions are in scope.
|
||||
.Bd -literal -offset 0i
|
||||
_POSIX4_VISIBLE_HISTORICALLY
|
||||
is present to conditionalize POSIX.4 extensions that were historically
|
||||
in the system. These are visible when _POSIX_SOURCE and _POSIX_C_SOURCE
|
||||
are not set at all or when _POSIX_C_SOURCE enables POSIX.4 features.
|
||||
.Pp
|
||||
Since for POSIX to work you must include <unistd.h> which ultimately
|
||||
sets this up header files can always assume this is visible without
|
||||
including anything.
|
||||
Some of these are new enough that they should be changed to
|
||||
be dependent on _POSIX4_VISIBLE instead.
|
||||
.Pp
|
||||
Some traditional BSD headers (e.g., mmap.h) are now specified in POSIX.4.
|
||||
This means that functionality not present in POSIX.4 should now be
|
||||
hidden by testing _POSIX_SOURCE or _POSIX_C_SOURCE. The safest thing
|
||||
is to hide them when _POSIX_C_SOURCE is defined and less than 199309L.
|
||||
Don't bracket the extensions with the POSIX.4 feature test macros.
|
||||
For example, don't conditionalize new memory locking flags with
|
||||
_POSIX_MEMLOCK. It will be too easy for conflicting implementations
|
||||
that don't pay heed to the POSIX.4 flags to sneak into the system.
|
||||
Traditional BSD headers (e.g., mmap.h) that are now specified
|
||||
in POSIX.4 should include <sys/_posix.h> and conditionalize
|
||||
BSD extensions on _POSIX4_VISIBLE_HISTORICALLY.
|
||||
.Sh NON STANDARD TEST MACROS
|
||||
.Bd -literal -offset 0i
|
||||
POSIX4_INCLUDE_MAYBES
|
||||
_POSIX4_INCLUDE_MAYBES
|
||||
.Ed
|
||||
when set before the inclusion of any other header file
|
||||
requests that all header files that the POSIX.4 spec says a standard
|
||||
header may include should be included. Normally no non-required
|
||||
headers are included. Setting this pre-processor definition should
|
||||
|
@ -31,15 +31,15 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id:$
|
||||
* $Id: aio.h,v 1.1 1998/03/04 10:26:10 dufault Exp $
|
||||
*/
|
||||
|
||||
/* aio.h: P1003.1B-1993 Asynchronous I/O */
|
||||
|
||||
#ifndef _POSIX4_AIO_H_
|
||||
#define _POSIX4_AIO_H_
|
||||
#ifndef _AIO_H_
|
||||
#define _AIO_H_
|
||||
|
||||
#ifdef POSIX4_INCLUDE_MAYBES
|
||||
#ifdef _POSIX4_INCLUDE_MAYBES
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
#include <time.h>
|
||||
@ -87,6 +87,7 @@ struct aiocb {
|
||||
#ifndef KERNEL
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
int aio_read __P((struct aiocb *));
|
||||
int aio_write __P((struct aiocb *));
|
||||
|
||||
@ -101,6 +102,7 @@ int aio_suspend __P((caio_listio_ctl [_POSIX_AIO_LISTIO_MAX],
|
||||
int, const struct timespec *));
|
||||
|
||||
int aio_fsync __P((int, struct aiocb *));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef POSIX4_INCLUDE_MAYBES
|
||||
#ifdef _POSIX4_INCLUDE_MAYBES
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
@ -55,8 +55,10 @@ struct mq_attr {
|
||||
};
|
||||
|
||||
#ifndef KERNEL
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
|
||||
__BEGIN_DECLS
|
||||
mqd_t mq_open __P((const char *, int oflag, ...));
|
||||
int mq_close __P((mqd_t));
|
||||
int mq_unlink __P((const char *));
|
||||
@ -65,6 +67,7 @@ ssize_t mq_receive __P((mqd_t, char *, size_t, unsigned int *));
|
||||
int mq_notify __P((mqd_t, const struct sigevent *));
|
||||
int mq_setattr __P((mqd_t, const struct mq_attr *, struct mq_attr *));
|
||||
int mq_getattr __P((mqd_t, struct mq_attr *));
|
||||
__END_DECLS
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
|
@ -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_ */
|
||||
|
@ -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 */
|
||||
|
||||
|
73
sys/sys/_posix.h
Normal file
73
sys/sys/_posix.h
Normal file
@ -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_ */
|
@ -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.)
|
||||
@ -71,11 +42,6 @@ struct sigevent {
|
||||
#define LIO_NOWAIT 0x0
|
||||
#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
|
||||
|
@ -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
|
||||
|
@ -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_ */
|
||||
|
@ -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 */
|
||||
|
@ -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 */
|
||||
|
||||
|
@ -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
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user