explain_futimesat(3)

πŸ“¦
version 1.4.D001 Β· 2 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute

✨ explain_futimesat ✨

okay bestie, so this is a page out of the Library Functions Manual β€” a whole manual page all about explain_futimesat(3), which is literally just here to explain the errors that futimesat(2) throws at you. πŸ’…


🌸 NAME 🌸

explain_futimesat β€” explain futimesat(2) errors. that's it. that's the job. πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

#include <libexplain/futimesat.h>
const char *explain_futimesat(int fildes, const char *pathname, const struct timeval *data);
const char *explain_errno_futimesat(int errnum, int fildes, const char *pathname, const struct timeval *data);
void explain_message_futimesat(char *message, int message_size, int fildes, const char *pathname, const struct timeval *data);
void explain_message_errno_futimesat(char *message, int message_size, int errnum, int fildes, const char *pathname, const struct timeval *data);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, these functions? they're your little translators. πŸ’« you use them to get explanations for errors returned by the futimesat(2) system call. like the syscall is screaming into the void and these four are the besties who actually understand what it said. 🫢

explain_futimesat

const char *explain_futimesat(int fildes, const char *pathname, const struct timeval *data);

the explain_futimesat function is how you get an explanation of an error returned by the futimesat(2) system call. the least the message will contain is the value of strerror(errno), but usually it does so much better and points at the underlying cause in more detail. like, it ate. πŸ”₯

the errno global variable is the one that gets used to obtain the error value to be decoded.

  • fildes β€” the original fildes, exactly as passed to the futimesat(2) system call.
  • pathname β€” the original pathname, exactly as passed to the futimesat(2) system call.
  • data β€” the original data, exactly as passed to the futimesat(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. it will be overwritten by the next call to any libexplain function which shares this buffer, including other threads. so don't get attached, she's not yours. 😭

Note: this function is not thread safe, because it shares a return buffer across all threads, and many other functions in this library. periodt. 🚫🧡

Example: this function is intended to be used in a fashion similar to the following example:

if (futimesat(fildes, pathname, data) < 0)
{
    fprintf(stderr, "%s\n", explain_futimesat(fildes, pathname, data));
    exit(EXIT_FAILURE);
}

the above code example is available pre-packaged as the explain_futimesat_or_die(3) function. πŸ’

explain_errno_futimesat

const char *explain_errno_futimesat(int errnum, int fildes, const char *pathname, const struct timeval *data);

the explain_errno_futimesat function is used to obtain an explanation of an error returned by the futimesat(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. ✨

  • errnum β€” the error value to be decoded, usually obtained from the errno global 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 of errno. lowkey the most important detail here, don't skip it bestie. πŸ‘€
  • fildes β€” the original fildes, exactly as passed to the futimesat(2) system call.
  • pathname β€” the original pathname, exactly as passed to the futimesat(2) system call.
  • data β€” the original data, exactly as passed to the futimesat(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 (futimesat(fildes, pathname, data) < 0)
{
    int err = errno;
    fprintf(stderr, "%s\n", explain_errno_futimesat(err, fildes, pathname, data));
    exit(EXIT_FAILURE);
}

the above code example is available pre-packaged as the explain_futimesat_or_die(3) function. πŸŽ€

explain_message_futimesat

void explain_message_futimesat(char *message, int message_size, int fildes, const char *pathname, const struct timeval *data);

the explain_message_futimesat function is used to obtain an explanation of an error returned by the futimesat(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. yay you did it bestie 🫢
  • message_size β€” the size in bytes of the location in which to store the returned message.
  • fildes β€” the original fildes, exactly as passed to the futimesat(2) system call.
  • pathname β€” the original pathname, exactly as passed to the futimesat(2) system call.
  • data β€” the original data, exactly as passed to the futimesat(2) system call.

Example: this function is intended to be used in a fashion similar to the following example:

if (futimesat(fildes, pathname, data) < 0)
{
    char message[3000];
    explain_message_futimesat(message, sizeof(message), fildes, pathname, data);
    fprintf(stderr, "%s\n", message);
    exit(EXIT_FAILURE);
}

the above code example is available pre-packaged as the explain_futimesat_or_die(3) function. πŸ’–

explain_message_errno_futimesat

void explain_message_errno_futimesat(char *message, int message_size, int errnum, int fildes, const char *pathname, const struct timeval *data);

the explain_message_errno_futimesat function is used to obtain an explanation of an error returned by the futimesat(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. πŸ‘‘

  • 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 the errno global 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 of errno. 🧚
  • fildes β€” the original fildes, exactly as passed to the futimesat(2) system call.
  • pathname β€” the original pathname, exactly as passed to the futimesat(2) system call.
  • data β€” the original data, exactly as passed to the futimesat(2) system call.

Example: this function is intended to be used in a fashion similar to the following example:

if (futimesat(fildes, pathname, data) < 0)
{
    int err = errno;
    char message[3000];
    explain_message_errno_futimesat(message, sizeof(message), err, fildes, pathname, data);
    fprintf(stderr, "%s\n", message);
    exit(EXIT_FAILURE);
}

the above code example is available pre-packaged as the explain_futimesat_or_die(3) function. πŸ’œ


πŸ“ SEE ALSO πŸ“

  • futimesat(2) β€” change timestamps of a file relative to a directory
  • explain_futimesat_or_die(3) β€” change timestamps of a file relative to a directory and report errors

libexplain version 1.4 Copyright (C) 2013 Peter Miller


and that's a wrap bestie!! πŸŽ€ the vibe check is complete, the facts are all intact, and this page is explain_futimesat(3) from the Library Functions Manual, brought to you by libexplain version 1.4, copyright (C) 2013 Peter Miller. slay, mwah, bye!! πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from