|
|
1.1 root 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.5 (Berkeley) 6/6/89
6: .\"
7: .TH CHDIR 2 "June 6, 1989"
8: .UC 4
9: .SH NAME
10: chdir, fchdir \- change current working directory
11: .SH SYNOPSIS
12: .nf
13: .ft B
14: chdir(path)
15: char *path;
16: .ft R
17: .fi
18: .LP
19: .nf
20: .ft B
21: fchdir(fd)
22: int fd;
23: .fi
24: .ft R
25: .SH DESCRIPTION
26: .I Path
27: is the pathname of a directory.
28: .I Chdir
29: causes this directory
30: to become the current working directory,
31: the starting point for path names not beginning with ``/''.
32: .PP
33: .I Fchdir
34: causes the directory referenced by
35: .I fd
36: to become the current working directory,
37: the starting point for path names not beginning with ``/''.
38: .PP
39: In order for a directory to become the current directory,
40: a process must have execute (search) access to the directory.
41: .SH "RETURN VALUE
42: Upon successful completion, a value of 0 is returned.
43: Otherwise, a value of \-1 is returned and \fIerrno\fP is set to indicate
44: the error.
45: .SH ERRORS
46: .I Chdir
47: will fail and the current working directory will be unchanged if
48: one or more of the following are true:
49: .TP 15
50: [ENOTDIR]
51: A component of the path prefix is not a directory.
52: .TP 15
53: [EINVAL]
54: The pathname contains a character with the high-order bit set.
55: .TP 15
56: [ENAMETOOLONG]
57: A component of a pathname exceeded 255 characters,
58: or an entire path name exceeded 1023 characters.
59: .TP 15
60: [ENOENT]
61: The named directory does not exist.
62: .TP 15
63: [ELOOP]
64: Too many symbolic links were encountered in translating the pathname.
65: .TP 15
66: [EACCES]
67: Search permission is denied for any component of
68: the path name.
69: .TP 15
70: [EFAULT]
71: .I Path
72: points outside the process's allocated address space.
73: .TP 15
74: [EIO]
75: An I/O error occurred while reading from or writing to the file system.
76: .LP
77: .I Fchdir
78: will fail and the current working directory will be unchanged if
79: one or more of the following are true:
80: .TP 15
81: [ENOTDIR]
82: The file descriptor does not reference a directory.
83: .TP 15
84: EBADF
85: .I fd
86: is not a valid open file descriptor.
87: .SH "SEE ALSO"
88: chroot(2)
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.