135 lines
3.2 KiB
Groff
135 lines
3.2 KiB
Groff
'\"macro stdmacro
|
|
.if n .pH g2.chdir @(#)chdir 41.3 of 5/26/91
|
|
.\" Copyright 1991 UNIX System Laboratories, Inc.
|
|
.\" Copyright 1989, 1990 AT&T
|
|
.nr X
|
|
.if \nX=0 .ds x} chdir 2 "" "\&"
|
|
.if \nX=1 .ds x} chdir 2 ""
|
|
.if \nX=2 .ds x} chdir 2 "" "\&"
|
|
.if \nX=3 .ds x} chdir "" "" "\&"
|
|
.TH \*(x}
|
|
.SH NAME
|
|
\f4chdir\f1, \f4fchdir\f1 \- change working directory
|
|
.SH SYNOPSIS
|
|
.PP
|
|
\f4#include <unistd.h>\f1
|
|
.PP
|
|
\f4int chdir(const char \(**path);\f1
|
|
.PP
|
|
\f4int fchdir(int fildes);\f1
|
|
.PP
|
|
.SH DESCRIPTION
|
|
\f4chdir\fP
|
|
and
|
|
\f4fchdir\fP
|
|
cause a directory pointed to by
|
|
.I path\^
|
|
or
|
|
.I fildes\^
|
|
to become the current working directory,
|
|
the starting point for path searches for
|
|
path names
|
|
not beginning with
|
|
\f4/\f1.
|
|
.I path\^
|
|
points to the
|
|
path name
|
|
of a directory.
|
|
The
|
|
.I fildes\^
|
|
argument to
|
|
\f4fchdir\fP
|
|
is an open file descriptor of a directory.
|
|
.PP
|
|
In order for a directory to become the current directory, a process
|
|
must have execute (search) access to the directory.
|
|
.PP
|
|
\f4chdir\fP
|
|
will fail and the current working directory will be unchanged if
|
|
one or more of the following are true:
|
|
.TP 20
|
|
\f4EACCES\fP
|
|
Search permission is denied for any component of the
|
|
path name.
|
|
.TP 20
|
|
\f4EFAULT\fP
|
|
.I path\^
|
|
points outside the allocated address space of the process.
|
|
.TP 20
|
|
\f4EINTR\fP
|
|
A signal was caught during the execution of the \f4chdir\fP system call.
|
|
.TP 20
|
|
\f4EIO\fP
|
|
An I/O error occurred while reading from or writing to the file system.
|
|
.TP 20
|
|
\f4ELOOP\fP
|
|
Too many symbolic links were encountered in translating
|
|
.IR path .
|
|
.TP 20
|
|
\f4ENAMETOOLONG\fP
|
|
The length of the \f2path\f1 argument exceeds {\f4PATH_MAX\f1}, or the
|
|
length of a \f2path\f1 component exceeds {\f4NAME_MAX\f1} while
|
|
\f4_POSIX_NO_TRUNC\f1 is in effect.
|
|
.TP 20
|
|
\f4ENOTDIR\fP
|
|
A component of the path name is not a directory.
|
|
.TP 20
|
|
\f4ENOENT\fP
|
|
Either a component of the path prefix or the directory named by
|
|
.I path
|
|
does not exist or is a null pathname.
|
|
.TP 20
|
|
\f4ENOLINK\fP
|
|
\f2path\f1 points to a remote machine and the link
|
|
to that machine is no longer active.
|
|
.TP 20
|
|
\f4ETIMEDOUT\fP
|
|
The named file
|
|
is located on a remote file system which is not available [see \f4intro\fP(2)].
|
|
.TP 20
|
|
\f4EMULTIHOP\fP
|
|
Components of \f2path\f1 require hopping to multiple
|
|
remote machines and file system type does not allow it.
|
|
.PP
|
|
\f4fchdir\fP
|
|
will fail and the current working directory will be unchanged if
|
|
one or more of the following are true:
|
|
.TP 20
|
|
\f4EACCES\fP
|
|
Search permission is denied for \f2fildes\f1.
|
|
.TP 20
|
|
\f4EBADF\fP
|
|
.I fildes
|
|
is not an open file descriptor.
|
|
.TP 20
|
|
\f4EINTR\fP
|
|
A signal was caught during the execution of the \f4fchdir\fP system call.
|
|
.TP 20
|
|
\f4EIO\fP
|
|
An I/O error occurred while reading from or writing to the file system.
|
|
.TP 20
|
|
\f4ENOLINK\fP
|
|
\f2fildes\f1 refers to a directory on a remote file system
|
|
and the link to that machine is no longer active.
|
|
.TP 20
|
|
\f4ETIMEDOUT\fP
|
|
\f2fildes\f1 refers to a directory on a remote file system
|
|
which is not available [see \f4intro\fP(2)].
|
|
.TP 20
|
|
\f4ENOTDIR\fP
|
|
The open file descriptor
|
|
.I fildes\^
|
|
does not refer to a directory.
|
|
.TP 20
|
|
\f4ENOENT\fP
|
|
The directory pointed to by
|
|
.I fildes\^
|
|
does not exist.
|
|
.SH "SEE ALSO"
|
|
\f4chroot\fP(2).
|
|
.SH "DIAGNOSTICS"
|
|
Upon successful completion, a value of zero is returned.
|
|
Otherwise, a value of \-1 is returned and
|
|
\f4errno\fP
|
|
is set to indicate the error.
|