CHDIR(2) UNIX Programmer's Manual CHDIR(2) NAME chdir, chroot - change default directory SYNOPSIS chdir(dirname) char *dirname; chroot(dirname) char *dirname; DESCRIPTION _D_i_r_n_a_m_e is the address of the path name of a directory, ter- minated by a null byte. _C_h_d_i_r causes this directory to become the current working directory, the starting point for path names not beginning with `/'. _C_h_r_o_o_t sets the root directory, the starting point for path names beginning with `/'. The call is restricted to the super-user. RETURN VALUE Upon successful completion, a value of 0 is returned. Oth- erwise, a value of -1 is returned and _e_r_r_n_o is set to indi- cate the error. ERRORS _C_h_d_i_r (respectively _c_h_r_o_o_t) will fail and the current work- ing directory (starting point for path names beginning with `/') will be unchanged if one or more of the following is true: [ENOTDIR] A component of the path name is not a directory. [ENOENT] The named directory does not exist. [EINVAL] The _d_i_r_n_a_m_e contained a non-ASCII byte. [EACCES] Search permission is denied for any com- ponent of the path name. [EFAULT] _D_i_r_n_a_m_e points outside the process's allocated address space. [ELOOP] Too many symbolic links were encountered in translating the path name. _C_h_r_o_o_t will also fail if: [EPERM] The user is not the super-user. Printed 5/23/83 1 CHDIR(2) UNIX Programmer's Manual CHDIR(2) SEE ALSO cd(1) ASSEMBLER (chdir = 12.) sys chdir; dirname (chroot = 61.) sys chroot; dirname Printed 5/23/83 2