94 lines
2.4 KiB
Groff
94 lines
2.4 KiB
Groff
'\"macro stdmacro
|
|
.if n .pH g2.chroot @(#)chroot 41.4 of 5/26/91
|
|
.\" Copyright 1991 UNIX System Laboratories, Inc.
|
|
.\" Copyright 1989, 1990 AT&T
|
|
.nr X
|
|
.if \nX=0 .ds x} chroot 2 "" "\&"
|
|
.if \nX=1 .ds x} chroot 2 ""
|
|
.if \nX=2 .ds x} chroot 2 "" "\&"
|
|
.if \nX=3 .ds x} chroot "" "" "\&"
|
|
.TH \*(x}
|
|
.SH NAME
|
|
\f4chroot\f1 \- change root directory
|
|
.SH SYNOPSIS
|
|
\f4#include <unistd.h>\f1
|
|
.PP
|
|
\f4int chroot(const char \(**path);\f1
|
|
.SH DESCRIPTION
|
|
.I path\^
|
|
points to a
|
|
path name
|
|
naming a directory.
|
|
\f4chroot\fP
|
|
causes the named directory to become the root directory,
|
|
the starting point for path searches for
|
|
path names
|
|
beginning with
|
|
\f4/\f1.
|
|
The user's working directory is unaffected by the \f4chroot\fP system call.
|
|
.PP
|
|
The calling process must have the super-user privilege
|
|
to change the root directory.
|
|
.PP
|
|
The
|
|
\f4\&..\f1
|
|
entry in the root directory is interpreted to mean the root directory
|
|
itself.
|
|
Thus,
|
|
\f4\&..\f1
|
|
cannot be used to access files outside the subtree rooted at the root
|
|
directory.
|
|
.PP
|
|
\f4chroot\fP
|
|
will fail and the root directory will remain unchanged if
|
|
one or more of the following are true:
|
|
.TP 15
|
|
\f4EACCES\fP
|
|
Search permission is denied on a component of the pathname.
|
|
.TP 15
|
|
\f4ELOOP\fP
|
|
Too many symbolic links were encountered in translating \f2path\f1.
|
|
.TP
|
|
\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
|
|
\f4EFAULT\fP
|
|
.I path\^
|
|
points outside the allocated address space of the process.
|
|
.TP
|
|
\f4EINTR\fP
|
|
A signal was caught during the \f4chroot\fP system call.
|
|
.TP
|
|
\f4EMULTIHOP\fP
|
|
Components of \f2path\f1 require hopping to multiple
|
|
remote machines and file system type does not allow it.
|
|
.TP
|
|
\f4ENOLINK\fP
|
|
\f2path\f1 points to a remote machine and the link
|
|
to that machine is no longer active.
|
|
.TP 15
|
|
\f4ETIMEDOUT\fP
|
|
The named directory
|
|
is located on a remote file system which is not available [see \f4intro\fP(2)].
|
|
.TP
|
|
\f4ENOTDIR\fP
|
|
Any component of the path name is not a directory.
|
|
.TP
|
|
\f4ENOENT\fP
|
|
The named directory does not exist or is a null pathname.
|
|
.TP
|
|
\f4EPERM\fP
|
|
The calling process does not have the super-user privilege
|
|
for changing the root directory.
|
|
.SH "SEE ALSO"
|
|
\f4chdir\fP(2).
|
|
.SH "DIAGNOSTICS"
|
|
Upon successful completion, a value of 0 is returned.
|
|
Otherwise, a value of \-1 is returned and
|
|
\f4errno\fP
|
|
is set to indicate the error.
|
|
.\" @(#)chroot.2 6.2 of 9/6/83
|
|
.Ee
|