explain_readlink_or_die(3)

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

okay so bestie, this one lives in the Library Functions Manual (that's the libexplain crew, they're literally the "explain what went wrong" girlies and we love them for it) 🫢


✨ NAME ✨

explain_readlink_or_die β€” read value of a symbolic link and report errors 🌸


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <libexplain/readlink.h>
ssize_t explain_readlink_or_die(const char *pathname, char *data, size_t
data_size);
ssize_t explain_readlink_on_error(const char *pathname, char *data,
size_t data_size))

(yes bestie, that trailing )) in the second one is exactly how it's written, we do not touch the sacred text πŸ’…)


πŸ‘‘ DESCRIPTION πŸ‘‘

so there's two of them and they're sisters, ok?

The explain_readlink_or_die function is used to call the readlink(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_readlink(3) function, and then the process terminates by calling exit(EXIT_FAILURE). like, it does not play, it just ends the whole show 😭 iconic behaviour honestly.

The explain_readlink_on_error function is used to call the readlink(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_readlink(3) function, but still returns to the caller. she's the chill one. she tells you what happened and then lets you keep going 🧚

here's the args, and listen, they're all passed exactly as-is:

  • pathname β€” The pathname, exactly as to be passed to the readlink(2) system call. no vibes-based editing, no extra slashes, just hand it over πŸ’–
  • data β€” The data, exactly as to be passed to the readlink(2) system call. same deal, girl.
  • data_size β€” The data_size, exactly as to be passed to the readlink(2) system call. yeah. also same deal ✨

🌈 RETURN VALUE 🌈

The explain_readlink_or_die function only returns on success, see readlink(2) for more information. On failure, prints an explanation and exits, it does not return. like, she leaves the group chat and never comes back πŸ’€

The explain_readlink_on_error function always returns the value return by the wrapped readlink(2) system call. always. every single time. no surprises, that's her whole thing πŸŽ€


πŸ“ EXAMPLE πŸ“

The explain_readlink_or_die function is intended to be used in a fashion similar to the following example:

ssize_t result = explain_readlink_or_die(pathname, data, data_size);

look at her. one line. doing the absolute most. slay πŸ”₯


πŸ’œ SEE ALSO πŸ’œ


libexplain version 1.4 Copyright (C) 2009 Peter Miller

and that's the whole page bestie, no cap, every single flag and fact accounted for 🫢 this manual page came to you from libexplain version 1.4, Copyright (C) 2009 Peter Miller β€” go read a symlink, you main character you πŸ‘‘βœ¨πŸ’–

πŸ“¦ where this page comes from