standards(5) Standards, Environments, and Macros standards(5)
NAME
standards, ANSI, C, C++, ISO, POSIX, POSIX.1, POSIX.2, SUS, SUSv2,
SUSv3, SVID, SVID3, XNS, XNS4, XNS5, XPG, XPG3, XPG4, XPG4v2 - stan-
dards and specifications supported by Solaris
DESCRIPTION
Solaris 10 supports IEEE Std 1003.1 and IEEE Std 1003.2, commonly known
as POSIX.1 and POSIX.2, respectively. The following table lists each
version of these standards with a brief description and the SunOS or
Solaris release that first conformed to it.
tab(); cw(1.250246i) cw(3.291722i) cw(0.958031i) lw(1.250246i)
lw(3.291722i) lw(0.958031i). POSIX StandardDescriptionRelease
POSIX.1-1988system interfaces and headersSunOS 4.1
POSIX.1-1990POSIX.1-1988 updateSolaris 2.0 POSIX.1b-1993realtime exten-
sionsSolaris 2.4 POSIX.1c-1996threads extensionsSolaris 2.6
POSIX.2-1992shell and utilitiesSolaris 2.5 POSIX.2a-1992interactive
shell and utilitiesSolaris 2.5 POSIX.1-2001T{ POSIX.1-1990,
POSIX.1b-1993, POSIX.1c-1996, POSIX.2-1992, and POSIX.2a-1992 updates
T}Solaris 10
Solaris 10 also supports the X/Open Common Applications Environment
(CAE) Portability Guide Issue 3 (XPG3) and Issue 4 (XPG4); Single UNIX
Specification (SUS, also known as XPG4v2); Single UNIX Specification,
Version 2 (SUSv2); and Single UNIX Specification, Version 3 (SUSv3).
Both XPG4 and SUS include Networking Services Issue 4 (XNS4). SUSv2
includes Networking Services Issue 5 (XNS5).
The following table lists each X/Open specification with a brief
description and the SunOS or Solaris release that first conformed to
it.
tab(); cw(1.292051i) cw(3.263806i) cw(0.944143i) lw(1.292051i)
lw(3.263806i) lw(0.944143i). X/Open CAE
SpecificationDescriptionRelease XPG3T{ superset of POSIX.1-1988 con-
taining utilities from SVID3 T}SunOS 4.1 XPG4T{ superset of
POSIX.1-1990, POSIX.2-1992, and POSIX.2a-1992 containing extensions to
POSIX standards from XPG3 T}Solaris 2.4 SUS (XPG4v2)T{ superset of XPG4
containing historical BSD interfaces widely used by common application
packages T}Solaris 2.6 XNS4sockets and XTI interfacesSolaris 2.6
SUSv2T{ superset of SUS extended to support POSIX.1b-1993,
POSIX.1c-1996, and ISO/IEC 9899 (C Standard) Amendment 1 T}Solaris 7
XNS5T{ superset and LP64-clean derivative of XNS4. T}Solaris 7
SUSv3same as POSIX.1-2001Solaris 10
The XNS4 specification is safe for use only in ILP32 (32-bit) environ-
ments and should not be used for LP64 (64-bit) application environ-
ments. Use XNS5 or SUSv3, which have LP64-clean interfaces that are
portable across ILP32 and LP64 environments. Solaris releases 7 through
10 support both the ILP32 and LP64 environments.
Solaris releases 7 through 10 have been branded to conform to The Open
Group's UNIX 98 Product Standard. Solaris 10 has been branded to con-
form to The Open Group's UNIX 03 Product Standard.
Solaris releases 2.0 through 10 support the interfaces specified by the
System V Interface Definition, Third Edition, Volumes 1 through 4
(SVID3). Note, however, that since the developers of this specifica-
tion (UNIX Systems Laboratories) are no longer in business and since
this specification defers to POSIX and X/Open CAE specifications, there
is some disagreement about what is currently required for conformance
to this specification.
When Sun Studio C Compiler 5.6 is installed, Solaris releases 2.0
through 10 support the ANSI X3.159-1989 Programming Language - C and
ISO/IEC 9899:1990 Programming Language - C (C) interfaces.
When Sun Studio C Compiler 5.6 is installed, Solaris releases 7 through
10 support ISO/IEC 9899:1990 Amendment 1:1995: C Integrity.
When Sun Studio C Compiler 5.6 is installed, Solaris 10 supports
ISO/IEC 9899:1999 Programming Languages - C.
When Sun Studio C++ Compiler 5.6 is installed, Solaris releases 2.5.1
through 10 support ISO/IEC 14882:1998 Programming Languages - C++.
Unsupported features of that standard are described in the compiler
README file.
Utilities
If the behavior required by POSIX.2, POSIX.2a, XPG4, SUS, or SUSv2 con-
flicts with historical Solaris utility behavior, the original Solaris
version of the utility is unchanged; a new version that is standard-
conforming has been provided in /usr/xpg4/bin. If the behavior required
by POSIX.1-2001 or SUSv3 conflicts with historical Solaris utility
behavior, a new version that is standard-conforming has been provided
in /usr/xpg4/bin or in /usr/xpg6/bin. If the behavior required by
POSIX.1-2001 or SUSv3 conflicts with POSIX.2, POSIX.2a, SUS, or SUSv2,
a new version that is SUSv3 standard-conforming has been provided in
/usr/xpg6/bin.
An application that wants to use standard-conforming utilitues must set
the PATH (sh(1) or ksh(1)) or path (csh(1)) environment variable to
specify the directories listed in the following table in the order
specified to get the appropriate utilities:
tab(); lw(1.722050i) lw(3.777950i). StandardUtility Directories SVID3,
XPG3T{
1. /usr/ccs/bin
2. /usr/bin
3. directory containing binaries for your compiler
4. other directories containing binaries needed by the application
T} T{ POSIX.2, POSIX.2a, SUS, SUSv2, XPG4
T}T{
1. /usr/xpg4/bin
2. /usr/ccs/bin
3. /usr/bin
4. directory containing binaries for your compiler
5. other directories containing binaries needed by the application
T} POSIX.1-2001, SUSv3T{
1. /usr/xpg6/bin
2. /usr/xpg4/bin
3. /usr/ccs/bin
4. /usr/bin
5. directory containing binaries for your compiler
6. other directories containing binaries needed by the application
T}
When an application uses execlp() or execvp() (see exec(2)) to execute
a shell file, or uses system(3C), the shell used to interpret the shell
file depends on the standard to which the caller conforms:
tab(); lw(2.750000i) lw(2.750000i). StandardShell Used T{ 1989 ANSI C,
1990 ISO C, 1999 ISO C, POSIX.1 (1990-2001), SUS, SUSv2, SUSv3, XPG4
T}/usr/xpg4/bin/sh T{ POSIX.1 (1988), SVID3, XPG3, no standard speci-
fied T}/usr/bin/sh
Feature Test Macros
Feature test macros are used by applications to indicate additional
sets of features that are desired beyond those specified by the C stan-
dard. If an application uses only those interfaces and headers defined
by a particular standard (such as POSIX or X/Open CAE), then it need
only define the appropriate feature test macro specified by that stan-
dard. If the application is using interfaces and headers not defined by
that standard, then in addition to defining the appropriate standard
feature test macro, it must also define __EXTENSIONS__. Defining
__EXTENSIONS__ provides the application with access to all interfaces
and headers not in conflict with the specified standard. The applica-
tion must define __EXTENSIONS__ either on the compile command line or
within the application source files.
1989 ANSI C, 1990 ISO C, 1999 ISO C
No feature test macros need to be defined to indicate that an applica-
tion is a conforming C application.
ANSI/ISO C++
ANSI/ISO C++ does not define any feature test macros. If the standard
C++ announcement macro __cplusplus is predefined to value 199711 or
greater, the compiler operates in a standard-conforming mode, indicat-
ing C++ standards conformance. The value 199711 indicates conformance
to ISO/IEC 14882:1998, as required by that standard. (As noted above,
conformance to the standard is incomplete.) A standard-conforming mode
is not available with compilers prior to Sun WorkShop C++ 5.0.
C++ bindings are not defined for POSIX or X/Open CAE, so specifying
feature test macros such as _POSIX_SOURCE, _POSIX_C_SOURCE, and
_XOPEN_SOURCE can result in compilation errors due to conflicting
requirements of standard C++ and those specifications.
POSIX
Applications that are intended to be conforming POSIX.1 applications
must define the feature test macros specified by the standard before
including any headers. For the standards listed below, applications
must define the feature test macros listed. Application writers must
check the corresponding standards for other macros that can be queried
to determine if desired options are supported by the implementation.
tab(); cw(2.750000i) cw(2.750000i) lw(2.750000i) lw(2.750000i). POSIX
StandardFeature Test Macros POSIX.1-1990_POSIX_SOURCE T{ POSIX.1-1990
and POSIX.2-1992 C-Language Bindings Option T}_POSIX_SOURCE and
_POSIX_C_SOURCE=2 POSIX.1b-1993_POSIX_C_SOURCE=199309L
POSIX.1c-1996_POSIX_C_SOURCE=199506L
POSIX.1-2001_POSIX_C_SOURCE=200112L
SVID3
The SVID3 specification does not specify any feature test macros to
indicate that an application is written to meet SVID3 requirements.
The SVID3 specification was written before the C standard was com-
pleted.
X/Open CAE
To build or compile an application that conforms to one of the X/Open
CAE specifications, use the following guidelines. Applications need not
set the POSIX feature test macros if they require both CAE and POSIX
functionality.
XPG3 The application must define _XOPEN_SOURCE. If
_XOPEN_SOURCE is defined with a value, the value must
be less than 500.
XPG4 The application must define _XOPEN_SOURCE and set
_XOPEN_VERSION=4. If _XOPEN_SOURCE is defined with a
value, the value must be less than 500.
SUS (XPG4v2) The application must define _XOPEN_SOURCE and set
_XOPEN_SOURCE_EXTENDED=1. If _XOPEN_SOURCE is defined
with a value, the value must be less than 500.
SUSv2 The application must define _XOPEN_SOURCE=500.
SUSv3 The application must define _XOPEN_SOURCE=600.
Compilation
A POSIX.1 (1988-1996)-, XPG4-, SUS-, or SUSv2-conforming implementation
must include an ANSI X3.159-1989 (ANSI C Language) standard-conforming
compilation system and the cc and c89 utilities. A POSIX.1-2001- or
SUSv3-conforming implementation must include an ISO/IEC 99899:1999
(1999 ISO C Language) standard-conforming compilation system and the
c99 utility. Solaris 10 was tested with the cc, c89, and c99 utilities
and the compilation environment provided by Sun Studio C Compiler 5.6.
When cc is used to link applications, /usr/lib/values-xpg4.o must be
specified on any link/load command line, unless the application is
POSIX.1-2001- or SUSv3-conforming, in which case /usr/lib/values-xpg6.o
must be specified on any link/load compile line. The preferred way to
build applications, however, is described in the table below.
An XNS4- or XNS5-conforming application must include -l XNS on any
link/load command line in addition to defining the feature test macros
specified for SUS or SUSv2, respectively.
If the compiler suppports the redefine_extname pragma feature (the Sun
Studio C Compiler 5.6 compilers define the macro __PRAGMA_REDE-
FINE_EXTNAME to indicate that it supports this feature), then the stan-
dard headers use #pragma redefine_extname directives to properly map
function names onto library entry point names. This mapping provides
full support for ISO C, POSIX, and X/Open namespace reservations.
If this pragma feature is not supported by the compiler, the headers
use the #define directive to map internal function names onto appropri-
ate library entry point names. In this instance, applications should
avoid using the explicit 64-bit file offset symbols listed on the
lf64(5) manual page, since these names are used by the implementation
to name the alternative entry points.
When using Sun Studio C Compiler 5.6 compilers, applications conforming
to the specifications listed above should be compiled using the utili-
ties and flags indicated in the following table:
tab(); cw(1.361077i) cw(1.388993i) cw(2.749930i) lw(1.361077i)
lw(1.388993i) lw(2.749930i). SpecificationCompiler/FlagsFeature Test
Macros 1989 ANSI C and 1990 ISO Cc89none 1999 ISO Cc99none SVID3cc -Xt
-xc99=nonenone POSIX.1-1990c89_POSIX_SOURCE T{ POSIX.1-1990 and
POSIX.2-1992
C-Language
Bindings Option T}c89T{ _POSIX_SOURCE and
POSIX_C_SOURCE=2 T} POSIX.1b-1993c89_POSIX_C_SOURCE=199309L
POSIX.1c-1996c89_POSIX_C_SOURCE=199506L
POSIX.1-2001c99_POSIX_C_SOURCE=200112L
POSIX.1c-1996c89_POSIX_C_SOURCE=199506L CAE XPG3cc -Xa
-xc99=none_XOPEN_SOURCE CAE XPG4c89T{ _XOPEN_SOURCE and
_XOPEN_VERSION=4 T} T{ SUS (CAE XPG4v2)
(includes XNS4) T}c89T{ _XOPEN_SOURCE and
_XOPEN_SOURCE_EXTENDED=1 T} SUSv2 (includes XNS5)c89_XOPEN_SOURCE=500
SUSv3c99_XOPEN_SOURCE=600
For platforms supporting the LP64 (64-bit) programming environment,
SUSv2-conforming LP64 applications using XNS5 library calls should be
built with command lines of the form:
c89 $(getconf XBS5_LP64_OFF64_CFLAGS) -D_XOPEN_SOURCE=500 \
$(getconf XBS5_LP64_OFF64_LDFLAGS) foo.c -o foo \
$(getconf XBS5_LP64_OFF64_LIBS) -lxnet
Similar SUSv3-conforming LP64 applications should be built with command
lines of the form:
c99 $(getconf POSIX_V6_LP64_OFF64_CFLAGS) -D_XOPEN_SOURCE=600 \
$(getconf POSIX_V6_LP64_OFF64_LDFLAGS) foo.c -o foo \
$(getconf POSIX_V6_LP64_OFF64_LIBS) -lxnet
SEE ALSO
csh(1), ksh(1), sh(1), exec(2), sysconf(3C), system(3C), environ(5),
lf64(5)
SunOS 5.10 14 Jan 2004 standards(5)
|