1standards(5) Standards, Environments, and Macros standards(5)
2
3
4
6 standards, ANSI, C, C++, ISO, POSIX, POSIX.1, POSIX.2, SUS, SUSv2,
7 SUSv3, SVID, SVID3, XNS, XNS4, XNS5, XPG, XPG3, XPG4, XPG4v2 - stan‐
8 dards and specifications supported by Solaris
9
11 Solaris 10 supports IEEE Std 1003.1 and IEEE Std 1003.2, commonly known
12 as POSIX.1 and POSIX.2, respectively. The following table lists each
13 version of these standards with a brief description and the SunOS or
14 Solaris release that first conformed to it.
15
16
17
18
19 POSIX Standard Description Release
20 ─────────────────────────────────────────────────────────────────
21 POSIX.1-1988 system interfaces and headers SunOS 4.1
22 ─────────────────────────────────────────────────────────────────
23 POSIX.1-1990 POSIX.1-1988 update Solaris 2.0
24 ─────────────────────────────────────────────────────────────────
25 POSIX.1b-1993 realtime extensions Solaris 2.4
26 ─────────────────────────────────────────────────────────────────
27 POSIX.1c-1996 threads extensions Solaris 2.6
28 ─────────────────────────────────────────────────────────────────
29 POSIX.2-1992 shell and utilities Solaris 2.5
30 ─────────────────────────────────────────────────────────────────
31 POSIX.2a-1992 interactive shell and utilities Solaris 2.5
32 ─────────────────────────────────────────────────────────────────
33 POSIX.1-2001 POSIX.1-1990, POSIX.1b-1993, Solaris 10
34 POSIX.1c-1996, POSIX.2-1992, and
35 POSIX.2a-1992 updates
36
37
38
39 Solaris 10 also supports the X/Open Common Applications Environment
40 (CAE) Portability Guide Issue 3 (XPG3) and Issue 4 (XPG4); Single UNIX
41 Specification (SUS, also known as XPG4v2); Single UNIX Specification,
42 Version 2 (SUSv2); and Single UNIX Specification, Version 3 (SUSv3).
43 Both XPG4 and SUS include Networking Services Issue 4 (XNS4). SUSv2
44 includes Networking Services Issue 5 (XNS5).
45
46
47 The following table lists each X/Open specification with a brief
48 description and the SunOS or Solaris release that first conformed to
49 it.
50
51
52
53
54 X/Open CAE
55 ─────────────────────────────────────────────────────────────────
56 Specification Description Release
57 ─────────────────────────────────────────────────────────────────
58 XPG3 superset of POSIX.1-1988 contain‐ SunOS 4.1
59 ing utilities from SVID3
60 ─────────────────────────────────────────────────────────────────
61 XPG4 superset of POSIX.1-1990, Solaris 2.4
62 POSIX.2-1992, and POSIX.2a-1992
63 containing extensions to POSIX
64 standards from XPG3
65 ─────────────────────────────────────────────────────────────────
66
67 SUS (XPG4v2) superset of XPG4 containing his‐ Solaris 2.6
68 torical BSD interfaces widely
69 used by common application pack‐
70 ages
71 ─────────────────────────────────────────────────────────────────
72 XNS4 sockets and XTI interfaces Solaris 2.6
73 ─────────────────────────────────────────────────────────────────
74 SUSv2 superset of SUS extended to sup‐ Solaris 7
75 port POSIX.1b-1993,
76 POSIX.1c-1996, and ISO/IEC 9899
77 (C Standard) Amendment 1
78 ─────────────────────────────────────────────────────────────────
79 XNS5 superset and LP64-clean deriva‐ Solaris 7
80 tive of XNS4.
81 ─────────────────────────────────────────────────────────────────
82 SUSv3 same as POSIX.1-2001 Solaris 10
83
84
85
86 The XNS4 specification is safe for use only in ILP32 (32-bit) environ‐
87 ments and should not be used for LP64 (64-bit) application environ‐
88 ments. Use XNS5 or SUSv3, which have LP64-clean interfaces that are
89 portable across ILP32 and LP64 environments. Solaris releases 7 through
90 10 support both the ILP32 and LP64 environments.
91
92
93 Solaris releases 7 through 10 have been branded to conform to The Open
94 Group's UNIX 98 Product Standard. Solaris 10 has been branded to con‐
95 form to The Open Group's UNIX 03 Product Standard.
96
97
98 Solaris releases 2.0 through 10 support the interfaces specified by the
99 System V Interface Definition, Third Edition, Volumes 1 through 4
100 (SVID3). Note, however, that since the developers of this specifica‐
101 tion (UNIX Systems Laboratories) are no longer in business and since
102 this specification defers to POSIX and X/Open CAE specifications, there
103 is some disagreement about what is currently required for conformance
104 to this specification.
105
106
107 When Sun Studio C Compiler 5.6 is installed, Solaris releases 2.0
108 through 10 support the ANSI X3.159-1989 Programming Language - C and
109 ISO/IEC 9899:1990 Programming Language - C (C) interfaces.
110
111
112 When Sun Studio C Compiler 5.6 is installed, Solaris releases 7 through
113 10 support ISO/IEC 9899:1990 Amendment 1:1995: C Integrity.
114
115
116 When Sun Studio C Compiler 5.6 is installed, Solaris 10 supports
117 ISO/IEC 9899:1999 Programming Languages - C.
118
119
120 When Sun Studio C++ Compiler 5.6 is installed, Solaris releases 2.5.1
121 through 10 support ISO/IEC 14882:1998 Programming Languages - C++.
122 Unsupported features of that standard are described in the compiler
123 README file.
124
125 Utilities
126 If the behavior required by POSIX.2, POSIX.2a, XPG4, SUS, or SUSv2 con‐
127 flicts with historical Solaris utility behavior, the original Solaris
128 version of the utility is unchanged; a new version that is standard-
129 conforming has been provided in /usr/xpg4/bin. If the behavior required
130 by POSIX.1-2001 or SUSv3 conflicts with historical Solaris utility
131 behavior, a new version that is standard-conforming has been provided
132 in /usr/xpg4/bin or in /usr/xpg6/bin. If the behavior required by
133 POSIX.1-2001 or SUSv3 conflicts with POSIX.2, POSIX.2a, SUS, or SUSv2,
134 a new version that is SUSv3 standard-conforming has been provided in
135 /usr/xpg6/bin.
136
137
138 An application that wants to use standard-conforming utilitues must set
139 the PATH (sh(1) or ksh(1)) or path (csh(1)) environment variable to
140 specify the directories listed below in the order specified to get the
141 appropriate utilities:
142
143 SVID3, XPG3
144
145
146 1. /usr/ccs/bin
147
148 2. /usr/bin
149
150 3. directory containing binaries for your compiler
151
152 4. other directories containing binaries needed by the
153 application
154
155
156 POSIX.2, POSIX.2a, SUS, SUSv2, XPG4
157
158
159 1. /usr/xpg4/bin
160
161 2. /usr/ccs/bin
162
163 3. /usr/bin
164
165 4. directory containing binaries for your compiler
166
167 5. other directories containing binaries needed by the
168 application
169
170
171 POSIX.1-2001, SUSv3
172
173
174 1. /usr/xpg6/bin
175
176 2. /usr/xpg4/bin
177
178 3. /usr/ccs/bin
179
180 4. /usr/bin
181
182 5. directory containing binaries for your compiler
183
184 6. other directories containing binaries needed by the
185 application
186
187
188
189 When an application uses execlp() or execvp() (see exec(2)) to execute
190 a shell file, or uses system(3C), the shell used to interpret the shell
191 file depends on the standard to which the caller conforms:
192
193
194
195
196 Standard Shell Used
197 ───────────────────────────────────────────────────────────────
198
199 1989 ANSI C, 1990 ISO C, 1999 ISO C, /usr/xpg4/bin/sh
200 POSIX.1 (1990-2001), SUS, SUSv2, SUSv3,
201 XPG4
202 POSIX.1 (1988), SVID3, XPG3, no standard /usr/bin/sh
203 specified
204
205
206 Feature Test Macros
207 Feature test macros are used by applications to indicate additional
208 sets of features that are desired beyond those specified by the C stan‐
209 dard. If an application uses only those interfaces and headers defined
210 by a particular standard (such as POSIX or X/Open CAE), then it need
211 only define the appropriate feature test macro specified by that stan‐
212 dard. If the application is using interfaces and headers not defined by
213 that standard, then in addition to defining the appropriate standard
214 feature test macro, it must also define __EXTENSIONS__. Defining
215 __EXTENSIONS__ provides the application with access to all interfaces
216 and headers not in conflict with the specified standard. The applica‐
217 tion must define __EXTENSIONS__ either on the compile command line or
218 within the application source files.
219
220 1989 ANSI C, 1990 ISO C, 1999 ISO C
221 No feature test macros need to be defined to indicate that an applica‐
222 tion is a conforming C application.
223
224 ANSI/ISO C++
225 ANSI/ISO C++ does not define any feature test macros. If the standard
226 C++ announcement macro __cplusplus is predefined to value 199711 or
227 greater, the compiler operates in a standard-conforming mode, indicat‐
228 ing C++ standards conformance. The value 199711 indicates conformance
229 to ISO/IEC 14882:1998, as required by that standard. (As noted above,
230 conformance to the standard is incomplete.) A standard-conforming mode
231 is not available with compilers prior to Sun WorkShop C++ 5.0.
232
233
234 C++ bindings are not defined for POSIX or X/Open CAE, so specifying
235 feature test macros such as _POSIX_SOURCE, _POSIX_C_SOURCE, and
236 _XOPEN_SOURCE can result in compilation errors due to conflicting
237 requirements of standard C++ and those specifications.
238
239 POSIX
240 Applications that are intended to be conforming POSIX.1 applications
241 must define the feature test macros specified by the standard before
242 including any headers. For the standards listed below, applications
243 must define the feature test macros listed. Application writers must
244 check the corresponding standards for other macros that can be queried
245 to determine if desired options are supported by the implementation.
246
247
248
249
250 POSIX Standard Feature Test Macros
251 ──────────────────────────────────────────────────────────────────
252 POSIX.1-1990 _POSIX_SOURCE
253 ──────────────────────────────────────────────────────────────────
254 POSIX.1-1990 and _POSIX_SOURCE and _POSIX_C_SOURCE=2
255 POSIX.2-1992 C-Language
256 Bindings Option
257 POSIX.1b-1993 _POSIX_C_SOURCE=199309L
258 ──────────────────────────────────────────────────────────────────
259 POSIX.1c-1996 _POSIX_C_SOURCE=199506L
260 ──────────────────────────────────────────────────────────────────
261 POSIX.1-2001 _POSIX_C_SOURCE=200112L
262
263
264 SVID3
265 The SVID3 specification does not specify any feature test macros to
266 indicate that an application is written to meet SVID3 requirements.
267 The SVID3 specification was written before the C standard was com‐
268 pleted.
269
270 X/Open CAE
271 To build or compile an application that conforms to one of the X/Open
272 CAE specifications, use the following guidelines. Applications need not
273 set the POSIX feature test macros if they require both CAE and POSIX
274 functionality.
275
276 XPG3 The application must define _XOPEN_SOURCE. If
277 _XOPEN_SOURCE is defined with a value, the value must
278 be less than 500.
279
280
281 XPG4 The application must define _XOPEN_SOURCE and set
282 _XOPEN_VERSION=4. If _XOPEN_SOURCE is defined with a
283 value, the value must be less than 500.
284
285
286 SUS (XPG4v2) The application must define _XOPEN_SOURCE and set
287 _XOPEN_SOURCE_EXTENDED=1. If _XOPEN_SOURCE is defined
288 with a value, the value must be less than 500.
289
290
291 SUSv2 The application must define _XOPEN_SOURCE=500.
292
293
294 SUSv3 The application must define _XOPEN_SOURCE=600.
295
296
297 Compilation
298 A POSIX.1 (1988-1996)-, XPG4-, SUS-, or SUSv2-conforming implementation
299 must include an ANSI X3.159-1989 (ANSI C Language) standard-conforming
300 compilation system and the cc and c89 utilities. A POSIX.1-2001- or
301 SUSv3-conforming implementation must include an ISO/IEC 99899:1999
302 (1999 ISO C Language) standard-conforming compilation system and the
303 c99 utility. Solaris 10 was tested with the cc, c89, and c99 utilities
304 and the compilation environment provided by Sun Studio C Compiler 5.6.
305
306
307 When cc is used to link applications, /usr/lib/values-xpg4.o must be
308 specified on any link/load command line, unless the application is
309 POSIX.1-2001- or SUSv3-conforming, in which case /usr/lib/values-xpg6.o
310 must be specified on any link/load compile line. The preferred way to
311 build applications, however, is described in the table below.
312
313
314 An XNS4- or XNS5-conforming application must include -l XNS on any
315 link/load command line in addition to defining the feature test macros
316 specified for SUS or SUSv2, respectively.
317
318
319 If the compiler suppports the redefine_extname pragma feature (the Sun
320 Studio C Compiler 5.6 compilers define the macro __PRAGMA_REDE‐
321 FINE_EXTNAME to indicate that it supports this feature), then the stan‐
322 dard headers use #pragma redefine_extname directives to properly map
323 function names onto library entry point names. This mapping provides
324 full support for ISO C, POSIX, and X/Open namespace reservations.
325
326
327 If this pragma feature is not supported by the compiler, the headers
328 use the #define directive to map internal function names onto appropri‐
329 ate library entry point names. In this instance, applications should
330 avoid using the explicit 64-bit file offset symbols listed on the
331 lf64(5) manual page, since these names are used by the implementation
332 to name the alternative entry points.
333
334
335 When using Sun Studio C Compiler 5.6 compilers, applications conforming
336 to the specifications listed above should be compiled using the utili‐
337 ties and flags indicated in the following table:
338
339 Specification Compiler/Flags Feature Test Macros
340 _________________________________________________________________________
341 1989 ANSI C and 1990 ISO C c89 none
342 _________________________________________________________________________
343 1999 ISO C c99 none
344 _________________________________________________________________________
345 SVID3 cc -Xt -xc99=none none
346 _________________________________________________________________________
347 POSIX.1-1990 c89 _POSIX_SOURCE
348 _________________________________________________________________________
349 POSIX.1-1990 and POSIX.2-1992 c89 _POSIX_SOURCE and
350 C-Language Bindings Option POSIX_C_SOURCE=2
351 _________________________________________________________________________
352 POSIX.1b-1993 c89 _POSIX_C_SOURCE=199309L
353 _________________________________________________________________________
354 POSIX.1c-1996 c89 _POSIX_C_SOURCE=199506L
355 _________________________________________________________________________
356 POSIX.1-2001 c99 _POSIX_C_SOURCE=200112L
357 _________________________________________________________________________
358 POSIX.1c-1996 c89 _POSIX_C_SOURCE=199506L
359 _________________________________________________________________________
360 CAE XPG3 cc -Xa -xc99=none _XOPEN_SOURCE
361 _________________________________________________________________________
362 CAE XPG4 c89 _XOPEN_SOURCE and
363 _XOPEN_VERSION=4
364 _________________________________________________________________________
365 SUS (CAE XPG4v2) c89 _XOPEN_SOURCE and
366 (includes XNS4) _XOPEN_SOURCE_EXTENDED=1
367 _________________________________________________________________________
368 SUSv2 (includes XNS5) c89 _XOPEN_SOURCE=500
369 _________________________________________________________________________
370 SUSv3 c99 _XOPEN_SOURCE=600
371
372
373
374
375 For platforms supporting the LP64 (64-bit) programming environment,
376 SUSv2-conforming LP64 applications using XNS5 library calls should be
377 built with command lines of the form:
378
379 c89 $(getconf XBS5_LP64_OFF64_CFLAGS) -D_XOPEN_SOURCE=500 \
380 $(getconf XBS5_LP64_OFF64_LDFLAGS) foo.c -o foo \
381 $(getconf XBS5_LP64_OFF64_LIBS) -lxnet
382
383
384
385 Similar SUSv3-conforming LP64 applications should be built with command
386 lines of the form:
387
388 c99 $(getconf POSIX_V6_LP64_OFF64_CFLAGS) -D_XOPEN_SOURCE=600 \
389 $(getconf POSIX_V6_LP64_OFF64_LDFLAGS) foo.c -o foo \
390 $(getconf POSIX_V6_LP64_OFF64_LIBS) -lxnet
391
392
393 SUSv3
394 c99 _XOPEN_SOURCE=600
395
396
398 csh(1), ksh(1), sh(1), exec(2), sysconf(3C), system(3C), environ(5),
399 lf64(5)
400
401
402
403SunOS 5.11 14 Jan 2004 standards(5)