4.3BSD beta release manual page
[unix-history] / usr / src / lib / libc / sys / chroot.2
CommitLineData
b7793121
KM
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
0ca10058 5.\" @(#)chroot.2 6.1 (Berkeley) %G%
b7793121 6.\"
0ca10058 7.TH CHROOT 2 ""
b7793121
KM
8.UC 5
9.SH NAME
10chroot \- change root directory
11.SH SYNOPSIS
12.nf
13.ft B
14chroot(dirname)
15char *dirname;
16.ft R
17.fi
18.SH DESCRIPTION
19.I Dirname
20is the address of the pathname of a directory, terminated by a null byte.
21.I Chroot
22causes this directory
23to become the root directory,
24the starting point for path names beginning with ``/''.
25.PP
26In order for a directory to become the root directory
27a process must have execute (search) access to the directory.
28.PP
29This call is restricted to the super-user.
30.SH "RETURN VALUE
31Upon successful completion, a value of 0 is returned. Otherwise,
32a value of \-1 is returned and \fIerrno\fP is set to indicate an error.
33.SH ERRORS
34.I Chroot
35will fail and the root directory will be unchanged if
36one or more of the following are true:
37.TP 15
38[ENOTDIR]
39A component of the path name is not a directory.
40.TP 15
41[ENOENT]
42The pathname was too long.
43.TP 15
44[EPERM]
45The argument contains a byte with the high-order bit set.
46.TP 15
47[ENOENT]
48The named directory does not exist.
49.TP 15
50[EACCES]
51Search permission is denied for any component of
52the path name.
53.TP 15
54[EFAULT]
55.I Path
56points outside the process's allocated address space.
57.TP 15
58[ELOOP]
59Too many symbolic links were encountered in translating
60the pathname.
61.SH "SEE ALSO"
62chdir(2)