explain_fpathconf(3)

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

πŸ’– explain_fpathconf πŸ’–

okay so real talk, bestie β€” this page lives in the Library Functions Manual, and it's here to explain every single error fpathconf(3) could ever throw at you. it's giving ✨emotional support documentation✨ and honestly? we're obsessed.


🌸 NAME 🌸

explain_fpathconf β€” explain fpathconf(3) errors 🫢


πŸŽ€ SYNOPSIS πŸŽ€

#include <libexplain/fpathconf.h>
const char *explain_fpathconf(int fildes, int name);
const char *explain_errno_fpathconf(int errnum, int fildes, int name);
void explain_message_fpathconf(char *message, int message_size, int
fildes, int name);
void explain_message_errno_fpathconf(char *message, int message_size,
int errnum, int fildes, int name);

πŸ¦‹ DESCRIPTION πŸ¦‹

so these functions? they're the ones you call when the fpathconf(3) system call is being dramatic and returning an error, and you want the actual explanation instead of a cryptic little number. main character energy fr fr πŸ’…

✨ explain_fpathconf ✨

const char *explain_fpathconf(int fildes, int name);

the explain_fpathconf function gets you an explanation of an error returned by the fpathconf(3) system call. the least the message will contain is the value of strerror(errno), but usually it does soooo much better and tells you the underlying cause in way more detail. no cap 🧚

the errno global variable is what it uses to grab the error value that needs decoding.

this function is meant to be used kinda like this:

if (fpathconf(fildes, name) < 0)
{
    fprintf(stderr, "%s\n", explain_fpathconf(fildes, name));
    exit(EXIT_FAILURE);
}

that code example above? it's available pre‐packaged as the explain_fpathconf_or_die(3) function. convenient king πŸ‘‘

  • fildes β€” the original fildes, exactly as passed to the fpathconf(3) system call.
  • name β€” the original name, exactly as passed to the fpathconf(3) system call.

Returns:

the message explaining the error. heads up tho β€” this message buffer is shared by all libexplain functions that don't supply a buffer in their argument list. it gets overwritten by the next call to any libexplain function sharing this buffer, including from other threads. 😭

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. pls be careful bestie πŸ™ˆ

✨ explain_errno_fpathconf ✨

const char *explain_errno_fpathconf(int errnum, int fildes, int name);

the explain_errno_fpathconf function gets you an explanation of an error returned by the fpathconf(3) system call. the least the message will contain is the value of strerror(errnum), but usually it does much better and points out the underlying cause in more detail. periodt πŸ’…

this function is meant to be used kinda like this:

if (fpathconf(fildes, name) < 0)
{
    int err = errno;
    fprintf(stderr, "%s\n", explain_errno_fpathconf(err, fildes, name));
    exit(EXIT_FAILURE);
}

that code example above is available pre‐packaged as the explain_fpathconf_or_die(3) function. ✨

  • errnum β€” the error value to be decoded, usually grabbed from the errno global variable right before this function is called. this matters if you need to run any code between the system call being explained and this function, because many libc functions will alter the value of errno. so like, save it first, okay?
  • fildes β€” the original fildes, exactly as passed to the fpathconf(3) system call.
  • name β€” the original name, exactly as passed to the fpathconf(3) system call.

Returns:

the message explaining the error. same tea as before β€” this message buffer is shared by all libexplain functions that don't supply a buffer in their argument list. it'll 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 too. 🫠

✨ explain_message_fpathconf ✨

void explain_message_fpathconf(char *message, int message_size, int
fildes, int name);

the explain_message_fpathconf function may be used to obtain an explanation of an error returned by the fpathconf(3) system call. 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 it uses to obtain the error value to be decoded.

this function is meant to be used kinda like this:

if (fpathconf(fildes, name) < 0)
{
    char message[3000];
    explain_message_fpathconf(message, sizeof(message), fildes, name);
    fprintf(stderr, "%s\n", message);
    exit(EXIT_FAILURE);
}

that code example above is available pre‐packaged as the explain_fpathconf_or_die(3) function. πŸŽ€

  • message β€” the location in which to store the returned message. if you supply a suitable message return buffer, this function is thread safe. slay!
  • 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 fpathconf(3) system call.
  • name β€” the original name, exactly as passed to the fpathconf(3) system call.

✨ explain_message_errno_fpathconf ✨

void explain_message_errno_fpathconf(char *message, int message_size,
int errnum, int fildes, int name);

the explain_message_errno_fpathconf function may be used to obtain an explanation of an error returned by the fpathconf(3) system call. the least the message will contain is the value of strerror(errnum), but usually it does much better and indicates the underlying cause in more detail. iykyk πŸ’œ

this function is meant to be used kinda like this:

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

that code example above is available pre‐packaged as the explain_fpathconf_or_die(3) function. ⭐

  • message β€” the location in which to store the returned message. if you supply a suitable message return buffer, this function is thread safe. iconic.
  • message_size β€” the size in bytes of the location in which to store the returned message.
  • errnum β€” the error value to be decoded, usually grabbed from the errno global variable right 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. fr fr, snapshot that errno first πŸ“Έ
  • fildes β€” the original fildes, exactly as passed to the fpathconf(3) system call.
  • name β€” the original name, exactly as passed to the fpathconf(3) system call.

πŸ‘‘ SEE ALSO πŸ‘‘


okay so the legal bit, but make it cute:

  • libexplain version 1.4
  • Copyright (C) 2008 Peter Miller

and that's the whole page bestie!! πŸ¦‹ this was explain_fpathconf(3) from the Library Functions Manual, brought to you by libexplain version 1.4, copyright Peter Miller, 2008 β€” go forth and explain your errors, you absolute legend πŸŒŸπŸ’–

πŸ“¦ where this page comes from