explain_linkat_or_die(3)

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

πŸ’– explain_linkat_or_die β€” bestie edition πŸ’–

okay so you're deep in the explain_linkat_or_die(3) page of the Library Functions Manual and you need the tea. sit down, hydrate, let's go 🫢


✨ NAME ✨

explain_linkat_or_die β€” link a file relative to directory and report errors. that's the whole vibe, no cap πŸ’…


🌸 SYNOPSIS 🌸

#include <libexplain/linkat.h>
void explain_linkat_or_die(int old_dirfd, const char *old_path, int
       new_fildes, const char *new_path, int flags);
int explain_linkat_on_error(int old_dirfd, const char *old_path, int
       new_fildes, const char *new_path, int flags);

like. two functions. both iconic. that's the whole thing πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

so explain_linkat_or_die is the function you call when you wanna call the linkat(2) system call. but here's the twist β€” if it fails, an explanation gets printed to stderr (pulled straight from the explain_linkat(3) function, slay) and then the process terminates by calling exit(EXIT_FAILURE). it's giving "we don't do partial failure here." dramatic? maybe. effective? absolutely. πŸ’€

and then explain_linkat_on_error is its chill sibling β€” also calls the linkat(2) system call, also prints that explanation to stderr from explain_linkat(3) on failure, BUT it still returns to the caller. no exit. no drama. just vibes and a return value. 🌈

now the arguments, bestie, all five of them:

  • old_dirfd β€” the old_dirfd, exactly as to be passed to the linkat(2) system call. no notes, pass it through 🫢
  • old_path β€” the old_path, exactly as to be passed to the linkat(2) system call. same energy ✨
  • new_fildes β€” the new_fildes, exactly as to be passed to the linkat(2) system call. yes it's spelled that way, yes it's the parameter name, we don't question it πŸ’…
  • new_path β€” the new_path, exactly as to be passed to the linkat(2) system call. you know the drill 🌸
  • flags β€” the flags, exactly as to be passed to the linkat(2) system call. all of it. unchanged. periodt πŸ‘‘

πŸ’œ RETURN VALUE πŸ’œ

explain_linkat_or_die only returns on success β€” check linkat(2) for more info on that. on failure it prints an explanation and exits, so like. it does not return. it's gone. it left the chat. 😭

explain_linkat_on_error always returns the value returned by the wrapped linkat(2) system call. every single time. reliable queen πŸ’–


⭐ EXAMPLE ⭐

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

explain_linkat_or_die(old_dirfd, old_path, new_fildes, new_path, flags);

that's it. that's the example. clean, simple, ate πŸ”₯


🧚 SEE ALSO 🧚

go read them, iykyk πŸ“š


libexplain version 1.4 Copyright (C) 2013 Peter Miller


and that's the whole page, bestie 🫢 this little love letter to explain_linkat_or_die(3) came to you courtesy of libexplain version 1.4, Β© 2013 Peter Miller β€” go forth, link your files relative to directory file descriptors, and may your stderr always be explanatory βœ¨πŸ’–πŸŒΈ

πŸ“¦ where this page comes from