xref: /386bsd/usr/share/man/cat2/chroot.0 (revision a2142627)
1CHROOT(2)                 386BSD Programmer's Manual                 CHROOT(2)
2
3NNAAMMEE
4     cchhrroooott - change root directory
5
6SSYYNNOOPPSSIISS
7     ##iinncclluuddee <<uunniissttdd..hh>>
8
9     _i_n_t
10     cchhrroooott(_c_o_n_s_t _c_h_a_r *_d_i_r_n_a_m_e)
11
12DDEESSCCRRIIPPTTIIOONN
13     _D_i_r_n_a_m_e is the address of the pathname of a directory, terminated by an
14     ASCII NUL.  CChhrroooott() causes _d_i_r_n_a_m_e to become the root directory, that
15     is, the starting point for path searches of pathnames beginning with `/'.
16
17     In order for a directory to become the root directory a process must have
18     execute (search) access for that directory.
19
20     It should be noted that cchhrroooott() has no effect on the process's current
21     directory.
22
23     This call is restricted to the super-user.
24
25RREETTUURRNN VVAALLUUEESS
26     Upon successful completion, a value of 0 is returned.  Otherwise, a value
27     of -1 is returned and _e_r_r_n_o is set to indicate an error.
28
29EERRRROORRSS
30     CChhrroooott() will fail and the root directory will be unchanged if:
31
32     [ENOTDIR]  A component of the path name is not a directory.
33
34     [EINVAL]   The pathname contains a character with the high-order bit set.
35
36     [ENAMETOOLONG]
37                A component of a pathname exceeded 255 characters, or an
38                entire path name exceeded 1023 characters.
39
40     [ENOENT]   The named directory does not exist.
41
42     [EACCES]   Search permission is denied for any component of the path
43                name.
44
45     [ELOOP]    Too many symbolic links were encountered in translating the
46                pathname.
47
48     [EFAULT]   _P_a_t_h points outside the process's allocated address space.
49
50     [EIO]      An I/O error occurred while reading from or writing to the
51                file system.
52
53SSEEEE AALLSSOO
54     chdir(2)
55
56HHIISSTTOORRYY
57     The cchhrroooott function call appeared in 4.2BSD.
58
594.2 Berkeley Distribution       March 10, 1991                               1
60
61
62
63
64
65
66
67