add -s option which inserts/matches truncated member names
[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.\"
9369d86e 5.\" @(#)chroot.2 6.4 (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
9369d86e
KB
29It should be noted that
30.I chroot
31has no effect on the process's current directory.
32.PP
b7793121
KM
33This call is restricted to the super-user.
34.SH "RETURN VALUE
35Upon successful completion, a value of 0 is returned. Otherwise,
36a value of \-1 is returned and \fIerrno\fP is set to indicate an error.
37.SH ERRORS
38.I Chroot
39will fail and the root directory will be unchanged if
40one or more of the following are true:
41.TP 15
42[ENOTDIR]
43A component of the path name is not a directory.
44.TP 15
b5984ffe
KM
45[EINVAL]
46The pathname contains a character with the high-order bit set.
b7793121 47.TP 15
b5984ffe
KM
48[ENAMETOOLONG]
49A component of a pathname exceeded 255 characters,
50or an entire path name exceeded 1023 characters.
b7793121
KM
51.TP 15
52[ENOENT]
53The named directory does not exist.
54.TP 15
55[EACCES]
b5984ffe
KM
56Search permission is denied for any component of the path name.
57.TP 15
58[ELOOP]
59Too many symbolic links were encountered in translating the pathname.
b7793121
KM
60.TP 15
61[EFAULT]
62.I Path
63points outside the process's allocated address space.
fd690c8b
KM
64.TP 15
65[EIO]
66An I/O error occurred while reading from or writing to the file system.
b7793121
KM
67.SH "SEE ALSO"
68chdir(2)