explain_utimensat(3)
π explain_utimensat β a libexplain page, but make it make sense π
okay so bestie, you know how utimensat(2) just goes "nope" and hands you an errno like it's a cryptic text with no context? yeah. this is the page about the girlies who translate that into actual human words. it lives in the Library Functions Manual section, and it's giving "error decoder, but make it cute." π¦
β¨ NAME β¨
explain_utimensat β the way we explain utimensat(2) errors, no cap. π
πΈ SYNOPSIS πΈ
#include <libexplain/utimensat.h>
const char *explain_utimensat(int fildes, const char *pathname, const
struct timespec *data, int flags);
const char *explain_errno_utimensat(int errnum, int fildes, const char
*pathname, const struct timespec *data, int flags);
void explain_message_utimensat(char *message, int message_size, int
fildes, const char *pathname, const struct timespec *data, int flags);
void explain_message_errno_utimensat(char *message, int message_size,
int errnum, int fildes, const char *pathname, const struct timespec
*data, int flags);
four whole functions. it's a little squad. π«Ά
π DESCRIPTION π
so these functions? they exist to hand you explanations for errors returned by the utimensat(2) system call. that's the whole vibe. periodt. β¨
π explain_utimensat
const char *explain_utimensat(int fildes, const char *pathname, const
struct timespec *data, int flags);
explain_utimensat is your girl for getting an explanation of an error returned by the utimensat(2) system call. the absolute bare minimum you'll get back is the value of strerror(errno), but usually it does much better and tells you the underlying cause in more detail. it's giving overachiever and we love that for it. π
the errno global variable is what gets used to obtain the error value to be decoded.
fildesβ the originalfildes, exactly as passed to theutimensat(2)system call. literally character for character, bestie, we don't editorialize.pathnameβ the originalpathname, exactly as passed to theutimensat(2)system call.dataβ the originaldata, exactly as passed to theutimensat(2)system call.flagsβ the originalflags, exactly as passed to theutimensat(2)system call.
Returns: the message explaining the error. β οΈ this message buffer is shared by all libexplain functions which 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. yes, really.
Note: this function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. it's giving "communal bathroom, one sink, no lock." π
Example: this function is intended to be used in a fashion similar to the following example:
if (utimensat(fildes, pathname, data, flags) < 0)
{
fprintf(stderr, "%s\n", explain_utimensat(fildes, pathname,
data, flags));
exit(EXIT_FAILURE);
}
the above code example is available pre-packaged as the explain_utimensat_or_die(3) function. so like, you don't even have to write it yourself. iconic behavior. π
π¦ explain_errno_utimensat
const char *explain_errno_utimensat(int errnum, int fildes, const char
*pathname, const struct timespec *data, int flags);
explain_errno_utimensat is used to obtain an explanation of an error returned by the utimensat(2) system call. the least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. same energy, different entry point. β¨
errnumβ the error value to be decoded, usually obtained from theerrnoglobal variable just before this function is called. this is necessary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value oferrno. so like, grab it before anything else touches it. fr fr. πfildesβ the originalfildes, exactly as passed to theutimensat(2)system call.pathnameβ the originalpathname, exactly as passed to theutimensat(2)system call.dataβ the originaldata, exactly as passed to theutimensat(2)system call.flagsβ the originalflags, exactly as passed to theutimensat(2)system call.
Returns: the message explaining the error. β οΈ this message buffer is shared by all libexplain functions which do not supply a buffer in their argument list. this will be overwritten by the next call to any libexplain function which 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.
Example: this function is intended to be used in a fashion similar to the following example:
if (utimensat(fildes, pathname, data, flags) < 0)
{
int err = errno;
fprintf(stderr, "%s\n", explain_errno_utimensat(err, fildes,
pathname, data, flags));
exit(EXIT_FAILURE);
}
the above code example is available pre-packaged as the explain_utimensat_or_die(3) function. π«Ά
π explain_message_utimensat
void explain_message_utimensat(char *message, int message_size, int
fildes, const char *pathname, const struct timespec *data, int flags);
explain_message_utimensat is used to obtain an explanation of an error returned by the utimensat(2) system call. the least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. π
the errno global variable will be used to obtain the error value to be decoded.
messageβ the location in which to store the returned message. if a suitable message return buffer is supplied, this function is thread safe. look at her, all responsible. πmessage_sizeβ the size in bytes of the location in which to store the returned message.fildesβ the originalfildes, exactly as passed to theutimensat(2)system call.pathnameβ the originalpathname, exactly as passed to theutimensat(2)system call.dataβ the originaldata, exactly as passed to theutimensat(2)system call.flagsβ the originalflags, exactly as passed to theutimensat(2)system call.
Example: this function is intended to be used in a fashion similar to the following example:
if (utimensat(fildes, pathname, data, flags) < 0)
{
char message[3000];
explain_message_utimensat(message, sizeof(message), fildes,
pathname, data, flags);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
the above code example is available pre-packaged as the explain_utimensat_or_die(3) function. π
π§ explain_message_errno_utimensat
void explain_message_errno_utimensat(char *message, int message_size,
int errnum, int fildes, const char *pathname, const struct timespec
*data, int flags);
explain_message_errno_utimensat is used to obtain an explanation of an error returned by the utimensat(2) system call. the least the message will contain is the value of strerror(errno), but usually it will do much better, and indicate the underlying cause in more detail. the final boss form, honestly. π₯
messageβ the location in which to store the returned message. if a suitable message return buffer is supplied, this function is thread safe.message_sizeβ the size in bytes of the location in which to store the returned message.errnumβ the error value to be decoded, usually obtained from theerrnoglobal variable just before this function is called. this is necessary if you need to call any code between the system call to be explained and this function, because many libc functions will alter the value oferrno.fildesβ the originalfildes, exactly as passed to theutimensat(2)system call.pathnameβ the originalpathname, exactly as passed to theutimensat(2)system call.dataβ the originaldata, exactly as passed to theutimensat(2)system call.flagsβ the originalflags, exactly as passed to theutimensat(2)system call.
Example: this function is intended to be used in a fashion similar to the following example:
if (utimensat(fildes, pathname, data, flags) < 0)
{
int err = errno;
char message[3000];
explain_message_errno_utimensat(message, sizeof(message),
err, fildes, pathname, data, flags);
fprintf(stderr, "%s\n", message);
exit(EXIT_FAILURE);
}
the above code example is available pre-packaged as the explain_utimensat_or_die(3) function. π
π SEE ALSO π
utimensat(2)β change file timestamps with nanosecond precision βexplain_utimensat_or_die(3)β change file timestamps with nanosecond precision and report errors πΈ
like, go read those too. iykyk. π
π COPYRIGHT π
libexplain version 1.4 Copyright (C) 2012 Peter Miller
and that's the whole page, bestie!! π«Ά shoutout to libexplain version 1.4, and to Peter Miller for the copyright situation, dated 2012. this was explain_utimensat(3) from the Library Functions Manual β go forth and decode your errnos like the main character you are. mwah. πβ¨π¦
π¦ 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) 2012 Peter Miller
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms