explain_futimens(3)
π explain_futimens(3) π
okay bestie, pull up a chair, because we're about to get into explain_futimens(3) from the Library Functions Manual β and no, it's not as scary as it sounds, i promise π«Ά
β¨ NAME β¨
explain_futimens β the girl whose whole job is explaining futimens(3) errors to you π
πΈ SYNOPSIS πΈ
#include <libexplain/futimens.h>
const char *explain_futimens(int fildes, const struct time_spec *data);
const char *explain_errno_futimens(int errnum, int fildes, const struct
time_spec *data);
void explain_message_futimens(char *message, int message_size, int
fildes, const struct time_spec *data);
void explain_message_errno_futimens(char *message, int message_size, int
errnum, int fildes, const struct time_spec *data);
π¦ DESCRIPTION π¦
So like, these functions are your little translators β¨ β you use them to get explanations for errors that the futimens(3) system call hands back to you. Basically the system call says "nope" and these functions say "here's why, bestie."
π explain_futimens
const char *explain_futimens(int fildes, const struct time_spec *data);
The explain_futimens function is the one you call to get an explanation of an error that futimens(3) returned. And listen β the least the message will contain is the value of strerror(errno), but usually it's gonna do so much better than that and tell you the actual underlying cause in way more detail. it's giving overachiever π
The errno global variable is what gets used to grab the error value that's gonna be decoded.
fildesβ the originalfildes, exactly as passed to thefutimens(3)system call. no edits, no glow-up, the og πdataβ the originaldata, exactly as passed to thefutimens(3)system call. same energy β¨
Returns: The message explaining the error. and okay here's the tea β this message buffer is shared by all the libexplain functions that don't supply a buffer in their argument list. so it's gonna get overwritten by the next call to any libexplain function that shares this buffer, including calls from other threads. π
Note: this function is not thread safe, because it shares a return buffer across all threads, and honestly a bunch of other functions in this library do too. not me being messy in a multithreaded program π
Example: This function is meant to be used in a fashion similar to this:
if (futimens(fildes, data) < 0)
{
fprintf(stderr, "%s\n", explain_futimens(fildes, data));
exit(EXIT_FAILURE);
}
The above code example is available pre-packaged as the explain_futimens_or_die(3) function. iconique, no cap π
π explain_errno_futimens
const char *explain_errno_futimens(int errnum, int fildes, const struct
time_spec *data);
The explain_errno_futimens function gets you an explanation of an error returned by the futimens(3) system call. Same deal as before β the least the message will contain is the value of strerror(errno), but usually it does much better and points at the real underlying cause in more detail. slay β¨
errnumβ the error value to be decoded, usually grabbed from theerrnoglobal variable right before this function is called. and why do you need to do that? because if you gotta run any code between the system call you're explaining and this function, you need to save it first β so many libc functions will alter the value oferrnoand ruin everything πfildesβ the originalfildes, exactly as passed to thefutimens(3)system call.dataβ the originaldata, exactly as passed to thefutimens(3)system call.
Returns: The message explaining the error. and again, bestie β this message buffer is shared by all libexplain functions that don't supply a buffer in their argument list. it will be overwritten by the next call to any libexplain function that shares this buffer, including other threads. π
Note: this function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library do the same. periodt.
Example: This function is meant to be used in a fashion similar to this:
if (futimens(fildes, data) < 0)
{
int err = errno;
fprintf(stderr, "%s\n", explain_errno_futimens(err, fildes,
data));
exit(EXIT_FAILURE);
}
The above code example is available pre-packaged as the explain_futimens_or_die(3) function. π
π explain_message_futimens
void explain_message_futimens(char *message, int message_size, int
fildes, const struct time_spec *data);
The explain_message_futimens function gets you an explanation of an error returned by the futimens(3) system call. you know the drill β the least the message will contain is the value of strerror(errno), but usually it does much better and shows the underlying cause in more detail π
The errno global variable is what gets used to obtain the error value to be decoded.
messageβ the location where the returned message gets stored. and here's the good news: if you supply a suitable message return buffer, this function is thread safe π₯³ main character energy frmessage_sizeβ the size in bytes of the location where the returned message gets stored.fildesβ the originalfildes, exactly as passed to thefutimens(3)system call.dataβ the originaldata, exactly as passed to thefutimens(3)system call.
Example: This function is meant to be used in a fashion similar to this:
if (futimens(fildes, data) < 0)
{
char message[3000];
explain_message_futimens(message, sizeof(message), fildes,
data);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
The above code example is available pre-packaged as the explain_futimens_or_die(3) function. π¦
π explain_message_errno_futimens
void explain_message_errno_futimens(char *message, int message_size, int
errnum, int fildes, const struct time_spec *data);
The explain_message_errno_futimens function gets you an explanation of an error returned by the futimens(3) system call. and yes, the least the message will contain is the value of strerror(errno), but usually it goes way harder and explains the underlying cause in more detail πΈ
messageβ the location where the returned message gets stored. if you supply a suitable message return buffer, this function is thread safe β¨message_sizeβ the size in bytes of the location where the returned message gets stored.errnumβ the error value to be decoded, usually obtained from theerrnoglobal variable right before this function is called. this is necessary if you need to call any code between the system call you're explaining and this function, because many libc functions will alter the value oferrnoand wreck the whole vibe πfildesβ the originalfildes, exactly as passed to thefutimens(3)system call.dataβ the originaldata, exactly as passed to thefutimens(3)system call.
Example: This function is meant to be used in a fashion similar to this:
if (futimens(fildes, data) < 0)
{
int err = errno;
char message[3000];
explain_message_errno_futimens(message, sizeof(message), err,
fildes, data);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
The above code example is available pre-packaged as the explain_futimens_or_die(3) function. π
π SEE ALSO π
futimens(3)β change file timestamps with nanosecond precision βexplain_futimens_or_die(3)β change file timestamps with nanosecond precision and report errors π₯
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2013 Peter Miller
and that's the whole page bestie π libexplain version 1.4, Copyright (C) 2013 Peter Miller β go forth and explain those errors, you absolute legend π§β¨
π¦ where this page comes from
- debian bookworm: libexplain-dev 1.4.D001-12+b1 Β· LGPL-3.0-or-later
- debian trixie: libexplain-dev 1.4.D001-16 Β· LGPL-3.0-or-later
- ubuntu jammy: libexplain-dev 1.4.D001-12 Β· LGPL-3.0-or-later
- ubuntu noble: libexplain-dev 1.4.D001-13 Β· LGPL-3.0-or-later
- ubuntu resolute: libexplain-dev 1.4.D001-16 Β· LGPL-3.0-or-later
- Copyright (C) 2013 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms