Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)

OSS Library Calls (n - r) readdir64(3)
NAME
readdir64 - Reads a directory stream
LIBRARY
G-series native OSS processes: /G/system/sysnn/zossfsrl
32-bit H-series and J-series OSS processes: /G/system/zdllnnn/zossfdll |
SYNOPSIS
#include <sys/types.h> /* optional except for POSIX.1 */
#include <dirent.h>
struct dirent64 *readdir64(
DIR *dir_pointer);
PARAMETERS
dir_pointer Points to the dir structure of an open directory.
DESCRIPTION
The readdir64() function is similar to the readdir() function except that, in addition to support- |
ing smaller files, the readdir64( ) function supports files larger than approximately 2 gigabytes in |
32-bit applications.
readdir64( ) function calls are redirected to the readdir( ) function for 64-bit applications. A |
32-bit application can explicitly call this function when you compile the application using the |
#define _LARGEFILE64_SOURCE 1 feature test macro or an equivalent compiler command |
option.
A 32-bit application call to readdir( ) is automatically mapped to this function when you compile |
the application using the #define _FILE_OFFSET_BITS 64 feature test macro or an equivalent |
compiler command option.
The type DIR, which is defined in the dirent.h header file, represents a directory stream, which
is an ordered sequence of all the directory entries in a particular directory. (Directory streams are
not implemented through file descriptors.) The structure pointed to by the dir_pointer parameter
is established by a prior call to the opendir( ) function.
The readdir64() function returns a pointer to a structure representing the directory entry at the
current position in the directory stream specified by the dir_pointer parameter, and then positions
the directory stream at the next entry. readdir64( ) returns a null pointer upon reaching the end
of the directory stream but does not change the value of errno. The dirent64 structure defined in
the dirent.h header file describes a directory entry.
The readdir64() function does not return directory entries containing empty names. If entries
for . (dot) or ..(dot-dot) exist, one entry is returned for . (dot) and one entry is returned for ..
(dot-dot); otherwise, they are not returned.
The pointer returned by the readdir64( ) function points to data that can be overwritten (or data
that is contained in a buffer that can be freed) by another call to readdir64( ) on the same direc-
tory stream. This data is available until another readdir64( ) or closedir( ) call is made on the
same directory stream.
When one of the set of exec, tdm_exec,ortdm_spawn functions is called, all open directory
streams are closed automatically. (For calls by tdm_spawn functions, only the directory streams
of the child process are closed.) The effect is the same as if the closedir( ) function had been
called for each open directory stream.
If the dir_pointer parameter does not refer to a currently opened directory stream when it is
passed to the readdir64() function, the following can occur:
The error value [EBADF] or [EFAULT] might be returned.
527187-017 Hewlett-Packard Company 5141