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 #24
Topic: negative len arguments Relevant Sections: posix_fadvise()
In TC2 the "len" argument for posix_fadvise() and posix_fallocate() was changed from type size_t to off_t. This means that the value of len can now be negative, but the descriptions have not been updated to account for this. There are two choices. Either make negative len values invalid, or make them valid and specify how they are handled. Given that negative values were previously not possible, and considering the current treatment of len=0 by the two functions and the statements about offset+len for posix_fallocate(), I think it would be best for negative len values to be treated as invalid. The alternative would be to make offset and len be treated similarly to l_start and l_len in struct flock.
Change the EINVAL entry in the posix_fadvise() ERRORS section from: "[EINVAL] The value of advice is invalid." to: "[EINVAL] The value of advice is invalid, or the value of len is less than zero." Similarly for page 866 line 28200 section posix_fallocate objection Change the EINVAL entry in the posix_fallocate() ERRORS section from: "[EINVAL] The len argument was zero or the offset argument was less than zero." to: "[EINVAL] The len argument is less than or equal to zero, or the offset argument is less than zero."
The standard does not speak to this issue, and as such no conformance distinction can be made between alternative implementations based on this. This is being referred to the sponsor.
Rationale for Interpretation