【正文】
e 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 . member in the International Organization for Standardization (ISO). IEC stands for the International Electrotechnical Commission.The C standard is now maintained and developed by the ISO/IEC international standardization working group for the C programming language, known as ISO/IEC JTC1/SC22/WG14, or WG14 for short. The intent of the ISO C standard is to provide portability of conforming C programs to a wide variety of operating systems, not only the UNIX System. This standard defines not only the syntax and semantics of the programming language but also a standard library [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.IEEE POSIXPOSIX 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 operating system interfacebut was later extended to include many of the standards and draft standards with the 1003 designation, including the shell and utilities ().Of specific interest to this book is the 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 pliant, and has been adopted by most puter vendors. Although the standard is based on the UNIX operating system, the standard is not restricted to UNIX and UNIXlike systems. Indeed, some vendors supplying proprietary operating systems claim that these systems have been made POSIX pliant, while still leaving all their proprietary features in place.Because the standard specifies an interface and not an implementation, no distinction is made between system calls and library functions. All the routines in the standard are called functions.Standards are continually evolving, and the standard is no exception. The 1988 version of this standard, IEEE Standard , was modified and submitted to the International Organization for Standardization. No new interfaces or features were added, but the text was revised. The resulting document was published as IEEE Std [IEEE 1990]. This is also the international standard ISO/IEC 99451:1990. This standard is monly referred to as , which we39。ll use in this text.The IEEE working group continued to make changes to the standard. In 1993, a revised version of the IEEE standard was published. It included standard and the realtime 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 realtime interfaces were added in 1999 with the publication of IEEE Standard . A year later, IEEE Standard was published, including even more realtime interfaces, and IEEE Standard was published, adding eventtracing extensions to the standard. does not include the notion of a superuser. Instead, certain operations require appropriate privileges, although leaves the definition of this term up to the implementation. UNIX systems that conform to the Department of Defense security guidelines have many levels of security. In this text, however, we use the traditional terminology and refer to operations that require superuser privilege.附錄BU N I X和C程序設計語言的標準化工作已經做了很多。雖然U N I X應用程序在不同的U N I X版本之間進行移植相當容易,但是8 0年代U N I X版本的劇增以及它們之間差別的擴大導致很多大用戶(例如美國政府)要求對其進行標準化。本章將介紹正在進行的各種標準化工作,然后討論這些標準對本書所列舉的實際U N I X實現(xiàn)的影響。所有標準化工作的一個重要部分是對每種實現(xiàn)必須定義的各種限制的說明,所以我們將說明這些限制以及確定它們值的多種方法。UNIX標準化ISO C1 9 8 9年后期,C程序設計語言的A N S I標準X 3 . 1 5 9 1 9 8 9得到批準〔ANSI 1989〕。此標準已被采用為國際標準ISO/IEC 9899:1990。A N S I是美國國家標準學會,它是由制造商和用戶組成的非贏利性組織。在美國,它是全國性的無償標準交換站,在國際標準化組織( I S O )中是代表美國的成員。ANSI C標準的意圖是提供C程序的可移植性,使其能適合于大量不同的操作系統(tǒng),而不只是UN I X。此標準不僅定義了C程序設計語言的語法和語義,也定義了其標準庫〔ANSI 1989第4章;Plauger 1992。Kernighan及Ritchie 1988中的附錄B〕。因為很多新的U N I X系統(tǒng)(例如本書介紹的幾個U N I X系統(tǒng))都提供C標準中說明的庫函數,所以此庫對我們來講是很重要的。按照該標準定義的各個頭文件,可將該庫分成1 5區(qū)。表2 1中列出了C標準定義的頭文件,以及下面幾節(jié)中說明的另外兩個標準( P O S I X . 1和X P G 3 )定義的頭文件。在其中也列舉了S V R 4和4 . 3 + B S D所支持的頭文件。本章也將對這兩種U N I X實現(xiàn)進行說明。IEEE POSIXP O S I X是一個由I E E E (電氣和電子工程師學會)制訂的標準族。P O S I X的意思是計算機環(huán)境的可移植操作系統(tǒng)界面(Portable Operating System Interface for Computer Environment)。它原來指的只是I E E E標準1 0 0 3 . 1 1 9 8 8 (操作系統(tǒng)界面),但是, I E E E目前正在制訂P O S I X族中的其他有關標準。例如, 1 0 0 3 . 2將是針對s h e l l和公用程序的標準, 1 0 0 3 . 7將是系統(tǒng)管理方面的標準。在1 0 0 3工作組中至少有1 5個子委員會。與本書相關的是1 0 0 3 . 1操作系統(tǒng)界面標準,該標準定義了“ P O S I X依從的”操作系統(tǒng)必須提供的服務。雖然1 0 0 3 . 1標準是以U N I X操作系統(tǒng)為基礎的,但是它又不僅僅限于U N I X和類似于U N I X的系統(tǒng)。確實,有些供應專有操作系統(tǒng)的制造商也聲稱這些系統(tǒng)將依從P O S I X (同時還保有它們的所有專有功能)。由于1 0 0 3 . 1標準說明了一個界面( i n t e r f a c e)而不是一種實現(xiàn)( i m p l e m e n t a t i o n),所以并不區(qū)分系統(tǒng)調用和庫函數。所有在標準中的例程都被稱為函數。標準是不斷演變的, 1 0 0 3 . 1標準也不例外。該標準的1 9 8 8版,IEEE S O,沒有增加新的界面或功能,但修改了文本。最終的文檔作為IEEE 〔IEEE 1990 〕,這也就是國際標準ISO/IEC 99451:1990 。該標準通常被稱之為P O S I X . 1,本書將使用此標準。IEEE ,它們在1 9 9 3年被批準。這些修改(現(xiàn)在稱之為1 0 0 3 . 1 a )應由I E E E作為I E E E標準1 0 0 3 . 1 1 9 9 0的附件出版,這些修改也對本書有所影響,主要是因為伯克利風格的符號鏈接很可能將被加到標準中作為一種要求的功能。這些修改也很可能成為ISO/IEC 99451:1990的一個附錄。本書將用注釋的方法來說明P O S I X . 1的1 0 0 3 . 1 a版本,指出哪些功能很可能會加到1 0 0 3 . 1 a中。P O S I X . 1沒有包括超級用戶這樣的概念。代之以規(guī)定某些操作要求“適當的優(yōu)先權”,P O S I X . 1將此術語的定義留由具體實現(xiàn)進行解釋。某些符合國防部安全性指導原則要求的U n i x系統(tǒng)具有很多不同的安全級。本書仍使用傳統(tǒng)的U N I X術語,并指明要求超級用戶特權的操作。