CHDIR(2) — SYSTEM CALLS
NAME
chdir − change current working directory
SYNOPSIS
int chdir (path)
char ∗path;
int fchdir (fd)
int fd;
DESCRIPTION
chdir() and fchdir cause a directory to become the current working directory, that is, the starting point for pathnames not beginning with ‘/’.
In order for a directory to become the current directory, a process must have execute (search) access to the directory.
The path argument to chdir() points to the pathname of a directory. The fd argument to fchdir is the open file descriptor of a 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.
WARNING
fchdir is provided as a performance enhancement and is guaranteed to fail under certain conditions. In particular, if auditing is active the call will never succeed, and EINVAL will be returned. Applications which use this system call must be coded to detect this failure and switch to using chdir() from that point on.
Sun Release 4.0 — Last change: 20 November 1987