Commit | Line | Data |
---|---|---|
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 | |
10 | chroot \- change root directory | |
11 | .SH SYNOPSIS | |
12 | .nf | |
13 | .ft B | |
14 | chroot(dirname) | |
15 | char *dirname; | |
16 | .ft R | |
17 | .fi | |
18 | .SH DESCRIPTION | |
19 | .I Dirname | |
20 | is the address of the pathname of a directory, terminated by a null byte. | |
21 | .I Chroot | |
22 | causes this directory | |
23 | to become the root directory, | |
24 | the starting point for path names beginning with ``/''. | |
25 | .PP | |
26 | In order for a directory to become the root directory | |
27 | a process must have execute (search) access to the directory. | |
28 | .PP | |
9369d86e KB |
29 | It should be noted that |
30 | .I chroot | |
31 | has no effect on the process's current directory. | |
32 | .PP | |
b7793121 KM |
33 | This call is restricted to the super-user. |
34 | .SH "RETURN VALUE | |
35 | Upon successful completion, a value of 0 is returned. Otherwise, | |
36 | a value of \-1 is returned and \fIerrno\fP is set to indicate an error. | |
37 | .SH ERRORS | |
38 | .I Chroot | |
39 | will fail and the root directory will be unchanged if | |
40 | one or more of the following are true: | |
41 | .TP 15 | |
42 | [ENOTDIR] | |
43 | A component of the path name is not a directory. | |
44 | .TP 15 | |
b5984ffe KM |
45 | [EINVAL] |
46 | The pathname contains a character with the high-order bit set. | |
b7793121 | 47 | .TP 15 |
b5984ffe KM |
48 | [ENAMETOOLONG] |
49 | A component of a pathname exceeded 255 characters, | |
50 | or an entire path name exceeded 1023 characters. | |
b7793121 KM |
51 | .TP 15 |
52 | [ENOENT] | |
53 | The named directory does not exist. | |
54 | .TP 15 | |
55 | [EACCES] | |
b5984ffe KM |
56 | Search permission is denied for any component of the path name. |
57 | .TP 15 | |
58 | [ELOOP] | |
59 | Too many symbolic links were encountered in translating the pathname. | |
b7793121 KM |
60 | .TP 15 |
61 | [EFAULT] | |
62 | .I Path | |
63 | points outside the process's allocated address space. | |
fd690c8b KM |
64 | .TP 15 |
65 | [EIO] | |
66 | An I/O error occurred while reading from or writing to the file system. | |
b7793121 KM |
67 | .SH "SEE ALSO" |
68 | chdir(2) |