explain_fi...rom_fildes(3)

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

🌸 explain_fi...rom_fildes(3) 🌸

okay bestie, welcome to the Library Functions Manual entry for explain_fi...rom_fildes(3) β€” yes the name is doing a little dramatic ellipsis thing, we love a mysterious queen πŸ’…


✨ NAME ✨

explain_filename_from_fildes β€” bestie, this one snatches the filename straight out of a file descriptor πŸŽ€


✨ SYNOPSIS ✨

#include <libexplain/filename.h>
int explain_filename_from_fildes(int fildes, char *data, size_t
data_size);
int explain_filename_from_stream(FILE *stream, char *data, size_t
data_size);

✨ DESCRIPTION ✨

so basically πŸ’– the explain_filename_from_fildes function is your girl for getting the name of the file that's associated with a file descriptor. she's giving "who even are you, fd?" energy and honestly, iconic.

and then explain_filename_from_stream does the exact same thing but for a file stream instead of a file descriptor. same vibe, different entry point, slay 🌈

the filename gets dropped into the array that data points to. and listen β€” the filename is always NUL terminated, no cap. but here's the tea πŸ“: if the returned filename is longer than data_size, it will be silently truncated. like, no warning, no drama, it just gets cut. so a size of at least (PATH_MAX + 1) is suggested β€” take the advice bestie, don't get caught slipping.

on success? returns zero ✨. but if the file name cannot be determined, it returns -1 β€” and does not set errno. that's right, no errno for you. it's mysterious like that πŸ’€


libexplain version 1.4 Copyright (C) 2012 Peter Miller


✨ AUTHOR ✨

Written by Peter Miller <pmiller@opensource.org.au> πŸ‘‘


and that's the whole page, bestie 🫢 if you made it this far you officially have main character energy. this was explain_fi...rom_fildes(3) from the Library Functions Manual, coming to you courtesy of libexplain version 1.4, copyright (C) 2012 Peter Miller. mwah πŸ’– periodt.

πŸ“¦ where this page comes from