CHROOT(2) BSD Programmer's Manual CHROOT(2)
c
\bch
\bhr
\bro
\boo
\bot
\bt - change root directory
S
\bSY
\bYN
\bNO
\bOP
\bPS
\bSI
\bIS
\bS
#
\b#i
\bin
\bnc
\bcl
\blu
\bud
\bde
\be <
\b<u
\bun
\bni
\bis
\bst
\btd
\bd.
\b.h
\bh>
\b>
c
\bch
\bhr
\bro
\boo
\bot
\bt(_
\bc_
\bo_
\bn_
\bs_
\bt _
\bc_
\bh_
\ba_
\br _
\b*_
\bd_
\bi_
\br_
\bn_
\ba_
\bm_
\be);
D
\bDE
\bES
\bSC
\bCR
\bRI
\bIP
\bPT
\bTI
\bIO
\bON
\bN
_
\bD_
\bi_
\br_
\bn_
\ba_
\bm_
\be is the address of the pathname of a directory, terminated by an
ASCII NUL. C
\bCh
\bhr
\bro
\boo
\bot
\bt() causes _
\bd_
\bi_
\br_
\bn_
\ba_
\bm_
\be to become the root directory, that
is, the starting point for path searches of pathnames beginning with `/'.
In order for a directory to become the root directory a process must have
execute (search) access for that directory.
It should be noted that c
\bch
\bhr
\bro
\boo
\bot
\bt() has no effect on the process's current
This call is restricted to the super-user.
R
\bRE
\bET
\bTU
\bUR
\bRN
\bN V
\bVA
\bAL
\bLU
\bUE
\bES
\bS
Upon successful completion, a value of 0 is returned. Otherwise, a value
of -1 is returned and _
\be_
\br_
\br_
\bn_
\bo is set to indicate an error.
C
\bCh
\bhr
\bro
\boo
\bot
\bt() will fail and the root directory will be unchanged if:
[ENOTDIR] A component of the path name is not a directory.
[EINVAL] The pathname contains a character with the high-order bit set.
A component of a pathname exceeded 255 characters, or an en-
tire path name exceeded 1023 characters.
[ENOENT] The named directory does not exist.
[EACCES] Search permission is denied for any component of the path
[ELOOP] Too many symbolic links were encountered in translating the
[EFAULT] _
\bP_
\ba_
\bt_
\bh points outside the process's allocated address space.
[EIO] An I/O error occurred while reading from or writing to the
S
\bSE
\bEE
\bE A
\bAL
\bLS
\bSO
\bO
H
\bHI
\bIS
\bST
\bTO
\bOR
\bRY
\bY
The c
\bch
\bhr
\bro
\boo
\bot
\bt function call appeared in 4.2BSD.
4.2 Berkeley Distribution June 4, 1993 1