unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (SunOS-4.1.3)
Page:
Section:
Apropos / Subsearch:
optional field

CHDIR(2V)                                                            CHDIR(2V)



NAME
       chdir - change current working directory

SYNOPSIS
       int chdir(path)
       char *path;

       int fchdir(fd)
       int fd;

DESCRIPTION
       chdir()  and  fchdir()  make  the directory specified by path or fd the
       current working directory.   Subsequent  references  to  pathnames  not
       starting with `/' are relative to the new current working directory.

       In  order  for  a  directory to become the current directory, a process
       must have execute (search) access to the directory.

RETURN VALUES
       chdir() returns:

       0      on success.

       -1     on failure and sets errno to indicate the error.

ERRORS
       EACCES              Search permission is denied for a component of  the
                           pathname.

       ENAMETOOLONG        The length of the path argument exceeds {PATH_MAX}.

                           A  pathname  component  is  longer  than {NAME_MAX}
                           while {_POSIX_NO_TRUNC} is  in  effect  (see  path-
                           conf(2V)).

       ENOENT              The named directory does not exist.

       ENOTDIR             A component of the pathname is not a directory.

SYSTEM V ERRORS
       In addition to the above, the following may also occur:

       ENOENT              path points to an empty string.

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



                                21 January 1990                      CHDIR(2V)