CHDIR(2) — SYSTEM CALLS
NAME
chdir − change current working directory
SYNOPSIS
chdir(path)
char ∗path;
DESCRIPTION
path points to the path name of a directory. chdir causes this directory to become the current working directory, the starting point for path names not beginning with /.
In order for a directory to become the current directory, a process must have execute (search) access to the directory.
RETURN VALUE
Upon successful completion, a value of 0 is returned. Otherwise, a value of −1 is returned and errno is set to indicate the error.
ERRORS
chdir will fail and the current working directory will be unchanged if one or more of the following are true:
ENOTDIR A component of the path prefix of path is not a directory.
ENOTDIR The file named by path is not a directory.
EINVAL path contains a byte with the high-order bit set.
ENAMETOOLONG
The length of a component of path exceeds 255 characters, or the length of path exceeds 1023 characters.
ENOENT The directory referred to by path does not exist.
ELOOP Too many symbolic links were encountered in translating path.
EACCES Search permission is denied for a component of the path prefix of path.
EACCES Search permission is denied for the directory referred to by path.
EFAULT path points outside the process’s allocated address space.
EIO An I/O error occurred while reading from or writing to the file system.
SEE ALSO
Sun Release 3.2 — Last change: 16 July 1986