2.2. UNIX Standardization2.2.1. ISO CIn late 1989, ANSI Standard X3.1591989 for the C programming language was approved. This standard has also been adopted as international standard ISO/IEC 9899:1990. ANSI is the American National Standards Institute, the U.S. member in the International Organization for Standardization (ISO). IEC stands for the International Electrotechnical Commission.Chapter 7 of ISO 1999; Plauger 1992; Appendix B of Kernighan and Ritchie 1988]. This library is important because all contemporary UNIX systems, such as the ones described in this book, provide the library routines that are specified in the C standard.In 1999, the ISO C standard was updated and approved as ISO/IEC 9899:1999, largely to improve support for applications that perform numerical processing. The changes don't affect the POSIX standards described in this book, except for the addition of the restrict keyword to some of the function prototypes. This keyword is used to tell the compiler which pointer references can be optimized, by indicating that the object to which the pointer refers is accessed in the function only via that pointer.As with most standards, there is a delay between the standard's approval and the modification of software to conform to it. As each vendor's compilation systems evolve, they add more support for the latest version of the ISO C standard.A summary of the current level of conformance of gcc to the 1999 version of the ISO C standard is available at http://www.gnu.org/software/gcc/c99statu361.The ISO C library can be divided into 24 areas, based on the headers defined by the standard. Section 1.7) | |||||
<fenv.h> | • | • | floating-point environment | ||
<float.h> | • | • | • | • | floating-point constants |
<inttypes.h> | • | • | • | • | integer type format conversion |
<iso646.h> | • | • | • | • | alternate relational operator macros |
<limits.h> | • | • | • | • | implementation constants (Section 2.5) |
<locale.h> | • | • | • | • | locale categories |
<math.h> | • | • | • | • | mathematical constants |
<setjmp.h> | • | • | • | • | nonlocal goto (Section 7.10) |
<signal.h> | • | • | • | • | signals (Chapter 10) |
<stdarg.h> | • | • | • | • | variable argument lists |
<stdbool.h> | • | • | • | • | boolean type and values |
<stddef.h> | • | • | • | • | standard definitions |
<stdint.h> | • | • | • | integer types | |
<stdio.h> | • | • | • | • | standard I/O library (Chapter 5) |
<stdlib.h> | • | • | • | • | utility functions |
<string.h> | • | • | • | • | string operations |
<tgmath.h> | • | type-generic math macros | |||
<time.h> | • | • | • | • | time and date (Section 6.10) |
<wchar.h> | • | • | • | • | extended multibyte and wide character support |
<wctype.h> | • | • | • | • | wide character classification and mapping support |
2.2.2. IEEE POSIX
POSIX is a family of standards developed by the IEEE (Institute of Electrical and Electronics Engineers). POSIX stands for Portable Operating System Interface. It originally referred only to the IEEE Standard 1003.11988the operating system interfacebut was later extended to include many of the standards and draft standards with the 1003 designation, including the shell and utilities (1003.2).Of specific interest to this book is the 1003.1 operating system interface standard, whose goal is to promote the portability of applications among various UNIX System environments. This standard defines the services that must be provided by an operating system if it is to be "POSIX compliant," and has been adopted by most computer vendors. Although the 1003.1 standard is based on the UNIX operating IEEE 1990]. This is also the international standard ISO/IEC 99451:1990. This standard is commonly referred to as POSIX.1 , which we'll use in this text.The IEEE 1003.1 working group continued to make changes to the standard. In 1993, a revised version of the IEEE 1003.1 standard was published. It included 1003.1-1990 standard and the 1003.1b-1993 real-time extensions standard. In 1996, the standard was again updated as international standard ISO/IEC 99451:1996. It included interfaces for multithreaded programming, called pthreads for POSIX threads. More real-time interfaces were added in 1999 with the publication of IEEE Standard 1003.1d-1999. A year later, IEEE Standard 1003.1j-2000 was published, including even more real-time interfaces, and IEEE Standard 1003.1q-2000 was published, adding event-tracing extensions to the standard.The 2001 version of 1003.1 departed from the prior versions in that it combined several 1003.1 amendments, the 1003.2 standard, and portions of the Single UNIX Specification (SUS), Version 2 (more on this later). The resulting standard, IEEE Standard 1003.1-2001, includes the following other standards:
- ISO/IEC 9945-1 (IEEE Standard 1003.1-1996), which includes
- IEEE Standard 1003.1-1990
- IEEE Standard 1003.1b-1993 (real-time extensions)
- IEEE Standard 1003.1c-1995 (pthreads)
- IEEE Standard 1003.1i-1995 (real-time technical corrigenda)
- IEEE P1003.1a draft standard (system interface revision)
- IEEE Standard 1003.1d-1999 (advanced real-time extensions)
- IEEE Standard 1003.1j-2000 (more advanced real-time extensions)
- IEEE Standard 1003.1q-2000 (tracing)
- IEEE Standard 1003.2d-1994 (batch extensions)
- IEEE P1003.2b draft standard (additional utilities)
- Parts of IEEE Standard 1003.1g-2000 (protocol-independent interfaces)
- ISO/IEC 9945-2 (IEEE Standard 1003.2-1993)
- The Base Specifications of the Single UNIX Specification, version 2, which include
- System Interface Definitions, Issue 5
- Commands and Utilities, Issue 5
- System Interfaces and Headers, Issue 5
- Open Group Technical Standard, Networking Services, Issue 5.2
- ISO/IEC 9899:1999, Programming Languages - C
Section 4.21)
Code | SUS mandatory | Symbolic constant | Description |
---|---|---|---|
ADV | _POSIX_ADVISORY_INFO | advisory information (real-time) | |
AIO | _POSIX_ASYNCHRONOUS_IO | asynchronous input and output (real-time) | |
BAR | _POSIX_BARRIERS | barriers (real-time) | |
CPT | _POSIX_CPUTIME | process CPU time clocks (real-time) | |
CS | _POSIX_CLOCK_SELECTION | clock selection (real-time) | |
CX | • | extension to ISO C standard | |
FSC | • | _POSIX_FSYNC | file synchronization |
IP6 | _POSIX_IPV6 | IPv6 interfaces | |
MF | • | _POSIX_MAPPED_FILES | memory-mapped files |
ML | _POSIX_MEMLOCK | process memory locking (real-time) | |
MLR | _POSIX_MEMLOCK_RANGE | memory range locking (real-time) | |
MON | _POSIX_MONOTONIC_CLOCK | monotonic clock (real-time) | |
MPR | • | _POSIX_MEMORY_PROTECTION | memory protection |
MSG | _POSIX_MESSAGE_PASSING | message passing (real-time) | |
MX | IEC 60559 floating-point option | ||
PIO | _POSIX_PRIORITIZED_IO | prioritized input and output | |
PS | _POSIX_PRIORITIZED_SCHEDULING | process scheduling (real-time) | |
RS | _POSIX_RAW_SOCKETS | raw sockets | |
RTS | _POSIX_REALTIME_SIGNALS | real-time signals extension | |
SEM | _POSIX_SEMAPHORES | semaphores (real-time) | |
SHM | _POSIX_SHARED_MEMORY_OBJECTS | shared memory objects (real-time) | |
SIO | _POSIX_SYNCHRONIZED_IO | synchronized input and output (real-time) | |
SPI | _POSIX_SPIN_LOCKS | spin locks (real-time) | |
SPN | _POSIX_SPAWN | spawn (real-time) | |
SS | _POSIX_SPORADIC_SERVER | process sporadic server (real-time) | |
TCT | _POSIX_THREAD_CPUTIME | thread CPU time clocks (real-time) | |
TEF | _POSIX_TRACE_EVENT_FILTER | trace event filter | |
THR | • | _POSIX_THREADS | threads |
TMO | _POSIX_TIMEOUTS | timeouts (real-time) | |
TMR | _POSIX_TIMERS | timers (real-time) | |
TPI | _POSIX_THREAD_PRIO_INHERIT | thread priority inheritance (real-time) | |
TPP | _POSIX_THREAD_PRIO_PROTECT | thread priority protection (real-time) | |
TPS | _POSIX_THREAD_PRIORITY_SCHEDULING | thread execution scheduling (real-time) | |
TRC | _POSIX_TRACE | trace | |
TRI | _POSIX_TRACE_INHERIT | trace inherit | |
TRL | _POSIX_TRACE_LOG | trace log | |
TSA | • | _POSIX_THREAD_ATTR_STACKADDR | thread stack address attribute |
TSF | • | _POSIX_THREAD_SAFE_FUNCTIONS | thread-safe functions |
TSH | • | _POSIX_THREAD_PROCESS_SHARED | thread process-shared synchronization |
TSP | _POSIX_THREAD_SPORADIC_SERVER | thread sporadic server (real-time) | |
TSS | • | _POSIX_THREAD_ATTR_STACKSIZE | thread stack address size |
TYM | _POSIX_TYPED_MEMORY_OBJECTS | typed memory objects (real-time) | |
XSI | • | _XOPEN_UNIX | X/Open extended interfaces |
XSR | _XOPEN_STREAMS | XSI STREAMS |
2.2.3. The Single UNIX Specification
The Single UNIX Specification, a superset of the POSIX.1 standard, specifies additional interfaces that extend the functionality provided by the basic POSIX.1 specification. The complete set of system interfaces is called the X/Open System Interface (XSI). The _XOPEN_UNIX symbolic constant identifies interfaces that are part of the XSI extensions to the base POSIX.1 interfaces.The XSI also defines which optional portions of POSIX.1 must be supported for an implementation to be deemed XSI conforming . These include file synchronization, memory-mapped files, memory protection, and thread interfaces, and are marked in Figure 2.5 as "SUS mandatory." Only XSI-conforming implementations can be called UNIX systems.The Open Group owns the UNIX trademark and uses the Single UNIX Specification to define the interfaces an implementation must support to call itself a UNIX system. Implementations must file conformance statements, pass test suites that verify conformance, and license the right to use the UNIX trademark.Some of the additional interfaces defined in the XSI are required, whereas others are optional. The interfaces are divided into option groups based on common functionality, as follows:
- Encryption: denoted by the _XOPEN_CRYPT symbolic constant
- Real-time: denoted by the _XOPEN_REALTIME symbolic constant
- Advanced real-time
- Real-time threads: denoted by the _XOPEN_REALTIME_THREADS symbolic constant
- Advanced real-time threads
- Tracing
- XSI STREAMS: denoted by the _XOPEN_STREAMS symbolic constant
- Legacy: denoted by the _XOPEN_LEGACY symbolic constant
The Single UNIX Specification (SUS) is a publication of The Open Group, which was formed in 1996 as a merger of X/Open and the Open Software Foundation (OSF), both industry consortia. X/Open used to publish the X/Open Portability Guide , which adopted specific standards and filled in the gaps where functionality was missing. The goal of these guides was to improve application portability past what was possible by merely conforming to published standards.The first version of the Single UNIX Specification was published by X/Open in 1994. It was also known as "Spec 1170," because it contained roughly 1,170 interfaces. It grew out of the Common Open Software Environment (COSE) initiative, whose goal was to further improve application portability across all implementations of the UNIX operating system. The COSE groupSun, IBM, HP, Novell/USL, and OSFwent further than endorsing standards. In addition, they investigated interfaces used by common commercial applications. The resulting 1,170 interfaces were selected from these applications, and also included the X/Open Common Application Environment (CAE), Issue 4 (known as "XPG4" as a historical reference to its predecessor, the X/Open Portability Guide), the System V Interface Definition (SVID), Edition 3, Level 1 interfaces, and the OSF Application Environment Specification (AES) Full Use interfaces.The second version of the Single UNIX Specification was published by The Open Group in 1997. The new version added support for threads, real-time interfaces, 64-bit processing, large files, and enhanced multibyte character processing.The third version of the Single UNIX Specification (SUSv3, for short) was published by The Open Group in 2001. The Base Specifications of SUSv3 are the same as the IEEE Standard 1003.1-2001 and are divided into four sections: Base Definitions, System Interfaces, Shell and Utilities, and Rationale. SUSv3 also includes X/Open Curses Issue 4, Version 2, but this specification is not part of POSIX.1.In 2002, ISO approved this version as International Standard ISO/IEC 9945:2002. The Open Group updated the 1003.1 standard again in 2003 to include technical corrections, and ISO approved this as International Standard ISO/IEC 9945:2003. In April 2004, The Open Group published the Single UNIX Specification, Version 3, 2004 Edition. It included more technical corrections edited in with the main text of the standard.
2.2.4. FIPS
