IEEE Standards Interpretations for IEEE Std 1003.1™-2001 IEEE Standard for Information Technology - Portable Operating System Interface (POSIX®)
Copyright © 2006 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 #43
Topic: may fails vs shall fails Relevant Sections: XSH accept,bind,catgets,strdup
The standard has a number of errors stated as may fails that should be shall fails: The accept() function may fail if: 3734 [ENOBUFS] No buffer space is available. 3735 [ENOMEM] There was insufficient memory available to complete the operation. These should be "shall fail" errors. The bind() function may fail if: 5302 [ENOBUFS] Insufficient resources were available to complete the call. This should be a "shall fail" error. The standard says for catgets(): 5890 reason, s shall be returned and errno may be set to indicate the error. 5891 ERRORS 5892 The catgets() function may fail if: 5893 [EBADF] The catd argument is not a valid message catalog descriptor open for reading. 5894 [EBADMSG] The message identified by set_id and msg_id in the specified message catalog 5895 did not satisfy implementation-defined security criteria. 5896 [EINTR] The read operation was terminated due to the receipt of a signal, and no data 5897 was transferred. 5898 [EINVAL] The message catalog identified by catd is corrupted. 5899 [ENOMSG] The message identified by set_id and msg_id is not in the message catalog.
Some of the errrors here should probably be "shall fail" (e.g. EINTR,
and the wording "errno may be set" bit (especially if some error(s)
indeed "shall fail")should be reworded.
The standard says on strdup (page 1440):
44856 The strdup() function may fail if:
44857 [ENOMEM] Storage space available is insufficient.
The "may" fail is incorrect. Resource-not-available errors are mandatory.
11 Solution proposed by the submitter (optional): Action: Replace "may" with "shall".
The standards states the requirements for errors for these functions, and conforming implementations must conform to this. However, concerns have been raised about this which are being referred to the sponsor.
Rationale for Interpretation
It is accepted that the cases as noted would be better to be mandatory error conditions. This concern has been referred to the sponsor.