IEEE Std 1003.1-2001 Interpretation #24

Copyright © 2006 IEEE. All rights reserved.

Interpretation Number:	024
                  	Topic:			negative len arguments
                    	Relevant Sections:	posix_fadvise()

------------------------------------------------------------------------

7 Defect Report concerning (number and title of International Standard or DIS final text, if applicable):

The System Interfaces volume of IEEE Std 1003.1-2001

------------------------------------------------------------------------

8 Qualifier (e.g. error, omission, clarification required):

1. Error

------------------------------------------------------------------------

9 References in document (e.g. page, clause, figure, and/or table numbers):

Edition of Specification (Year): 2003 Page: 864 Line: 28128 Section: posix_fadvise

Reference XSH Latest ERN 32

------------------------------------------------------------------------

10 Nature of defect (complete, concise explanation of the perceived problem):

Page: 864 Line: 28128 Section: 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.

------------------------------------------------------------------------

11 Solution proposed by the submitter (optional):

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."

------------------------------------------------------------------------

Interpretation response ------------------------

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: --------- None.

Back to IEEE Standards Interpretations for IEEE Std 1003.1-2001