FCHDIR(3P)
πΈ PROLOG π
okay bestie, real talk before we even get into it: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (so like, go check the corresponding Linux manual page for the tea on Linux behavior), or the interface may literally not be implemented on Linux at all. iykyk.
β¨ NAME β¨
fchdir β change working directory π¦
π SYNOPSIS π
#include <unistd.h>
int fchdir(int fildes);
π DESCRIPTION π
so fchdir() is basically chdir()'s twin, no cap β it shall be equivalent to chdir() and everything, except the plot twist is that the directory that's gonna become your new current working directory is specified by the file descriptor fildes instead of a path. it's giving "same energy, different delivery" fr fr.
and listen β a conforming application can obtain a file descriptor for a file of type directory using open(), as long as the file status flags and access modes do not contain O_WRONLY or O_RDWR. read-only or nothing, bestie. π
π₯ RETURN VALUE π₯
upon successful completion, fchdir() shall return 0. slay.
otherwise, it shall return -1 and set errno to indicate the error. and the way that on failure the current working directory shall remain unchanged β so at least it doesn't leave you in a random place, iconic behavior honestly.
π ERRORS π
the fchdir() function shall fail if:
EACCESβ search permission is denied for the directory referenced byfildes. rude.EBADFβ thefildesargument is not an open file descriptor. that's not a real one bestie πENOTDIRβ the open file descriptorfildesdoes not refer to a directory. it's giving "wrong vibe entirely" π
the fchdir() may fail if:
EINTRβ a signal was caught during the execution offchdir().EIOβ an I/O error occurred while reading from or writing to the file system.
psst: the following sections are informative. that's the official word, not me being shady.
π EXAMPLES π
None. bestie there is literally nothing here. empty. void. the silence is deafening. π«Ά
πΈ APPLICATION USAGE πΈ
None. again. nothing. we love a minimal queen. β¨
π RATIONALE π
None. no explanation given, no thoughts, head empty, still ate. π
π¦ FUTURE DIRECTIONS π¦
None. the future is unspecified and honestly? that's a mood.
β SEE ALSO β
chdir()dirfd()
also, from the Base Definitions volume of POSIX.1β2017: <unistd.h> π
π COPYRIGHT π
okay this is the serious part, no skipping:
portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. in the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. the original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. to report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page bestie β IEEE/The Open Group, 2017, FCHDIR(3P), signed, sealed, delivered, and yes she ate π
β¨
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms