futimesat(2)
π futimesat(2) π β the System Calls Manual, but make it a group chat
okay so bestie, gather round, because we're talking about futimesat(2) from the System Calls Manual and honestly? she's a legacy queen. we stan an icon but we also gently suggest you move on. let's get into it π
β¨ NAME β¨
futimesat β change timestamps of a file relative to a directory file descriptor
like, you're touching a file's timestamps, but you're doing it relative to a directory file descriptor. very "it's not about the destination, it's about the dirfd" of it all π¦
π LIBRARY π
Standard C library (libc, -lc)
π SYNOPSIS π
#include <fcntl.h> /* Definition of AT_* constants */
#include <sys/time.h>
[[deprecated]] int futimesat(int dirfd, const char *path,
const struct timeval times[2]);
Feature Test Macro Requirements for glibc (peep feature_test_macros(7) if you're nosy π):
futimesat():
_GNU_SOURCE
bestie. see that [[deprecated]] sitting right there in the signature? that's not a vibe, that's a warning label. the compiler is side-eyeing you fr fr π
πΈ DESCRIPTION πΈ
okay so first thing first, and I need you to hear me on this one:
This system call is obsolete. Use utimensat(2) instead.
periodt. that's the whole assignment. she's retired, she's living her best life in the man-pages archives, and there's a newer, shinier syscall doing her job.
but if you're here for the lore (respect, honestly), the futimesat() system call operates in exactly the same way as utimes(2), except for the differences described in this manual page. so likeβ¦ same energy, tiny plot twists β¨
the twists:
- If
pathis relative, then it is interpreted relative to the directory referred to by the file descriptordirfdβ not relative to the current working directory of the calling process, which is whatutimes(2)does for a relative pathname. she does things her way, with herdirfdπ - If
pathis relative anddirfdis the special valueAT_FDCWD, thenpathis interpreted relative to the current working directory of the calling process (just likeutimes(2)does it β so, the classic behaviour, no notes). - If
pathis absolute, thendirfdis ignored. like, fully ghosted. (If you're sitting there like "why doesdirfdeven exist then??", go readopenat(2)for an explanation of why thedirfdargument is useful. she explains everything, she's so good to us π«Ά)
π¦ RETURN VALUE π¦
- On success,
futimesat()returns a0. slay. - On error,
-1is returned anderrnois set to indicate the error. not slay, but informative π
π ERRORS π
The same errors that occur for utimes(2) can also occur for futimesat(). so if you already know utimes(2)'s drama, you know hers β it's a shared trauma kind of situation π
The following additional errors can occur for futimesat():
EBADFβpathis relative butdirfdis neitherAT_FDCWDnor a valid file descriptor. girl, that's not a directory fd, that's β¨nothingβ¨ENOTDIRβpathis relative anddirfdis a file descriptor referring to a file other than a directory. the audacity of a regular file trying to act like a directory smh, we don't do that here π
π VERSIONS π
π§ glibc π§
If path is NULL, then the glibc futimesat() wrapper function updates the times for the file referred to by dirfd.
yes bestie, NULL path is a real thing here. that's the little glibc-exclusive party trick π
β STANDARDS β
None.
not a POSIX girlie, not an ISO girlie, just out here existing on vibes alone. literally no standard claims her. it's giving independent π¦
π HISTORY π
Linux 2.6.16, glibc 2.4.
she's been around. she was implemented from a specification that was proposed for POSIX.1, but that specification was replaced by the one for utimensat(2). so she got drafted, then the draft got replaced, and now she's on the deprecated list. character development, honestly π
A similar system call exists on Solaris. (hi Solaris, we see you π)
π NOTES π
...it's giving empty. bestie there is genuinely nothing in this section. no cap. we're just here, standing in the notes section, vibing in silence π³οΈβ¨
π₯ SEE ALSO π₯
and that's the whole page, bestie! π one last thing before you go: this little masterpiece came from Linux man-pages 6.20, dated 2026-02-08 β so go thank the man-pages girlies for their service, and go use utimensat(2) instead of this one, fr fr. mwah π
π
π¦ where this page comes from
- 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 6.20
- π the page's license: Linux-man-pages-copyleft
- Copyright 2006, Michael Kerrisk <mtk.manpages@gmail.com>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms