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