Museum

Home

Lab Overview

Retrotechnology Articles

⇒ Online Manual

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chroot(2)

chdir(2)

NAME

chdir − change working directory

SYNTAX

chdir(path)
char *path;

DESCRIPTION

The path is the pathname of a directory.  The chdir system call 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. 

ENVIRONMENT

Differs from the System V definition in that ELOOP is a possible error condition. 

DIAGNOSTICS

The chdir system call will fail and the current working directory will be unchanged if one or more of the following are true:

[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.

[EACCES]
Search permission is denied for any component of the path name.

[EFAULT]
The path points outside the process’s allocated address space. 

[ELOOP]
Too many symbolic links were encountered in translating the pathname.

[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 which is dependent on the communications protocol.

SEE ALSO

chroot(2)

System Calls

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026