NAME | SYNOPSIS | API RESTRICTIONS | FEATURES | DESCRIPTION | RETURN VALUES | ATTRIBUTES | SEE ALSO | STANDARDS
#include <unistd.h>int chdir(const char * path);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
MSDOSFS, NFS_CLIENT, UFS
path points to the path name of a directory. chdir causes the named directory to become the current working directory of the calling process, the starting point for path searches for pathnames not beginning with a slash ( / ).
The fchdir function causes the directory referenced by fd to become the current working directory, the starting point for path searches for pathnames not beginning with a slash ( / ).
In order for a directory to become the current directory, a process must have execute (search) access to the directory.
Upon successful completion both chdir , and fchdir return 0; otherwise they return -1 and set errno to indicate one of the following error conditions:
A component of the path name is not a directory.
The named directory does not exist.
Search permission is denied for a component of the path name.
path points outside the allocated address sp ace of the process.
The length of a component of path exceeds NAME_MAX characters or the length of path exceeds PATH_MAX characters.
Too many symbolic links were encountered during analysis of path .
An I/O error occurred while reading from the file system.
fchdir will fail and the current working directory will be unchanged if one or more of the following are true:
Search permission is denied for the directory referenced by the file descriptor.
The file descriptor does not reference a directory.
The fd argument is not a valid file descriptor.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
MT-Level | Async-Signal-Safe |
chdir is expected to conform to IEEE Std 1003.1-1988 POSIX .
NAME | SYNOPSIS | API RESTRICTIONS | FEATURES | DESCRIPTION | RETURN VALUES | ATTRIBUTES | SEE ALSO | STANDARDS