FCHDIR(3POSIX)
β¨ PROLOG β¨
ok so bestie, real talk before we even get into it: this page is part of the POSIX Programmer's Manual π and the Linux implementation of this interface may differ from what's written here. like, literally, consult the corresponding Linux manual page for details of Linux behavior. or β plot twist β the interface might not even be implemented on Linux at all. so don't come for me if it's giving nothing on your machine π
πΈ NAME πΈ
fchdir β change working directory. that's it, that's the whole vibe, she changes your cwd π
β¨ SYNOPSIS β¨
#include <unistd.h>
int fchdir(int fildes);
π¦ DESCRIPTION π¦
so fchdir() shall be equivalent to chdir() β same energy, same job β EXCEPT that the directory that's gonna be your new current working directory is specified by the file descriptor fildes instead of a path. that's the entire plot twist, no cap π
and here's the tea for a conforming application: you can obtain a file descriptor for a file of type directory using open(), provided that the file status flags and access modes do not contain O_WRONLY or O_RDWR. so like, read-only or nothing, bestie, that's the rule π₯
π RETURN VALUE π
upon successful completion, fchdir() shall return 0. slay. β¨
otherwise it shall return -1 and set errno to indicate the error π and on failure the current working directory shall remain unchanged β so like, no surprise glow-down, your cwd stays exactly where it was, periodt.
π ERRORS π
the fchdir() function shall fail if:
EACCESβ search permission is denied for the directory referenced byfildes. she said no entry, respectfully πEBADFβ thefildesargument is not an open file descriptor. girl that's not even a real fd πENOTDIRβ the open file descriptorfildesdoes not refer to a directory. like, bestie, that's a file. that is not a directory. read the room π«Ά
the fchdir() may fail if:
EINTRβ a signal was caught during the execution offchdir(). interruptions, the audacity πEIOβ an I/O error occurred while reading from or writing to the file system. the hardware is not giving today π§οΈ
and jsyk: the following sections are informative. they're the vibe context, not the rules π
π EXAMPLES π
None. β nothing here, she's booked and busy elsewhere β¨
π§ APPLICATION USAGE π§
None. β also empty, no notes, iconic behavior π
π RATIONALE π
None. β she didn't feel like explaining herself and honestly? respect π
β FUTURE DIRECTIONS β
None. β the future is bright but this section is blank πΈ
π SEE ALSO π
chdir()dirfd()- the Base Definitions volume of POSIX.1β2017,
<unistd.h>
π COPYRIGHT π
ok so the legal bit, and we do NOT skip the legal bit bestie, here it is in full:
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!! π«Ά this one's from the POSIX Programmer's Manual, FCHDIR(3POSIX), brought to you by IEEE/The Open Group, dated 2017 β mwah, drink water, go change a directory πβ¨π
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms