1FCHDIR(3P) POSIX Programmer's Manual FCHDIR(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 fchdir — change working directory
13
15 #include <unistd.h>
16
17 int fchdir(int fildes);
18
20 The fchdir() function shall be equivalent to chdir() except that the
21 directory that is to be the new current working directory is specified
22 by the file descriptor fildes.
23
24 A conforming application can obtain a file descriptor for a file of
25 type directory using open(), provided that the file status flags and
26 access modes do not contain O_WRONLY or O_RDWR.
27
29 Upon successful completion, fchdir() shall return 0. Otherwise, it
30 shall return -1 and set errno to indicate the error. On failure the
31 current working directory shall remain unchanged.
32
34 The fchdir() function shall fail if:
35
36 EACCES Search permission is denied for the directory referenced by
37 fildes.
38
39 EBADF The fildes argument is not an open file descriptor.
40
41 ENOTDIR
42 The open file descriptor fildes does not refer to a directory.
43
44 The fchdir() may fail if:
45
46 EINTR A signal was caught during the execution of fchdir().
47
48 EIO An I/O error occurred while reading from or writing to the file
49 system.
50
51 The following sections are informative.
52
54 None.
55
57 None.
58
60 None.
61
63 None.
64
66 chdir(), dirfd()
67
68 The Base Definitions volume of POSIX.1‐2017, <unistd.h>
69
71 Portions of this text are reprinted and reproduced in electronic form
72 from IEEE Std 1003.1-2017, Standard for Information Technology -- Por‐
73 table Operating System Interface (POSIX), The Open Group Base Specifi‐
74 cations Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of
75 Electrical and Electronics Engineers, Inc and The Open Group. In the
76 event of any discrepancy between this version and the original IEEE and
77 The Open Group Standard, the original IEEE and The Open Group Standard
78 is the referee document. The original Standard can be obtained online
79 at http://www.opengroup.org/unix/online.html .
80
81 Any typographical or formatting errors that appear in this page are
82 most likely to have been introduced during the conversion of the source
83 files to man page format. To report such errors, see https://www.ker‐
84 nel.org/doc/man-pages/reporting_bugs.html .
85
86
87
88IEEE/The Open Group 2017 FCHDIR(3P)