freebsd_amp_hwpstate/share/man/man9/posix4.9

133 lines
5.5 KiB
Groff

.\" Copyright (c) 1998 HD Associates, Inc.
.\" All rights reserved.
.\"
.\" 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: 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
.Sh NAME
.Nm posix4
.Nd "POSIX.4 extensions"
.Sh DESCRIPTION
POSIX.4 adds real time extensions and some commonly used
Berkeley extensions to POSIX.1
This section contains preliminary information about avoiding conflicts
and adding support for the required ability to specify the interface
version.
.Sh STATUS
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
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.
.Sh SPECIFYING THE VERSION
There are three manifest constants that set the version and programming interface
for POSIX.4.
.Bd -literal -offset 0i
_POSIX_VERSION
.Ed
specifies the system for which the system is built. The default
is POSIX.1 and is 199009L. POSIX.4 is 199309L. This defines
the base features of the operating system.
.Bd -literal -offset 0i
_POSIX_SOURCE
.Ed
is a macro from POSIX.1 that can
be defined to specify that only POSIX and ANSI functionality should occur
in the name space.
.Bd -literal -offset 0i
_POSIX_C_SOURCE
.Ed
is a macro from POSIX.4 that can be defined to specify that only
POSIX and ANSI functionality from a specific POSIX version should occur
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
.Ed
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)
is defined in sys/unistd.h when the combination of _POSIX_VERSION,
_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
Some of these are new enough that they should be changed to
be dependent on _POSIX4_VISIBLE instead.
.Pp
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
.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
make any compliant program compile without issues of header file
inclusion.
.Bd -literal -offset 0i
POSIX4
.Ed
is a config option and (currently) a request to build POSIX.4 by
setting the _POSIX_VERSION to 199309L in sys/unistd.h.
.Sh SEE ALSO
.Sh HISTORY
The
.Nm posix4
section manual page appeared in
.Fx 3.0 .