explain_futimes(3)
π NAME π
okay so, bestie, <rainbow>explain_futimes</rainbow> β she explains futimes(3) errors. that's it, that's the whole job, and she ate. π
this page lives in the Library Functions Manual, and you're gonna want to keep it in your back pocket, fr fr.
β¨ SYNOPSIS β¨
#include <libexplain/futimes.h>
const char *explain_futimes(int fildes, const struct timeval *tv);
const char *explain_errno_futimes(int errnum, int fildes, const struct timeval *tv);
void explain_message_futimes(char *message, int message_size, int fildes, const struct timeval *tv);
void explain_message_errno_futimes(char *message, int message_size, int errnum, int fildes, const struct timeval *tv);
π¦ DESCRIPTION π¦
so like, these functions? they're how you get actual explanations for the errors that the futimes(3) system call throws back at you. think of it as the friend who translates cryptic error codes into human feelings. π
πΈ explain_futimes πΈ
const char *explain_futimes(int fildes, const struct timeval *tv);
explain_futimes is the one you call when you want the tea on an error that came back from the futimes(3) system call. the bare minimum it'll give you is the value of strerror(errno), but ngl, it usually pops off way harder than that and tells you the actual underlying cause in more detail. π
it reads the errno global variable to get the error value it's decoding.
this one's meant to be used in a vibe like this, bestie:
if (futimes(fildes, tv) < 0)
{
fprintf(stderr, "%s\n", explain_futimes(fildes, tv));
exit(EXIT_FAILURE);
}
that code right there? it's already available pre-packaged as the explain_futimes_or_die(3) function. iconic behavior.
fildesβ the original fildes, exactly as you passed it to thefutimes(3)system call. no edits, no remixes.tvβ the original tv, exactly as you passed it to thefutimes(3)system call. same energy.
Returns:
- the message explaining the error. π«Ά heads up though: this message buffer is shared by all libexplain functions that don't supply a buffer in their own argument list. so it gets overwritten by the very next call to any libexplain function that shares this buffer β including calls from other threads. it's giving communal lip gloss, honestly.
Note: this function is not thread safe, because it shares a return buffer across all threads, and so do many other functions in this library. π
π§ explain_errno_futimes π§
const char *explain_errno_futimes(int errnum, int fildes, const struct timeval *tv);
explain_errno_futimes does the same job β it gets you an explanation of an error returned by the futimes(3) system call. the least you'll get is the value of strerror(errnum), but usually it goes so much harder and points at the underlying cause in more detail. β¨
use it kinda like this:
if (futimes(fildes, tv) < 0)
{
int err = errno;
fprintf(stderr, "%s\n", explain_errno_futimes(err, fildes, tv));
exit(EXIT_FAILURE);
}
yep, this example is also pre-packaged as the explain_futimes_or_die(3) function.
errnumβ the error value you want decoded, usually grabbed from theerrnoglobal variable right before you call this function. you need to do that if you're running any code between the system call being explained and this function, because a lot of libc functions will change the value oferrnoand ruin everything. πfildesβ the original fildes, exactly as passed to thefutimes(3)system call.tvβ the original tv, exactly as passed to thefutimes(3)system call.
Returns:
- the message explaining the error. and again: this buffer is shared by all libexplain functions that don't take a buffer in their argument list, so it'll be overwritten by the next call to any libexplain function sharing it, other threads included. π«
Note: not thread safe, bestie β shared return buffer across all threads, and plenty of other functions in this library do the same. π
π explain_message_futimes π
void explain_message_futimes(char *message, int message_size, int fildes, const struct timeval *tv);
explain_message_futimes is your girl when you want an explanation of an error returned by the futimes(3) system call. minimum content: the value of strerror(errno). but usually? so much better, with the actual underlying cause spelled out in more detail. π
it pulls the error value to decode from the errno global variable.
the intended vibe:
if (futimes(fildes, tv) < 0)
{
char message[3000];
explain_message_futimes(message, sizeof(message), fildes, tv);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
and yes, pre-packaged as explain_futimes_or_die(3). π₯
messageβ where you want the returned message stored. if you supply a suitable message return buffer, this function is thread safe β look at her, being responsible. πmessage_sizeβ the size in bytes of the place where the returned message is going.fildesβ the original fildes, exactly as passed to thefutimes(3)system call.tvβ the original tv, exactly as passed to thefutimes(3)system call.
π explain_message_errno_futimes π
void explain_message_errno_futimes(char *message, int message_size, int errnum, int fildes, const struct timeval *tv);
explain_message_errno_futimes gets you an explanation of an error returned by the futimes(3) system call. at minimum you're getting the value of strerror(errnum), but usually it's way more than that and it names the underlying cause in more detail. no cap. π
use it like:
if (futimes(fildes, tv) < 0)
{
int err = errno;
char message[3000];
explain_message_errno_futimes(message, sizeof(message), err, fildes, tv);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
pre-packaged as explain_futimes_or_die(3), obviously. π
messageβ the location where the returned message gets stored. supply a suitable message return buffer and this function is thread safe. π«Άmessage_sizeβ the size in bytes of the location where the returned message goes.errnumβ the error value to decode, usually taken from theerrnoglobal variable right before calling this function. this matters if you need to run any code between the system call being explained and this function, because loads of libc functions will altererrno. πfildesβ the original fildes, exactly as passed to thefutimes(3)system call.tvβ the original tv, exactly as passed to thefutimes(3)system call.
π SEE ALSO π
futimes(3)β change file timestampsexplain_futimes_or_die(3)β change file timestamps and report errors
π COPYRIGHT π
- libexplain version 1.4
- Copyright (C) 2008 Peter Miller
and that's the whole page, bestie β explain_futimes(3) from the Library Functions Manual, brought to you by libexplain version 1.4, with Copyright (C) 2008 Peter Miller holding it down at the bottom. go forth and explain your errors, you main character. ππ
π¦ 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) 2008-2011 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms