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

seekdir(3) OSS Library Calls Reference Manual
NAME
seekdir - Sets position within a directory stream
LIBRARY
G-series native OSS processes: /G/system/sysnn/zossfsrl
H-series OSS processes: /G/system/zdllnnn/zossfdll
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 Species the number of an entry relative to the start of the directory.
DESCRIPTION
The type DIR, which is dened in the dirent.h header le, represents a directory stream, which
is an ordered sequence of all the directory entries in a particular directory. (Directory streams are
not implemented through le 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
specied by the dir_pointer parameter to the position specied by the location parameter. If the
value of the location parameter was not returned by a call to the telldir() function, the effect is
undened.
The use of the seekdir() and telldir() functions is not recommended when the possibility exists
that a directory will be modied.
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 overows, 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 overow occurs but the telldir() function has not returned a value, the seekdir()
function does not detect the overow condition or set errno to [EINVAL]. A subsequent call to
the readdir() function does not set errno to [EINVAL].
616 Hewlett-Packard Company 527187-007