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 | .\"
|
---|
5 | .\" @(#)chdir.2 6.3 (Berkeley) 8/26/85
|
---|
6 | .\"
|
---|
7 | .TH CHDIR 2 "August 26, 1985"
|
---|
8 | .UC 4
|
---|
9 | .SH NAME
|
---|
10 | chdir, fchdir \- change current working directory
|
---|
11 | .SH SYNOPSIS
|
---|
12 | .nf
|
---|
13 | .ft B
|
---|
14 | #include <unistd.h>
|
---|
15 |
|
---|
16 | int chdir(const char *\fIpath\fP)
|
---|
17 | int fchdir(int \fIfd\fP)
|
---|
18 | .ft R
|
---|
19 | .fi
|
---|
20 | .SH DESCRIPTION
|
---|
21 | .I Path
|
---|
22 | is the pathname of a directory.
|
---|
23 | .I Fd
|
---|
24 | is the file descriptor of a directory.
|
---|
25 |
|
---|
26 | .B Chdir
|
---|
27 | causes this directory
|
---|
28 | to become the current working directory,
|
---|
29 | the starting point for path names not beginning with ``/''.
|
---|
30 | .PP
|
---|
31 | In order for a directory to become the current directory,
|
---|
32 | a process must have execute (search) access to the directory.
|
---|
33 | .SH "RETURN VALUE
|
---|
34 | Upon successful completion, a value of 0 is returned.
|
---|
35 | Otherwise, a value of \-1 is returned and \fBerrno\fP is set to indicate
|
---|
36 | the error.
|
---|
37 | .SH ERRORS
|
---|
38 | .B Chdir
|
---|
39 | will fail and the current working directory will be unchanged if
|
---|
40 | one or more of the following are true:
|
---|
41 | .TP 15
|
---|
42 | [ENOTDIR]
|
---|
43 | A component of the path prefix is not a directory.
|
---|
44 | .TP 15
|
---|
45 | [ENAMETOOLONG]
|
---|
46 | The path name exceeds PATH_MAX characters.
|
---|
47 | .TP 15
|
---|
48 | [ENOENT]
|
---|
49 | The named directory does not exist.
|
---|
50 | .TP 15
|
---|
51 | [ELOOP]
|
---|
52 | Too many symbolic links were encountered in translating the pathname.
|
---|
53 | (Minix-vmd)
|
---|
54 | .TP 15
|
---|
55 | [EACCES]
|
---|
56 | Search permission is denied for any component of
|
---|
57 | the path name.
|
---|
58 | .TP 15
|
---|
59 | [EFAULT]
|
---|
60 | .I Path
|
---|
61 | points outside the process's allocated address space.
|
---|
62 | .TP 15
|
---|
63 | [EIO]
|
---|
64 | An I/O error occurred while reading from or writing to the file system.
|
---|
65 | .SH "SEE ALSO"
|
---|
66 | .BR chroot (2).
|
---|