1、Information technology Portable Operating System Interface (POSIX) y t x ISO/IEC/IEEE9945 vwtrrttrsy trrrswttrsyru9 trsx 9 trsx vwtrrttrsy COPYRIGHT PROTECTED DOCUMENT9 trsx zvrs u stsv srrsxwyvsttyvrsss vsttyvrvy 7 7 Foreword ISO (the International Organization for Standardization) and IEC (the Int
2、ernational Electrotechnical Commission) form the specialized system for worldwide standardization. National bodies that are members of ISO or IEC participate in the development of International Standards through technical committees established by the respective organization to deal with particular
3、fields of technical activity. ISO and IEC technical committees collaborate in fields of mutual interest. Other international organizations, governmental and non-governmental, in liaison with ISO and IEC, also take part in the work. In the field of information technology, ISO and IEC have established
4、 a joint technical committee, ISO/IEC JTC 1. IEEE Standards documents are developed within the IEEE Societies and the Standards Coordinating Committees of the IEEE Standards Association (IEEE-SA) Standards Board. The IEEE develops its standards through a consensus development process, approved by th
5、e American National Standards Institute, which brings together volunteers representing varied viewpoints and interests to achieve the final product. Volunteers are not necessarily members of the Institute and serve without compensation. While the IEEE administers the process and establishes rules to
6、 promote fairness in the consensus development process, the IEEE does not independently evaluate, test, or verify the accuracy of any of the information contained in its standards. The main task of ISO/IEC JTC 1 is to prepare International Standards. Draft International Standards adopted by the join
7、t technical committee are circulated to national bodies for voting. Publication as an International Standard requires approval by at least 75 % of the national bodies casting a vote. Attention is called to the possibility that implementation of this standard may require the use of subject matter cov
8、ered by patent rights. By publication of this standard, no position is taken with respect to the existence or validity of any patent rights in connection therewith. ISO/IEEE is not responsible for identifying essential patents or patent claims for which a license may be required, for conducting inqu
9、iries into the legal validity or scope of patents or patent claims or determining whether any licensing terms or conditions provided in connection with submission of a Letter of Assurance or a Patent Statement and Licensing Declaration Form, if any, or in any licensing agreements are reasonable or n
10、on-discriminatory. Users of this standard are expressly advised that determination of the validity of any patent rights, and the risk of infringement of such rights, is entirely their own responsibility. Further information may be obtained from ISO or the IEEE Standards Association. ISO/IEC/IEEE 994
11、5 was prepared by The Open Group (as The Open Group Technical Standard Base Specifications, Issue 7) and the Portable Applications Standards Committee of the Computer Society of the IEEE (as IEEE Std 1003.1-2008). It was adopted by Joint Technical Committee ISO/IEC JTC 1, Information technology, Sub
12、committee SC 22, Programming languages, their environments and system software interfaces, in parallel with its approval by the ISO/IEC national bodies, under the “fast-track procedure” defined in the Partner Standards Development Organization cooperation agreement between ISO and IEEE. IEEE is resp
13、onsible for the maintenance of this document with participation and input from ISO/IEC national bodies. vwtrrttrsy 9 trsx ,(6WG %DVH6SHFLILFDWLRQV,VVXH7HFKQLFDO %DVH6SHFLILFDWLRQV,VVXH7HFKQLFDOBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB7KH,QVWLWXWHRI(OHFWULFDODQG(OHFWURQLFV(QJLQHHUV,QF3DUN$YHQXH1HZNote t
14、o reviewers: References to defect reports are provided to aid reviewers.WREDVHGRFXPHQWVIRU326,;Rationale$XVWLQ*URXSHIHFW5HSRUW V DSSOLHG6HHKWWSDXVWLQJURXSEXJVQHWYLHZSKS“LG %DVH6SHFLILFDWLRQV,VVXH7HFKQLFDO%7 7KH2+PDUJLQOHJHQGLQGLFDWHVWKDWWKHPDUNHGKHDGHULVQRWUHTXLUHGRQ;6,FRQIRUPDQWVVWHPVWROH#include /
15、OH #include int open(const char *path, int oflag, .); 7KH2+PDUJLQOHJHQGLQGLFDWHVWKDWWKHRSWLRQDOKHDGHUGHILQHVFRQVWDQWVWKDWZLOOEHQHHGHGLIWKHIXQFWLRQLVFDOOHGZLWKFHUWDLQIODJDUJXPHQWVWKXVLWPDEHUHTXLUHGIRUVRPHRIWKHIXQFWLRQDOLWGHVFULEHGEXWLVQRWQHHGHGRWKHUZLVHRationale$XVWLQ*URXSHIHFW5HSRUW V DSSOLHG6HHKWWS
16、DXVWLQJURXSEXJVQHWYLHZSKS“LG %76+FRQIVWU Rationale$XVWLQ*URXSHIHFW5HSRUW V DSSOLHG6HHKWWSDXVWLQJURXSEXJVQHWYLHZSKS“LG %7 %DVH6SHFLILFDWLRQV,VVXH7HFKQLFDO%7%76+Rationale$XVWLQ*URXSHIHFW5HSRUW V DSSOLHG6HHKWWSDXVWLQJURXSEXJVQHWYLHZSKS“LG 7KHUHVWULFWLRQVRQXVLQJORQJMPS DQGVLJORQJMPS DUHPRUHUHVWULFWLYHWK
17、DQWKHQHHGWREHRQ326,; %DVH6SHFLILFDWLRQV,VVXH7HFKQLFDO%7%7%7%7 %DVH6SHFLILFDWLRQV,VVXH7HFKQLFDO%7DUHVKDUHGDPRQJDOORIWKHWKUHDGVZLWKLQDSURFHVV7KHVHLQFOXGHWKHSURFHVV,WKHSDUHQWSURFHVV,SURFHVVJURXS,VHVVLRQPHPEHUVKLSUHDOHIIHFWLYHDQGVDYHGVHWXVHU,UHDOHIIHFWLYHDQGVDYHGVHWJURXS,VXSSOHPHQWDUJURXS,VFXUUHQWZRUNLQ
18、JGLUHFWRUURRWGLUHFWRUILOHPRGHFUHDWLRQPDVNDQGILOHGHVFULSWRUVVPDOO!Rationale$XVWLQ*URXSHIHFW5HSRUW V DSSOLHG6HHKWWSDXVWLQJURXSEXJVQHWYLHZSKS“LG %7 %DVH6SHFLILFDWLRQV,VVXH7HFKQLFDO%7%7%7 %DVH6SHFLILFDWLRQV,VVXH7HFKQLFDO%7VPDOO!WR7KHSHULRGRIWLPHWKDWEHJLQVZKHQDSURFHVVLVFUHDWHGDQGHQGVZKHQLWVSURFHVV,LVUHWX
19、UQHGWRWKHVVWHP6HHDOVRLive ProcessLQ6HFWLRQProcess TerminationLQ6HFWLRQDQGZombie ProcessLQ6HFWLRQVPDOO!1RWH3URFHVVFUHDWLRQLVGHILQHGLQGHWDLOLQWKHGHVFULSWLRQVRIWKHfork posix_spawn DQGposix_spawnp IXQFWLRQVLQWKH6VWHP,QWHUIDFHVYROXPHRI326,;VPDOO!2Q3DJH/LQH6HFWLRQ3URFHVV7HUPLQDWLRQ HGLWLRQ3DJH/LQH6HFWLRQ
20、VPDOO!WRVPDOO!1RWH7KHFRQVHTXHQFHVRISURFHVVWHUPLQDWLRQF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