Open System Services Library Calls Reference Manual (G06.28+, H06.05+)
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 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 rewinddir( ) function resets the position in the specified 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 files are removed from a directory after the most recent call to the opendir() or rewinddir() |
function but prior to the first call to the readdir() function, the readdir() function does not |
return entries for these files. If files are added to a directory after the most recent call to the |
opendir( ) or rewinddir( ) function but prior to the first call to the readdir() function, the read- |
dir( ) function returns entries for these files. |
The first call to the readdir() function after a call to the opendir() or rewinddir() function |
retrieves a block of directory entries. The first two entries of the block are for . (dot) and ..(dot- |
dot). Therefore, the first 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. |
527187-007 Hewlett-Packard Company 5−113