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

OSS Library Calls (s) seekdir(3)
NAME
seekdir - Sets position within 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 |
64-bit H-series and J-series OSS processes: /G/system/zdllnnn/yossfdll |
SYNOPSIS
#include <sys/types.h> /* optional except for POSIX.1 */
#include <dirent.h>
void seekdir(
DIR *dir_pointer,
long location);
PARAMETERS
dir_pointer Points to the dir structure of an open directory.
location Specifies the number of an entry relative to the start of the directory.
DESCRIPTION
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 seekdir( ) function sets the position of the next readdir() operation on the directory stream
specified by the dir_pointer parameter to the position specified by the location parameter. If the
value of the location parameter was not returned by a call to the telldir( ) function, the effect is
undefined.
The use of the seekdir() and telldir( ) functions is not recommended when the possibility exists
that a directory will be modified.
If the dir_pointer parameter does not refer to a currently opened directory stream when it is
passed to the seekdir( ) function, the following can occur:
The error value [EBADF] or [EFAULT] might be returned.
The caller might receive a SIGSEGV or SIGILL signal in the OSS environment.
The caller might cause a trap condition in the Guardian environment.
User memory might be corrupted.
RETURN VALUES
The seekdir( ) function does not return a value. If seekdir( ) detects a problem, it sets errno.For
correct processing of errors, set errno to the value 0 (zero) before each seekdir( ) function call
and test the value of errno after each call.
For Guardian disk volumes and subvolumes (directories with OSS pathnames of the form /G/vol
and /G/vol/subvol), values returned by the telldir( ) function are kept for use by the seekdir()
function. When the table containing these values overflows, the previous telldir( ) function value
becomes invalid. The seekdir( ) function detects this condition and sets errno to [EINVAL].
After the seekdir( ) function sets errno to [EINVAL], subsequent calls to the readdir( ) function
also set errno to [EINVAL].
When table overflow occurs but the telldir( ) function has not returned a value, the seekdir( )
function does not detect the overflow condition or set errno to [EINVAL]. A subsequent call to
the readdir( ) function does not set errno to [EINVAL].
527187-017 Hewlett-Packard Company 627