chdir(2)chdir(2)Namechdir - change working directory
The path is the pathname of a directory. The system call causes this
directory to become the current working directory, which is the start‐
ing point for pathnames that do not begin at the root directory (/).
For a directory to become the current directory, the process must have
execute (search) access to the directory.
Upon successful completion, a value of 0 is returned. Otherwise, a
value of -1 is returned and errno is set to indicate the error.
Differs from the System V definition in that ELOOP is a possible error
The system call fails and the current working directory is unchanged
under the following conditions:
[ENOTDIR] A component of the pathname is not a directory.
[ENAMETOOLONG] A component of a pathname exceeds 255 characters, or an
entire path name exceeds 1023 characters.
[ENOENT] The named directory does not exist or the path points to
an empty string and the environment defined is POSIX or
[EACCES] Search permission is denied for any component of the
[EFAULT] The path points outside the process's allocated address
[ELOOP] Too many symbolic links were encountered in translating
[EIO] An I/O error occurred while reading from or writing to
the file system.
[ESTALE] The file handle given in the argument was invalid. The
file referred to by that file handle no longer exists or
has been revoked.
[ETIMEDOUT] A connect request or remote file operation failed
because the connected party did not properly respond
after a period of time that is dependent on the communi‐