Open System Services System Calls Reference Manual (G06.25+, H06.03+)

System Functions (a - d) chdir(2)
NAME
chdir - Changes the current working directory
LIBRARY
G-series native Guardian processes: system library
G-series native OSS processes: system library
H-series native Guardian processes: implicit libraries
H-series OSS processes: implicit libraries
SYNOPSIS
#include <unistd.h>
int chdir(
const char *path);
PARAMETERS
path Points to the pathname of the directory.
DESCRIPTION
The chdir() function changes the current working directory to the directory indicated by the path
parameter. If the path parameter refers to a symbolic link, the chdir() function sets the current
directory to the directory pointed to by the symbolic link.
The current working directory is the starting point for searches for pathnames that do not begin
with a / (slash). For a directory to become the current working directory, the calling process must
have search (execute) access to the directory.
Use on Guardian Objects
Guardian process names are directories; however, they cannot be opened using chdir().
Attempts to do so fail and set errno to the value [EPERM].
A call to the chdir() function with a path parameter that points to a subprocess in the Guardian
le system fails when the process is not of subtype 30. Such a call sets errno to the value
[ENOENT].
A call to the chdir() function with a path parameter that points to an empty Guardian disk subvo-
lume (for example, /G/vol/subvol) succeeds.
A call to the chdir() function with a path parameter that points to a Guardian subvolume with a
reserved name (for example, /G/vol1/zyq00001) fails. Such a call sets errno to the value
[EPERM].
Use From the Guardian Environment
The chdir() function is one of a set of functions that have the following effects when the rst of
them is called from the Guardian environment:
Two Guardian le system le numbers (not necessarily the next two available) are allo-
cated for the root directory and the current working directory. These le numbers cannot
be closed by calling the Guardian FILE_CLOSE_ procedure.
The current working directory is assigned from the VOLUME attribute of the Guardian
environment =_DEFAULTS DEFINE.
The use of static memory by the process increases slightly.
These effects occur only when the rst of the set of functions is called. The effects are not cumu-
lative.
527186-003 Hewlett-Packard Company 111