futimes(3)
โจ futimes(3) โ change file timestamps โจ
okay bestie, welcome to the futimes page ๐ โ that's futimes and its little sibling lutimes, two tiny glibc cuties that let you mess with a file's access and modification times. They live in the Standard C library, a.k.a. libc (link with -lc), so you already have them, no cap ๐ธ
๐ SYNOPSIS ๐
#include <sys/time.h>
int futimes(int fd, const struct timeval tv[2]);
int lutimes(const char *path, const struct timeval tv[2]);
๐ Feature Test Macro Requirements for glibc ๐
(peep feature_test_macros(7) if you're confused, queen)
futimes(), lutimes():
- Since glibc 2.19:
_DEFAULT_SOURCE
- glibc 2.19 and earlier:
_BSD_SOURCE
fr fr, define the right macro before you include anything, or these functions will ghost you ๐
๐ DESCRIPTION ๐
futimes() changes the access and modification times of a file exactly the same way utimes(2) does โ the only glow-up is that you tell it which file via a file descriptor, fd, instead of a pathname. it's giving "I already have the fd open, why would I re-open by path" energy ๐
lutimes() also changes access and modification times just like utimes(2), but with one iconic twist: if path points at a symbolic link, the link does not get dereferenced. instead, it changes the timestamps of the symbolic link itself ๐ฆ (yes, links have timestamps too, main character behavior honestly)
โญ RETURN VALUE โญ
- On success:
0is returned ๐ - On error:
-1is returned, anderrnois set to tell you what went wrong ๐ญ
๐ฅ ERRORS ๐ฅ
Errors are as for utimes(2), plus these extra ones for futimes():
EBADFโfdis not a valid file descriptor. bestie that fd is not real ๐ENOSYSโ the/procfilesystem could not be accessed.
And this additional error can happen for lutimes():
ENOSYSโ the kernel does not support this call; Linux 2.6.22 or later is required. old kernel? no lutimes for you ๐ซถ
๐ ATTRIBUTES ๐
for the whole explanation of what these terms mean, go read attributes(7) โ iykyk
- Interface:
futimes(),lutimes()- Attribute: Thread safety
- Value:
MT-Safe
so yes, they're thread-safe. slay ๐
๐ STANDARDS ๐
Linux, BSD.
๐ง HISTORY ๐ง
futimes()โ glibc 2.3.lutimes()โ glibc 2.6.
glow-up timeline, honestly ๐
๐ NOTES ๐
lutimes() is implemented using the utimensat(2) system call. that's the whole tea โ
๐ธ SEE ALSO ๐ธ
utime(2), utimensat(2), symlink(7)
lowkey reminder:futimes()takes an fd,lutimes()takes a path and doesn't follow symlinks. don't mix them up bestie ๐ญ
and that's the page, periodt ๐ this was Linux man-pages 6.20, dated 2026-02-08 โ mwah, go change some timestamps responsibly ๐ฆโจ
๐ฆ 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-2008, 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