BSD 4_2 development
[unix-history] / usr / man / man2 / chdir.2
CommitLineData
fc24c23b
C
1.TH CHDIR 2 "2 July 1983"
2.UC 4
3.SH NAME
4chdir \- change current working directory
5.SH SYNOPSIS
6.nf
7.ft B
8chdir(path)
9char *path;
10.ft R
11.fi
12.SH DESCRIPTION
13.I Path
14is the pathname of a directory.
15.I Chdir
16causes this directory
17to become the current working directory,
18the starting point for path names not beginning with ``/''.
19.PP
20In order for a directory to become the current directory,
21a process must have execute (search) access to the directory.
22.SH "RETURN VALUE
23Upon successful completion, a value of 0 is returned.
24Otherwise, a value of \-1 is returned and \fIerrno\fP is set to indicate
25the error.
26.SH ERRORS
27.I Chdir
28will fail and the current working directory will be unchanged if
29one or more of the following are true:
30.TP 15
31[ENOTDIR]
32A component of the pathname is not a directory.
33.TP 15
34[ENOENT]
35The named directory does not exist.
36.TP 15
37[ENOENT]
38The argument path name was too long.
39.TP 15
40[EPERM]
41The argument contains a byte with the high-order bit set.
42.TP 15
43[EACCES]
44Search permission is denied for any component of
45the path name.
46.TP 15
47[EFAULT]
48.I Path
49points outside the process's allocated address space.
50.TP 15
51[ELOOP]
52Too many symbolic links were encountered in translating
53the pathname.
54.SH "SEE ALSO"
55chroot(2)