Go to main content

man pages section 7: Standards, Environments, Macros, Character Sets, and Miscellany

Exit Print View

Updated: Wednesday, August 8, 2018
 
 

XNS4 (7)

Name

standards, ANSI, C, C++, ISO, POSIX, POSIX.1, POSIX.2, SUS, SUSv2, SUSv3, SUSv4, SVID, SVID3, XNS, XNS4, XNS5, XPG, XPG3, XPG4, XPG4v2, XPG5, XPG6, XPG7 - standards and specifications supported by Solaris 11.4

Description

Solaris 11.4 conforms to The Open Group's UNIX V7 Product Standard which means it supports IEEE Std 1003.1-2008, commonly referred to as POSIX.1-2008, UNIX V7, XPG7 or SUSv4 (Single UNIX Specification, Version 4). Note that POSIX.1-2008 is simultaneously IEEE Std 1003.1-2008 and The Open Group Technical Standard Base Specifications, Version 7. Note that SUSv4 incorporates IEEE Std 1003.1-2008 and ISO/IEC 9945:2009 (Portable Operating System Interface (POSIX) Base Specifications, Issue 7). New code should be written using the UNIX V7 standard. See the last section of this man page for historical information about which release of SunOS or Oracle Solaris first conformed to a particular standard and what to expect when running code compiled on a previous version of Oracle Solaris.

When using the Oracle Developer Studio 12.5 C compiler or the latest version of GCC or LLVM/Clang found in Solaris 11.4, Solaris 11.4 supports:

  • The ANSI X3.159-1989 Programming Language - C and ISO/IEC 9899:1990Programming Language - C (C) interfaces

  • ISO/IEC 9899:1990 Amendment 1:1995: C Integrity

  • ISO/IEC 9899:1999 Programming Languages - C

  • INCITS/ISO/IEC 9899:2011 Programming Languages - C

If Oracle Solaris Studio or Oracle Developer Studio C++ is installed, refer to its documentation for a discussion of which C++ standards are supported.

With regard to networking, the XNS4 specification is safe for use only in ILP32 (32-bit) environments and should not be used for LP64 (64-bit) application environments. Use XNS5 or SUSv3 for LP64 (64-bit) application environments because they have LP64-clean interfaces that are portable across ILP32 and LP64 environments. Solaris 11.4 supports both the ILP32 and LP64 environments. Future releases of Oracle Solaris may only support LP64 environments.

Conformance

A default Oracle Solaris installation might require additional steps in order to be fully SUSv4 compliant.

Packages

The XPG7 Conformance group package and Oracle Solaris Studio must be installed.

Package                                                 Publisher
----------------------------------------------------------------------
pkg:/group/feature/xpg7                                 solaris
----------------------------------------------------------------------
pkg://solarisstudio/developer/developerstudio-125/cc    solarisstudio
File systems

Typically, ZFS, the default root file system, is SUSv4 compliant. However, ZFS does not meet compliance requirements in the following edge case conditions:

  • Updating ZFS files system capacity statistics.

  • Modifying or removing existing data with almost full file system.

Applications that expect strict SUSv4 compliance must operate on UFS and would require setting up an UFS filesystem on a ZFS zvol device.

Utilities

If the behavior required by POSIX.1-2008 conflicts with historical Solaris utility behavior, the original Solaris version of the utility is unchanged and a standard-conforming version of the utility is provided in /usr/xpg7/bin. See the end of this manual page for historical detail about prior standards versions.

An application that wants to use POSIX.1-2008 standard-conforming utilities must set the PATH (sh(1) or ksh(1)) or path (csh(1)) environment variable to specify the directories listed below in the order specified to get the appropriate utilities. See the end of this manual page for historical detail about specifying directories for past versions.

POSIX.1-2008, SUSv4
  1. /usr/xpg7/bin

  2. /usr/xpg6/bin

  3. /usr/xpg4/bin

  4. /usr/bin

  5. Directory containing binaries for your compiler

  6. Other directories containing binaries needed by the application

Once the PATH/path variable is set, the getconf command can be used to confirm the settings.

When an application uses execlp() function, execvp() function or execvpe() function to execute a shell file, or uses the system(3C) function, the shell used to interpret the shell file depends on the standard to which the caller conforms. For more information, see the exec(2) man page.

Standard
Shell Used
POSIX.1-2008, SUSv4, XPG7
/usr/xpg4/bin/sh
No standard specified
/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 standard. If an application uses only those interfaces and headers defined by a particular standard (such as POSIX or SUSv4), then it need only define the appropriate feature test macro specified by that standard. 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 application must define __EXTENSIONS__ either on the compile command line or within the application source files.

POSIX. 1-2008

Applications that are intended to be conforming POSIX.1-2008 applications must define the feature test macro _POSIX_C_SOURCE=200809L, before including any headers. Application writers must check the standard for other macros that can be queried to determine if desired options are supported by the implementation.

SUSv4

To build or compile an application that conforms to the SUSv4 specification, the application must define _XOPEN_SOURCE=700. Applications need not set the POSIX.1-2008 feature test macro if they require both SUS and POSIX functionality.

1989 ANSI C, 1990 ISO C, 1999 ISO C, 2011 ISO C

No feature test macros need to be defined to indicate that an application 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, predefined by the compiler based on compiler defaults and command-line options, is set to a value of 199711 or greater, the compiler operates in a standard-conforming mode, indicating C++ standards conformance. Refer to the C++ compiler documentation for an explanation of the values this macro can have and which versions of the C++ standard are supported.

C++ bindings are not defined for POSIX or SUSv4, 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 these specifications.

Compilation with Oracle Developer Studio 12.5 Compiler

The Oracle Developer Studio 12.5 C Compiler provides the INCITS/ISO/IEC9899:2011 (2011 ISO C Language) standard-conforming compilation system by default. It also provides the INCITS/ISO/IEC 9899:1999 (1999 ISO C Language) standard-conforming compilation system.

An XNS5-conforming application must include –l xnet XNS on any link/load command line.

If the compiler supports the redefine_extname pragma feature, the Oracle Developer Studio 12.5 C Compiler and the Oracle Solaris Studio 12.5 C++ Compiler define the macro __PRAGMA_REDEFINE_EXTNAME to indicate that they support this feature. If the previous condition is met, then the standard 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.

When using the Oracle Developer Studio 12.5 C Compiler, applications conforming to POSIX. 1-2008 should be compiled using the utilities and flags indicated in the following table:

Specification    Compiler/Flags    Feature Test Macros
----------------------------------------------------------
POSIX.1-2008     c99               _POSIX_C_SOURCE=200809L
----------------------------------------------------------
SUSv4            c99               _XOPEN_SOURCE=700

History: POSIX Standard

Oracle Solaris has a history of supporting 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.

POSIX                            Standard                            Description Release
-----------------------------------------------------------------------------------------
POSIX.1-1988                 system interfaces and headers           SunOS 4.1
-----------------------------------------------------------------------------------------
POSIX.1-1990                 POSIX.1-1988 update                     Solaris 2.0
-----------------------------------------------------------------------------------------
POSIX.1b-1993                realtime extensions                     Solaris 2.4
-----------------------------------------------------------------------------------------
POSIX.1c-1996                threads extensions                      Solaris 2.6
-----------------------------------------------------------------------------------------
POSIX.2-1992                 shell and utilities                     Solaris 2.5
-----------------------------------------------------------------------------------------
POSIX.2a-1992                interactive shell and utilities         Solaris 2.5
-----------------------------------------------------------------------------------------
POSIX.1-2001                 POSIX.1-1990, POSIX.1b-1993, 
                             POSIX.1c-1996, POSIX.2-1992,
                             and POSIX.2a-1992 updates               Solaris 10

-----------------------------------------------------------------------------------------
POSIX.1-2004                 POSIX.1-2001 update                     Oracle Solaris 11

History: X/Open Common Applications Environment (CAE)

Oracle Solaris also has a history of supporting 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); Single UNIX Specification, Version 3 (SUSv3); and Single UNIX Specification, Version 4 (SUSv4). 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.

X/Open                          Specification                            Description Release
----------------------------------------------------------------------------------------------
XPG3                            superset of POSIX.1-1988 contain-        SunOS 4.1
                                ing utilities from SVID3
----------------------------------------------------------------------------------------------
XPG4                            superset of POSIX.1-1990,                Solaris 2.4
                                POSIX.2-1992, and POSIX.2a-1992
                                containing extensions to POSIX
                                standards from XPG3
----------------------------------------------------------------------------------------------
SUS (XPG4v2)                    superset of XPG4 containing his-         Solaris 2.6
                                torical BSD interfaces widely
                                used by common application packages
----------------------------------------------------------------------------------------------
XNS4                            sockets and XTI interfaces               Solaris 2.6
----------------------------------------------------------------------------------------------
SUSv2                           superset of SUS extended to sup-         Solaris 7
                                port POSIX.1b-1993,
                                POSIX.1c-1996, and ISO/IEC 9899
                                (C Standard) Amendment 1
----------------------------------------------------------------------------------------------
XNS5                            superset and LP64-clean deriva-          Solaris 7
                                tive of XNS4.
----------------------------------------------------------------------------------------------
SUSv3                           same as POSIX.1-2001                     Solaris 10

History: Other

Solaris releases 7 through Solaris 11.4 support both the ILP32 and LP64 environments. Future releases of Oracle Solaris may only support LP64 environments.

Solaris releases 2.0 through Solaris 11.4 support the interfaces specified by the System V Interface Definition, Third Edition, Volumes 1 through 4 (SVID3). Note that, since the developers of this specification (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.

Solaris releases 7 through 10 were branded to conform to The Open Group's UNIX 98 Product Standard. Solaris 10 through Oracle Solaris 11 were branded to conform to The Open Group's UNIX 03 Product Standard.

History: Utilities

If the behavior required by POSIX.2, POSIX.2a, XPG4, SUS, or SUSv2 conflicted with historical Solaris utility behavior, the original Solaris version of the utility was unchanged and a standard-conforming version of the utility was provided in /usr/xpg4/bin. If the behavior required by POSIX.1-2001 or SUSv3 conflicted with historical Solaris utility behavior, a standard conforming version was 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 standard conforming version was provided in /usr/xpg6/bin.

An application that wants to use standard-conforming utilities must set the PATH (sh(1) or ksh(1)) or path (csh(1)) environment variable to specify the directories listed below in the order specified to get the appropriate utilities:

SVID3, XPG3
  1. /usr/bin

  2. Directory containing binaries for your compiler

  3. Other directories containing binaries needed by the application

POSIX.2, POSIX.2a, SUS, SUSv2, XPG4
  1. /usr/xpg4/bin

  2. /usr/bin

  3. Directory containing binaries for your compiler

  4. Other directories containing binaries needed by the application

POSIX.1–2001, SUSv3
  1. /usr/xpg6/bin

  2. /usr/xpg4/bin

  3. /usr/bin

  4. Directory containing binaries for your compiler

  5. Other directories containing binaries needed by the application

When an application uses execlp() function or execvp() function to execute a shell file, or uses the system(3C) function, the shell used to interpret the shell file depends on the standard to which the caller conforms. For more information, see the exec(2) man page.

Standard
Shell Used
POSIX.1 (1990-2008), SUS, SUSv2, SUSv3, SUSv4, XPG4, XPG5, XPG6POSIX.1 (1988), SVID3, XPG3,
/usr/xpg4/bin/sh

History: Feature Test Macros

As noted above, feature test macros are used by applications to indicate additional sets of features that are desired beyond those specified by the C standard. Following outlines historical information about POSIX versions prior to POSIX.1-2008, X/Open CAE prior to SUSv4, and SVID3.

POSIX

The following table lists the feature test macros for prior versions of POSIX:

POSIX Standard
Feature Test Macros
POSIX.1-1990
_POSIX_SOURCE
POSIX.1-1990 and POSIX.2-1992 C-Language Bindings Option
_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
X/Open CAE

The following table lists the guidelines for prior versions of X/Open CAE specifications:

Specification
Instructions
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
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 completed.

See Also

csh(1), ksh(1), sh(1), exec(2), sysconf(3C), system(3C), environ(7), lf64(7)