Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ chdir(2) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

chroot

cd



CHDIR(2,L)                  AIX Technical Reference                  CHDIR(2,L)



-------------------------------------------------------------------------------
chdir



PURPOSE

Changes the current directory.

SYNTAX

int chdir (path)
char *path;

DESCRIPTION

The chdir system call changes the current directory to the directory specified
by the path parameter.  The current directory, also called the current working
directory, is the starting point of searches for path names that do not begin
with a "/" (slash).

Warning:  After changing into a directory that uses a symbolic link, attempts
to traverse the tree using ".." may produce unexpected results.  ".." refers to
the hard link parent of the directory, obtained by deleting the last element
from path, not the symbolic link parent.

Note:  If the working directory is a directory stored only on sites which are
       no longer available, it is not possible to use chdir to change into its
       subdirectories and using chdir .. to change to the parent directory will
       only work if the parent directory is stored on an available site.

RETURN VALUE

Upon successful completion, the chdir system call returns a value of 0.  If the
chdir system call fails, a value of -1 is returned and errno is set to indicate
the error.

ERROR CONDITIONS

The chdir system call fails and the current directory remains unchanged if one
or more of the following are true:

ENOTDIR   A component of the path parameter is not a directory.

ENOENT    The named directory does not exist.

EACCES    Search permission is denied for any component of the path parameter.

EFAULT    The path parameter points to a location outside of the process's
          allocated address space.





Processed November 7, 1990        CHDIR(2,L)                                  1





CHDIR(2,L)                  AIX Technical Reference                  CHDIR(2,L)



ESTALE    The process's root or current directory is located in an NFS virtual
          file system that has been unmounted.

ENAMETOOLONG
          A component of the path parameter exceeded NAME_MAX characters or the
          entire path parameter exceeded PATH_MAX characters.

ENOENT    A hidden directory was named, but no component inside it matched the
          process's current site path list.

ENOENT    A symbolic link was named, but the file to which is refers does not
          exist.

ELOOP     A loop of symbolic links was detected.

If the Transparent Computing Facility is installed on your system, chdir can
also fail if one or more of the following are true:

ESITEDN1  The path cannot be accessed because a site went down.

ESITEDN2  The operation was terminated because a site failed.

ENOSTORE  The path is a name relative to the current directory, but no site
          which stores this directory is currently up.

ENOSTORE  A component of path is replicated but is not stored on any site which
          is currently up.

EINTR     A signal was caught during the chdir system call.


RELATED INFORMATION

In this book:  "chroot."

The cd command in AIX Operating System Commands Reference.



















Processed November 7, 1990        CHDIR(2,L)                                  2



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