sg_set_error(3)

πŸ“¦
version 0.92.1 Β· 2 versions
, in alpine 3.24, arch rolling, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0

✨ sg_set_error(3) ✨ β€” like, the error-setting girlies of libstatgrab, section 3 of the manual btw πŸŽ€

okay so bestie, gather round πŸ’– this whole page is about sg_set_error, sg_set_error_with_errno, sg_set_error_with_errno_code and sg_clear_error β€” the little squad that handles setting the error condition. no cap, that's the whole vibe.


🌸 SYNOPSIS 🌸

#include <statgrab.h>

sg_error sg_set_error (sg_error code, const char *arg);

sg_error sg_set_error_with_errno (sg_error code, const char *arg);

sg_error sg_set_error_with_errno_code (sg_error code, const char *arg,
                                      int errno_value);

void sg_clear_error (void);

πŸ’… DESCRIPTION πŸ’…

πŸ¦‹ sg_set_error()

this one sets the occurred error condition together with an argument, periodt. and the argument? it's usually descriptive β€” like, eg. the file name that failed to open. so everyone knows what went wrong, not just that something went wrong. iconic behavior honestly.

🫢 sg_set_error_with_errno()

same energy, but extra ✨ β€” this one sets the occurred error condition together with an argument and the value of the system libraries errno value. the argument is usually descriptive, eg. the name of the failed sysctl() call. so now you've got the code and the context, and that's the dream combo fr fr.

πŸ”₯ sg_set_error_with_errno_code()

okay this is the main character of the trio 🌈 it sets the occurred error condition together with an argument and an error value of a system library call which doesn't set the errno value (eg. the pthread_* calls πŸ‘€). the argument is usually descriptive, eg. the name of the mutex failed to get locked. yes, she's the one you call when errno is out here giving nothing.

πŸ’€ sg_clear_error()

and this one? clears the current error condition. that's it. clean slate, fresh start, we move on 🧚


⭐ SEE ALSO ⭐

  • statgrab(3) β€” go say hi, she knows things πŸ’œ

🌐 WEBSITE 🌐

⟨https://libstatgrab.org/⟩ β€” that's the link, go click it bestie πŸ¦‹


and that's the whole page!! this little gem is from libstatgrab, dated 2019-03-08 β€” stay hydrated, keep your errno close, and slay those error conditions πŸ’…πŸ’–βœ¨