Merge branch 'master' of git://github.com/illumos/illumos-gate
[unleashed.git] / usr / src / man / man5 / standards.5
blob10fd73c1a1cfd1c54bea651951ae468b67171881
1 '\" te
2 .\" Copyright (c) 2007, Sun Microsystems, Inc.  All Rights Reserved.
3 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
5 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
6 .TH STANDARDS 5 "Jan 11, 2015"
7 .SH NAME
8 standards, ANSI, C, C++, ISO, POSIX, POSIX.1, POSIX.2, SUS, SUSv2, SUSv3, SVID,
9 SVID3, XNS, XNS4, XNS5, XPG, XPG3, XPG4, XPG4v2 \- standards and specifications
10 supported by Solaris
11 .SH DESCRIPTION
12 .LP
13 Solaris 10 supports IEEE Std 1003.1 and IEEE Std 1003.2, commonly known as
14 POSIX.1 and POSIX.2, respectively. The following table lists each version of
15 these standards with a brief description and the SunOS or Solaris release that
16 first conformed to it.
17 .sp
19 .sp
20 .TS
21 c c c
22 l l l .
23 POSIX Standard  Description     Release
25 POSIX.1-1988    system interfaces and headers   SunOS 4.1
27 POSIX.1-1990    POSIX.1-1988 update     Solaris 2.0
29 POSIX.1b-1993   realtime extensions     Solaris 2.4
31 POSIX.1c-1996   threads extensions      Solaris 2.6
33 POSIX.2-1992    shell and utilities     Solaris 2.5
35 POSIX.2a-1992   interactive shell and utilities Solaris 2.5
37 POSIX.1-2001    T{
38 POSIX.1-1990, POSIX.1b-1993, POSIX.1c-1996, POSIX.2-1992, and POSIX.2a-1992 updates
39 T}      Solaris 10
40 .TE
42 .sp
43 .LP
44 Solaris 10 also  supports the X/Open Common Applications Environment (CAE)
45 Portability Guide Issue 3 (XPG3) and Issue 4 (XPG4); Single UNIX Specification
46 (SUS, also known as XPG4v2); Single UNIX Specification, Version 2 (SUSv2); and
47 Single UNIX Specification, Version 3 (SUSv3). Both XPG4 and SUS include
48 Networking Services Issue 4 (XNS4). SUSv2 includes Networking Services Issue 5
49 (XNS5).
50 .sp
51 .LP
52 The following table lists each X/Open specification with a brief description
53 and the SunOS or Solaris release that first conformed to it.
54 .sp
56 .sp
57 .TS
58 c c c
59 c c c .
60 X/Open CAE              
62  Specification  Description     Release
64 XPG3    T{
65 superset of POSIX.1-1988 containing utilities from SVID3
66 T}      SunOS 4.1
68 XPG4    T{
69 superset of POSIX.1-1990, POSIX.2-1992, and POSIX.2a-1992 containing extensions to POSIX standards from XPG3
70 T}      Solaris 2.4
72 SUS (XPG4v2)    T{
73 superset of XPG4 containing historical BSD interfaces widely used by common application packages
74 T}      Solaris 2.6
76 XNS4    sockets and XTI interfaces      Solaris 2.6
78 SUSv2   T{
79 superset of SUS extended to support POSIX.1b-1993, POSIX.1c-1996, and ISO/IEC 9899 (C Standard) Amendment 1
80 T}      Solaris 7
82 XNS5    T{
83 superset and LP64-clean derivative of XNS4.
84 T}      Solaris 7
86 SUSv3   same as POSIX.1-2001    Solaris 10
87 .TE
89 .sp
90 .LP
91 The XNS4 specification is safe for use only in ILP32 (32-bit) environments and
92 should not be used for LP64 (64-bit) application environments. Use XNS5 or
93 SUSv3, which have LP64-clean interfaces that are portable across ILP32 and LP64
94 environments. Solaris releases 7 through 10 support both the ILP32 and LP64
95 environments.
96 .sp
97 .LP
98 Solaris releases 7 through 10 have been branded to conform to The Open Group's
99 UNIX 98 Product Standard. Solaris 10 has been branded to conform to The Open
100 Group's UNIX 03 Product Standard.
103 Solaris releases 2.0 through 10 support the interfaces specified by the System
104 V Interface Definition, Third Edition, Volumes 1 through 4 (SVID3).  Note,
105 however, that since the developers of this specification (UNIX Systems
106 Laboratories) are no longer in business and since this specification defers to
107 POSIX and X/Open CAE specifications, there is some disagreement about what is
108 currently required for conformance to this specification.
111 When \fBSun Studio C Compiler 5.6\fR is installed, Solaris releases 2.0 through
112 10 support the ANSI X3.159-1989 Programming Language - C and ISO/IEC 9899:1990
113 Programming Language - C (C) interfaces.
116 When \fBSun Studio C Compiler 5.6\fR is installed, Solaris releases 7 through
117 10 support ISO/IEC 9899:1990 Amendment 1:1995: C Integrity.
120 When \fBSun Studio C Compiler 5.6\fR is installed, Solaris 10 supports ISO/IEC
121 9899:1999 Programming Languages - C.
124 When \fBSun Studio C++ Compiler 5.6\fR is installed, Solaris releases 2.5.1
125 through 10 support ISO/IEC 14882:1998 Programming Languages - C++.  Unsupported
126 features of that standard are described in the compiler README file.
127 .SS "Utilities"
129 If the behavior required by POSIX.2, POSIX.2a, XPG4, SUS, or SUSv2 conflicts
130 with historical Solaris utility behavior, the original Solaris version of the
131 utility is unchanged; a new version that is standard-conforming has been
132 provided in \fB/usr/xpg4/bin\fR. If the behavior required by POSIX.1-2001 or
133 SUSv3 conflicts with historical Solaris utility behavior, a new version that is
134 standard-conforming has been provided in \fB/usr/xpg4/bin\fR or in
135 \fB/usr/xpg6/bin\fR. If the behavior required by POSIX.1-2001 or SUSv3
136 conflicts with POSIX.2, POSIX.2a, SUS, or SUSv2, a new version that is SUSv3
137 standard-conforming has been provided in \fB/usr/xpg6/bin\fR.
140 An application that wants to use standard-conforming utilitues must set the
141 \fBPATH\fR (\fBsh\fR(1) or \fBksh\fR(1)) or \fBpath\fR (\fBcsh\fR(1))
142 environment variable to specify the directories listed below in the order
143 specified to get the appropriate utilities:
145 .ne 2
147 \fBSVID3, XPG3\fR
149 .sp .6
150 .RS 4n
151 .RS +4
154 \fB/usr/ccs/bin\fR
156 .RS +4
159 \fB/usr/bin\fR
161 .RS +4
164 directory containing binaries for your compiler
166 .RS +4
169 other directories containing binaries needed by the application
174 .ne 2
176 \fBPOSIX.2, POSIX.2a, SUS, SUSv2, XPG4\fR
178 .sp .6
179 .RS 4n
180 .RS +4
183 \fB/usr/xpg4/bin\fR
185 .RS +4
188 \fB/usr/ccs/bin\fR
190 .RS +4
193 \fB/usr/bin\fR
195 .RS +4
198 directory containing binaries for your compiler
200 .RS +4
203 other directories containing binaries needed by the application
208 .ne 2
210 \fBPOSIX.1-2001, SUSv3\fR
212 .sp .6
213 .RS 4n
214 .RS +4
217 \fB/usr/xpg6/bin\fR
219 .RS +4
222 \fB/usr/xpg4/bin\fR
224 .RS +4
227 \fB/usr/ccs/bin\fR
229 .RS +4
232 \fB/usr/bin\fR
234 .RS +4
237 directory containing binaries for your compiler
239 .RS +4
242 other directories containing binaries needed by the application
246 .SS "Feature Test Macros"
248 Feature test macros are used by applications to indicate additional sets of
249 features that are desired beyond those specified by the C standard. If an
250 application uses only those interfaces and headers defined by a particular
251 standard (such as POSIX or X/Open CAE),  then it need only define the
252 appropriate feature test macro specified by that standard. If the application
253 is using interfaces and headers not defined by that standard, then in addition
254 to defining the appropriate standard feature test macro, it must also define
255 \fB__EXTENSIONS__\fR. Defining \fB__EXTENSIONS__\fR provides the application
256 with access to all interfaces and headers not in conflict with the specified
257 standard. The application must define \fB__EXTENSIONS__\fR either on the
258 compile command line or within the application source files.
259 .SS "1989 ANSI C, 1990 ISO C, 1999 ISO C"
261 No feature test macros need to be defined to indicate that an application is a
262 conforming C application.
263 .SS "ANSI/ISO C++"
265 ANSI/ISO C++ does not define any feature test macros. If the standard C++
266 announcement macro \fB__cplusplus\fR is predefined to value 199711 or greater,
267 the compiler operates in a standard-conforming mode, indicating C++ standards
268 conformance. The value 199711 indicates conformance to ISO/IEC 14882:1998, as
269 required by that standard.  (As noted above, conformance to the standard is
270 incomplete.)  A standard-conforming mode is not available with compilers prior
271 to Sun WorkShop C++ 5.0.
274 C++ bindings are not defined for POSIX or X/Open CAE, so specifying feature
275 test macros such as \fB_POSIX_SOURCE\fR, \fB_POSIX_C_SOURCE\fR, and
276 \fB_XOPEN_SOURCE\fR can result in compilation errors due to conflicting
277 requirements of standard C++ and those specifications.
278 .SS "POSIX"
280 Applications that are intended to be conforming POSIX.1 applications must
281 define the feature test macros specified by the standard before including any
282 headers.  For the standards listed below, applications must define the feature
283 test macros listed.  Application writers must check the corresponding standards
284 for other macros that can be queried to determine if desired options are
285 supported by the implementation.
290 c c
291 l l .
292 \fBPOSIX Standard\fR    \fBFeature Test Macros\fR
294 POSIX.1-1990    \fB_POSIX_SOURCE\fR
297 POSIX.1-1990 and POSIX.2-1992  C-Language Bindings Option
298 T}      \fB_POSIX_SOURCE\fR and \fB_POSIX_C_SOURCE=2\fR
299 POSIX.1b-1993   \fB_POSIX_C_SOURCE=199309L\fR
301 POSIX.1c-1996   \fB_POSIX_C_SOURCE=199506L\fR
303 POSIX.1-2001    \fB_POSIX_C_SOURCE=200112L\fR
306 .SS "SVID3"
308 The SVID3 specification does not specify any feature test macros to indicate
309 that an application is written to meet SVID3 requirements.  The SVID3
310 specification was written before the C standard was completed.
311 .SS "X/Open CAE"
313 To build or compile an application that conforms to one of the X/Open CAE
314 specifications, use the following guidelines. Applications need not set the
315 POSIX feature test macros if they require both CAE and POSIX functionality.
317 .ne 2
319 \fBXPG3\fR
321 .RS 16n
322 The application must define \fB_XOPEN_SOURCE\fR. If \fB_XOPEN_SOURCE\fR is
323 defined with a value, the value must be less than 500.
327 .ne 2
329 \fBXPG4\fR
331 .RS 16n
332 The application must define \fB_XOPEN_SOURCE\fR and set \fB_XOPEN_VERSION=4\fR.
333 If \fB_XOPEN_SOURCE\fR is defined with a value, the value must be less than
334 500.
338 .ne 2
340 \fBSUS (XPG4v2)\fR
342 .RS 16n
343 The application must define \fB_XOPEN_SOURCE\fR and set
344 \fB_XOPEN_SOURCE_EXTENDED=1\fR. If \fB_XOPEN_SOURCE\fR is defined with a value,
345 the value must be less than 500.
349 .ne 2
351 \fBSUSv2\fR
353 .RS 16n
354 The application must define \fB_XOPEN_SOURCE=500\fR.
358 .ne 2
360 \fBSUSv3\fR
362 .RS 16n
363 The application must define \fB_XOPEN_SOURCE=600\fR.
366 .SS "Compilation"
368 A POSIX.1 (1988-1996)-, XPG4-, SUS-, or SUSv2-conforming implementation must
369 include an ANSI X3.159-1989 (ANSI C Language) standard-conforming compilation
370 system and the \fBcc\fR and \fBc89\fR utilities. A POSIX.1-2001- or
371 SUSv3-conforming implementation must include an ISO/IEC 99899:1999 (1999 ISO C
372 Language) standard-conforming compilation system and the \fBc99\fR utility.
373 Solaris 10 was tested with the \fBcc\fR, \fBc89\fR, and \fBc99\fR utilities and
374 the compilation environment provided by \fBSun Studio C Compiler 5.6\fR.
377 When \fBcc\fR is used to link applications, \fB/usr/lib/values-xpg4.o\fR must
378 be specified on any link/load command line, unless the application is
379 POSIX.1-2001- or SUSv3-conforming, in which case \fB/usr/lib/values-xpg6.o\fR
380 must be specified on any link/load compile line. The preferred way to build
381 applications, however, is described in the table below.
384 An XNS4- or XNS5-conforming application must include \fB-l\fR \fBXNS\fR on any
385 link/load command line in addition to defining the feature test macros
386 specified for SUS or SUSv2, respectively.
389 If the compiler suppports the \fBredefine_extname\fR pragma feature (the \fBSun
390 Studio C Compiler 5.6\fR compilers define the macro
391 \fB__PRAGMA_REDEFINE_EXTNAME\fR to indicate that it supports this feature),
392 then the standard headers use \fB#pragma\fR \fBredefine_extname\fR directives
393 to properly map function names onto library entry point names. This mapping
394 provides full support for ISO C, POSIX, and X/Open namespace reservations.
397 If this pragma feature is not supported by the compiler, the headers use the
398 \fB#define\fR directive to map internal function names onto appropriate library
399 entry point names. In this instance, applications should avoid using the
400 explicit 64-bit file offset symbols listed on the \fBlf64\fR(5) manual page,
401 since these names are used by the implementation to name the alternative entry
402 points.
405 When using \fBSun Studio C Compiler 5.6\fR compilers, applications conforming
406 to the specifications listed above should be compiled using the utilities and
407 flags indicated in the following table:
409 .in +2
411 Specification            Compiler/Flags         Feature Test Macros
412 _________________________________________________________________________
413 1989 ANSI C and 1990 ISO C    c89                none
414 _________________________________________________________________________
415 1999 ISO C                    c99                none
416 _________________________________________________________________________
417 2011 ISO C                    c11                none
418                               gcc -stdc=c11
419 _________________________________________________________________________
420 SVID3                         cc -Xt -xc99=none  none
421 _________________________________________________________________________
422 POSIX.1-1990                  c89                _POSIX_SOURCE
423 _________________________________________________________________________
424 POSIX.1-1990 and POSIX.2-1992 c89                _POSIX_SOURCE  and
425   C-Language Bindings Option                     POSIX_C_SOURCE=2
426 _________________________________________________________________________
427 POSIX.1b-1993                 c89                _POSIX_C_SOURCE=199309L
428 _________________________________________________________________________
429 POSIX.1c-1996                 c89                _POSIX_C_SOURCE=199506L
430 _________________________________________________________________________
431 POSIX.1-2001                  c99                _POSIX_C_SOURCE=200112L
432 _________________________________________________________________________
433 CAE XPG3                      cc -Xa -xc99=none  _XOPEN_SOURCE
434 _________________________________________________________________________
435 CAE XPG4                      c89                _XOPEN_SOURCE and
436                                                  _XOPEN_VERSION=4
437 _________________________________________________________________________
438 SUS (CAE XPG4v2)              c89                _XOPEN_SOURCE and
439   (includes XNS4)                                 _XOPEN_SOURCE_EXTENDED=1
440 _________________________________________________________________________
441 SUSv2 (includes XNS5)         c89                _XOPEN_SOURCE=500
442 _________________________________________________________________________
443 SUSv3                         c99                _XOPEN_SOURCE=600
445 .in -2
450 For platforms supporting the LP64 (64-bit) programming environment,
451 SUSv2-conforming LP64 applications using XNS5 library calls should be built
452 with command lines of the form:
454 .in +2
456 c89 $(getconf XBS5_LP64_OFF64_CFLAGS) -D_XOPEN_SOURCE=500 \e
457     $(getconf XBS5_LP64_OFF64_LDFLAGS) foo.c -o foo \e
458     $(getconf XBS5_LP64_OFF64_LIBS)
460 .in -2
464 Similar SUSv3-conforming LP64 applications should be built with command lines
465 of the form:
467 .in +2
469 c99 $(getconf POSIX_V6_LP64_OFF64_CFLAGS) -D_XOPEN_SOURCE=600 \e
470     $(getconf POSIX_V6_LP64_OFF64_LDFLAGS) foo.c -o foo \e
471     $(getconf POSIX_V6_LP64_OFF64_LIBS)
473 .in -2
475 .SS "SUSv3"
476 .ne 2
478 \fB\fBc99\fR\fR
480 .RS 28n
481 \fB_XOPEN_SOURCE=600\fR
484 .SH SEE ALSO
486 \fBcsh\fR(1), \fBksh\fR(1), \fBsh\fR(1), \fBexec\fR(2), \fBsysconf\fR(3C),
487 \fBsystem\fR(3C), \fBenviron\fR(5), \fBlf64\fR(5)