Open System Services Library Calls Reference Manual (G06.28+, H06.05+)

nftw64(3) OSS Library Calls Reference Manual
DESCRIPTION
The nftw64( ) function is similar to the nftw( ) function except that, in addition to supporting
smaller les, the nftw64() function supports OSS les larger than approximately 2 gigabytes.
An 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.
An application call to nftw() 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 nftw64( ) function recursively searches the directory hierarchy that descends from the direc-
tory specied by the path parameter. For each le in the hierarchy, nftw64() calls the function
pointed to by the function parameter and passes four arguments.
The ag value passed to the function parameter identies the le type of the object specied for
the object parameter or provides other information that modies the operation of the nftw64()
function. The ag value can be one of the following:
FTW_D Species that the object is a directory.
FTW_DNR Species that the object is a directory that cannot be read.
FTW_DP Species that the object is a directory and that subdirectories have already been
traversed. This value is used only when the ags parameter includes the
FTW_DEPTH ag.
FTW_F Species that the object is a regular le.
FTW_NS Species that the object is a le for which the stat64() function could not be
executed successfully.
FTW_SL Species that the object is a symbolic link. This value is used only when the
ags parameter includes the FTW_PHYS ag.
FTW_SLN Species that the object is a symbolic link that does not name an existing le.
This value is used only when the ags parameter does not include the
FTW_PHYS ag.
If ag is FTW_DNR, the les and subdirectories contained in that directory are not processed.
If ag is FTW_NS, the stat64 structure contents are meaningless. An example of a le that
causes FTW_NS to be passed to the function parameter is a le in a directory for which you have
read permission but not execute (search) permission. This condition also returns the value
[EACCES] in errno.
The nftw64( ) function nishes processing a directory before processing any of its les or sub-
directories.
The nftw64( ) function continues the search until either the directory hierarchy specied by the
path parameter is completely searched, an invocation of the function specied by the function
parameter returns a nonzero value, or an error is detected within nftw64(), such as an I/O error.
Because nftw64() is recursive, it can terminate with a memory fault because of stack overow
when the function is called for very deep tree structures.
The nftw64( ) function uses the malloc() function to allocate dynamic storage during its opera-
tion. If nftw64( ) is terminated prior to its completion, such as when the longjmp( ) function is
executed by the function specied by the function parameter, nftw64() cannot free that storage.
The storage remains allocated.
510 Hewlett-Packard Company 527187-007