Requirements Catalog of LSB Core 3.1

Requirements for the function 'readdir'
StandardIDDescription
SUSv3readdir.01 The readdir() function shall return a pointer to a structure representing the directory entry at the current position in the directory stream specified by the argument dirp, and position the directory stream at the next entry.
SUSv3readdir.01.01 Upon successful completion, readdir() shall return a pointer to an object of type struct dirent
SUSv3readdir.02 It shall return a null pointer upon reaching the end of the directory stream.
SUSv3readdir.02.01 When the end of the directory is encountered, a null pointer shall be returned and errno is not changed
SUSv3readdir.03 The readdir() function shall not return directory entries containing empty names
SUSv3readdir.04 If entries for dot or dot-dot exist, one entry shall be returned for dot and one entry shall be returned for dot-dot; otherwise, they shall not be returned
SUSv3app.readdir.05 The pointer returned by readdir() points to data which may be overwritten by another call to readdir() on the same directory stream.
SUSv3app.readdir.06 This data is not overwritten by another call to readdir() on a different directory stream.
SUSv3readdir.07 If a file is removed from or added to the directory after the most recent call to opendir() or rewinddir(), whether a subsequent call to readdir() returns an entry for that file is unspecified.
SUSv3readdir.08 The readdir() function may buffer several directory entries per actual read operation;
SUSv3readdir.09 readdir() shall mark for update the st_atime field of the directory each time the directory is actually read.
SUSv3app.readdir.10 After a call to fork(), either the parent or child (but not both) may continue processing the directory stream using readdir(), rewinddir(), [XSI]  or seekdir().
SUSv3app.readdir.11 If both the parent and child processes use these functions, the result is undefined.
SUSv3readdir.12 If the entry names a symbolic link, the value of the d_ino member is unspecified
SUSv3app.readdir.13 The readdir() function need not be reentrant. A function that is not required to be reentrant is not required to be thread-safe.
SUSv3readdir.16 Applications wishing to check for error situations should set errno to 0 before calling readdir(). If errno is set to non-zero on return, an error occurred.
SUSv3readdir.16.01 When an error is encountered, a null pointer shall be returned and errno shall be set to indicate the error.
SUSv3readdir.90 The readdir() function shall fail if:
SUSv3readdir.90.01 [EOVERFLOW] One of the values in the structure to be returned cannot be represented correctly.
SUSv3readdir.91 The readdir() function may fail if:
SUSv3readdir.91.01 [EBADF] The dirp argument does not refer to an open directory stream.
SUSv3readdir.91.02 [ENOENT] The current position of the directory stream is invalid.
The text in the Description column of SUSv3 requirements is reproduced from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html