JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
man pages section 5: Standards, Environments, and Macros     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

Introduction

Standards, Environments, and Macros

acl(5)

ad(5)

advance(5)

adv_cap_1000fdx(5)

adv_cap_1000hdx(5)

adv_cap_100fdx(5)

adv_cap_100hdx(5)

adv_cap_10fdx(5)

adv_cap_10hdx(5)

adv_cap_asym_pause(5)

adv_cap_autoneg(5)

adv_cap_pause(5)

adv_rem_fault(5)

ANSI(5)

architecture(5)

ars(5)

ascii(5)

attributes(5)

audit_binfile(5)

audit_flags(5)

audit_remote(5)

audit_syslog(5)

availability(5)

brands(5)

C++(5)

C(5)

cancellation(5)

cap_1000fdx(5)

cap_1000hdx(5)

cap_100fdx(5)

cap_100hdx(5)

cap_10fdx(5)

cap_10hdx(5)

cap_asym_pause(5)

cap_autoneg(5)

cap_pause(5)

cap_rem_fault(5)

charmap(5)

compile(5)

condition(5)

crypt_bsdbf(5)

crypt_bsdmd5(5)

crypt_sha256(5)

crypt_sha512(5)

crypt_sunmd5(5)

crypt_unix(5)

CSI(5)

datasets(5)

device_clean(5)

dhcp(5)

dhcp_modules(5)

environ(5)

eqnchar(5)

extendedFILE(5)

extensions(5)

fedfs(5)

filesystem(5)

fmri(5)

fnmatch(5)

formats(5)

fsattr(5)

grub(5)

gss_auth_rules(5)

hal(5)

iconv_1250(5)

iconv_1251(5)

iconv(5)

iconv_646(5)

iconv_852(5)

iconv_8859-1(5)

iconv_8859-2(5)

iconv_8859-5(5)

iconv_dhn(5)

iconv_koi8-r(5)

iconv_mac_cyr(5)

iconv_maz(5)

iconv_pc_cyr(5)

iconv_unicode(5)

ieee802.11(5)

ieee802.3(5)

ipfilter(5)

ipkg(5)

isalist(5)

ISO(5)

kerberos(5)

krb5_auth_rules(5)

krb5envvar(5)

KSSL(5)

kssl(5)

labels(5)

largefile(5)

ldap(5)

lf64(5)

lfcompile(5)

lfcompile64(5)

link_duplex(5)

link_rx_pause(5)

link_tx_pause(5)

link_up(5)

locale(5)

locale_alias(5)

lp_cap_1000fdx(5)

lp_cap_1000hdx(5)

lp_cap_100fdx(5)

lp_cap_100hdx(5)

lp_cap_10fdx(5)

lp_cap_10hdx(5)

lp_cap_asym_pause(5)

lp_cap_autoneg(5)

lp_cap_pause(5)

lp_rem_fault(5)

man(5)

mansun(5)

me(5)

mech_spnego(5)

mm(5)

ms(5)

MT-Level(5)

mutex(5)

MWAC(5)

mwac(5)

nfssec(5)

NIS+(5)

NIS(5)

nis(5)

nwam(5)

openssl(5)

pam_allow(5)

pam_authtok_check(5)

pam_authtok_get(5)

pam_authtok_store(5)

pam_deny(5)

pam_dhkeys(5)

pam_dial_auth(5)

pam_krb5(5)

pam_krb5_migrate(5)

pam_ldap(5)

pam_list(5)

pam_passwd_auth(5)

pam_pkcs11(5)

pam_rhosts_auth(5)

pam_roles(5)

pam_sample(5)

pam_smbfs_login(5)

pam_smb_passwd(5)

pam_tsol_account(5)

pam_tty_tickets(5)

pam_unix_account(5)

pam_unix_auth(5)

pam_unix_cred(5)

pam_unix_session(5)

pam_user_policy(5)

pam_zfs_key(5)

pkcs11_kernel(5)

pkcs11_kms(5)

pkcs11_softtoken(5)

pkcs11_tpm(5)

pkg(5)

POSIX.1(5)

POSIX.2(5)

POSIX(5)

privileges(5)

prof(5)

pthreads(5)

RBAC(5)

rbac(5)

regex(5)

regexp(5)

resource_controls(5)

sgml(5)

smf(5)

smf_bootstrap(5)

smf_method(5)

smf_restarter(5)

smf_security(5)

smf_template(5)

solaris10(5)

solaris(5)

solbook(5)

stability(5)

standard(5)

standards(5)

step(5)

sticky(5)

suri(5)

SUS(5)

SUSv2(5)

SUSv3(5)

SVID3(5)

SVID(5)

tecla(5)

teclarc(5)

term(5)

threads(5)

trusted_extensions(5)

vgrindefs(5)

wbem(5)

xcvr_addr(5)

xcvr_id(5)

xcvr_inuse(5)

XNS4(5)

XNS(5)

XNS5(5)

XPG3(5)

XPG4(5)

XPG4v2(5)

XPG(5)

zones(5)

standards

, ANSI

, C

, C++

, ISO

, POSIX

, POSIX.1

, POSIX.2

, SUS

, SUSv2

, SUSv3

, SVID

, SVID3

, XNS

, XNS4

, XNS5

, XPG

, XPG3

, XPG4

, XPG4v2

- standards and specifications supported by Oracle Solaris

Description

Oracle Solaris 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.

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

Oracle Solaris 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.

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

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, which have LP64-clean interfaces that are portable across ILP32 and LP64 environments. Solaris releases 7 through Oracle Solaris 11 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 through Oracle Solaris 11 have been branded to conform to The Open Group's UNIX 03 Product Standard.

Solaris releases 2.0 through Oracle Solaris 11 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 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.

When Oracle Solaris Studio 12.3 C Compiler is installed, Oracle Solaris 11 supports the ANSI X3.159-1989 Programming Language - C and ISO/IEC 9899:1990 Programming Language - C (C) interfaces.

When Oracle Solaris Studio 12.3 C Compiler is installed, Oracle Solaris 11 supports ISO/IEC 9899:1990 Amendment 1:1995: C Integrity.

When Oracle Solaris Studio 12.3 C Compiler is installed, Oracle Solaris 11 supports ISO/IEC 9899:1999 Programming Languages – C.

When Oracle Solaris Studio 12.3 C++ Compiler is installed, Oracle Solaris 11 supports 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 conflicts 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 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() 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:

Standard
Shell Used
1989 ANSI C, 1990 ISO C, 1999 ISO C, POSIX.1 (1990–2001), SUS, SUSv2, SUSv3, XPG4
/usr/xpg4/bin/sh
POSIX.1 (1988), SVID3, XPG3, 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 X/Open CAE), 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.

1989 ANSI C, 1990 ISO C, 1999 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. The value 199711 indicates conformance to ISO/IEC 14882:1998, as required by that standard. (As noted above, conformance to the standard is incomplete.)

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.

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
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.

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

The Oracle Solaris Studio 12.3 C Compiler provides the ISO/IEC 99899:1999 (1999 ISO C Language) standard-conforming compilation system and the c99 utility.

When ld is used directly 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. When cc or CC is used to link applications, the compiler automatically adds the appropriate file. 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 supports the redefine_extname pragma feature (the Oracle Solaris Studio 12.3 C Compiler and the Oracle Solaris Studio 12.3 C++ Compiler define the macro __PRAGMA_REDEFINE_EXTNAME to indicate that they support this feature), 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.

If this pragma feature is not supported by the compiler, the headers use the #define directive to map internal function names onto appropriate 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 the Oracle Solaris Studio 12.3 C Compiler, applications conforming to the specifications listed above should be compiled using the utilities and flags indicated in the following table:

Specification            Compiler/Flags         Feature Test Macros
_________________________________________________________________________
1989 ANSI C and 1990 ISO C    c89                none
_________________________________________________________________________
1999 ISO C                    c99                none
_________________________________________________________________________
SVID3                         cc -Xt -xc99=none  none
_________________________________________________________________________
POSIX.1-1990                  c89                _POSIX_SOURCE
_________________________________________________________________________
POSIX.1-1990 and POSIX.2-1992 c89                _POSIX_SOURCE  and
  C-Language Bindings Option                     POSIX_C_SOURCE=2
_________________________________________________________________________
POSIX.1b-1993                 c89                _POSIX_C_SOURCE=199309L
_________________________________________________________________________
POSIX.1c-1996                 c89                _POSIX_C_SOURCE=199506L
_________________________________________________________________________
POSIX.1-2001                  c99                _POSIX_C_SOURCE=200112L
_________________________________________________________________________
POSIX.1c-1996                 c89                _POSIX_C_SOURCE=199506L
_________________________________________________________________________
CAE XPG3                      cc -Xa -xc99=none  _XOPEN_SOURCE
_________________________________________________________________________
CAE XPG4                      c89                _XOPEN_SOURCE and
                                                 _XOPEN_VERSION=4
_________________________________________________________________________
SUS (CAE XPG4v2)              c89                _XOPEN_SOURCE and
  (includes XNS4)                                 _XOPEN_SOURCE_EXTENDED=1
_________________________________________________________________________
SUSv2 (includes XNS5)         c89                _XOPEN_SOURCE=500
_________________________________________________________________________
SUSv3                         c99                _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
SUSv3
c99

_XOPEN_SOURCE=600

See Also

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