Open System Services Library Calls Reference Manual (G06.28+, H06.05+)
OSS Library Calls (a - d) closedir(3)
NAME
closedir - Closes 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>
int closedir(
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 closedir() function closes a directory stream and frees the structure associated with the
dir_pointer parameter. Upon return, the value of dir_pointer no longer points to an accessible
object of the type DIR. Subsequent attempts to access the stream either return the error value
[EBADF] or [EFAULT], or cause SIGSEGV or SIGILL signals in the OSS environment or traps
in the Guardian environment.
An open directory should always be closed with the closedir() function to ensure the freeing of
resources held by the stream. If the OSS name server process is not available when the
closedir() function is called, the directory is closed but the st_atime field is not updated.
When one of the exec, tdm_exec,ortdm_spawn set of functions is called, all open directory
streams are closed automatically. (For tdm_spawn calls, only the directory streams of the child
process are closed.) The effect is the same as if the closedir() function had been called for each
open directory stream.
If the dir_pointer parameter does not refer to a currently opened directory stream when it is
passed to the closedir() 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.
527187-007 Hewlett-Packard Company 1−51