spelling
[unix-history] / usr / src / lib / libc / sys / chdir.2
CommitLineData
be16c266
KM
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
fd690c8b 5.\" @(#)chdir.2 6.3 (Berkeley) %G%
be16c266 6.\"
f313899c 7.TH CHDIR 2 ""
be16c266
KM
8.UC 4
9.SH NAME
10chdir \- change current working directory
11.SH SYNOPSIS
12.nf
9726efd6
KM
13.ft B
14chdir(path)
15char *path;
16.ft R
be16c266
KM
17.fi
18.SH DESCRIPTION
9726efd6
KM
19.I Path
20is the pathname of a directory.
be16c266
KM
21.I Chdir
22causes this directory
23to become the current working directory,
9726efd6
KM
24the starting point for path names not beginning with ``/''.
25.PP
26In order for a directory to become the current directory,
27a process must have execute (search) access to the directory.
28.SH "RETURN VALUE
29Upon successful completion, a value of 0 is returned.
30Otherwise, a value of \-1 is returned and \fIerrno\fP is set to indicate
31the error.
32.SH ERRORS
33.I Chdir
34will fail and the current working directory will be unchanged if
35one or more of the following are true:
36.TP 15
37[ENOTDIR]
b5984ffe 38A component of the path prefix is not a directory.
9726efd6 39.TP 15
b5984ffe
KM
40[EINVAL]
41The pathname contains a character with the high-order bit set.
42.TP 15
43[ENAMETOOLONG]
44A component of a pathname exceeded 255 characters,
45or an entire path name exceeded 1023 characters.
9726efd6
KM
46.TP 15
47[ENOENT]
b5984ffe 48The named directory does not exist.
9726efd6 49.TP 15
b5984ffe
KM
50[ELOOP]
51Too many symbolic links were encountered in translating the pathname.
9726efd6
KM
52.TP 15
53[EACCES]
54Search permission is denied for any component of
55the path name.
56.TP 15
57[EFAULT]
58.I Path
59points outside the process's allocated address space.
fd690c8b
KM
60.TP 15
61[EIO]
62An I/O error occurred while reading from or writing to the file system.
be16c266 63.SH "SEE ALSO"
9726efd6 64chroot(2)