IEEE Standards Interpretations for IEEE Std 1003.1c™-1995 IEEE Standard for Information Technology--Portable Operating System Interface (POSIX(R)) - System Application Program Interface (API) Amendment 2: Threads Extension (C Language)
Copyright © 1996 by the Institute of Electrical and Electronics Engineers, Inc. 3 Park Avenue New York, New York 10016-5997 USA All Rights Reserved.
Interpretations are issued to explain and clarify the intent of a standard and do not constitute an alteration to the original standard. In addition, interpretations are not intended to supply consulting information. Permission is hereby granted to download and print one copy of this document. Individuals seeking permission to reproduce and/or distribute this document in its entirety or portions of this document must contact the IEEE Standards Department for the appropriate license. Use of the information contained in this document is at your own risk.
IEEE Standards Department, Copyrights and Permissions, 445 Hoes Lane, Piscataway, New Jersey 08855-1331, USA
Interpretation Request #48
Topic: open O_EXCL, mq_open O_EXCL Relevant Sections: 18.104.22.168 p 119 ll 225- , 22.214.171.124 p 322 ll 124-
These two sections represent yet another case where the word "process" should have been changed to "thread". The description of O_EXCL says that the open shall fail if the file exists, and that "The check for the existence of the file and the creation of the file if it does not exist shall be atomic with respect to other processes [...]". Solution proposed by the submitter (optional): Clearly, in the context of POSIX threads, this guarantee is of no value should multiple threads within the same process be attempting to open a file with O_EXCL.
It should guarantee that "The check [...] shall be atomic with respect to other threads [...]". Although we haven't found a lot of these errors since the release of 1003.1-1996, it seems counterproductive to deal with each separately. I would like to suggest a grep of the entire POSIX 1003.1 document source for the word "process", followed by an attempt by "someone" (the interpretations group, perhaps) to determine whether each match is valid or should be changed.
The standards states that this is atomic with respect to processes executing open() or mq_open() , however this is a defect in the standard and concerns have been raised about this which are being referred to the sponsor. The interpretation committee believes that the intent of the working and balloting groups was to require this to be atomic with respect to the thread and not the process.
Rationale for Interpretation