Open System Services Library Calls Reference Manual (G06.27+, H06.04+)

OSS Library Calls (n - r) rewinddir(3)
NAME
rewinddir - Resets the position in the directory stream to the beginning of the directory
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 rewinddir(
DIR *dir_pointer);
PARAMETERS
dir_pointer Points to the dir structure of an open 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 rewinddir( ) function resets the position in the specied directory stream to the beginning of
the directory. It also causes the directory stream to refer to the current state of the corresponding
directory, as a call to the opendir( ) function would have done.
If the dir_pointer parameter does not refer to a currently opened directory stream when it is
passed to the rewinddir() 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.
General Considerations for Directory Operations
If les are removed from a directory after the most recent call to the opendir() or rewinddir()
function but prior to the rst call to the readdir() function, the readdir() function does not
return entries for these les. If les are added to a directory after the most recent call to the
opendir( ) or rewinddir( ) function but prior to the rst call to the readdir() function, the read-
dir( ) function returns entries for these les.
The rst call to the readdir() function after a call to the opendir() or rewinddir() function
retrieves a block of directory entries. The rst two entries of the block are for . (dot) and ..(dot-
dot). Therefore, the rst entry returned is for . (dot). Each subsequent call to readdir() fetches
another entry from the buffer until the buffer is empty, at which time another block of entries is
automatically retrieved.
Directory Operations After fork Operations
If, after a call to a fork() or tdm_fork() function, both the parent and child processes make calls
to the readdir() function to access an OSS directory, the results of the calls are undened.
527187-004 Hewlett-Packard Company 599