FEATURE_PRESENT(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’… FEATURE_PRESENT(3) β€” like, the manual manual, bestie

okay so real talk: this is a page from the Library Functions Manual, and honestly? it's giving "short but iconic." let's get into it πŸŽ€


✨ NAME ✨

feature_present β€” query presence of a kernel feature πŸ‘‘

like, it asks the kernel "hey bestie, do you have this?" and the kernel answers. that's the whole vibe check.


πŸ¦‹ LIBRARY πŸ¦‹

Standard C Library (libc, -lc) β€” yeah, the classic one. not some random third-party thing, we're in main character territory here.


🌸 SYNOPSIS 🌸

#include <unistd.h>

int
feature_present(const char *feature);

literally just include the header, and boom πŸ’₯ β€” feature_present is right there waiting for you. it takes one const char * called feature and hands you back an int. no cap.


πŸ’– DESCRIPTION πŸ’–

okay so the feature_present() function is literally the way for your application to figure out whether a specific kernel feature is present in the currently running kernel. like, the one that's running right now, no guessing, no vibes-only.

the feature argument specifies the name of the feature to check 🫢 that's it, that's the assignment.

the feature_present() function will return 1 if the specified feature is present β€” slay β€” otherwise it will return 0. and hmm, important one: if the feature_present() function is not able to determine the presence of feature due to an internal error, it will return 0 too 😭 so like, "nope" and "idk, something broke" both look the same from the outside. that's the lore, i don't make the rules.


πŸŽ€ RETURN VALUES πŸŽ€

  • if feature is present β†’ 1 is returned ✨
  • otherwise β†’ 0 is returned

periodt. that's the whole return protocol, no notes πŸ’…


🌈 SEE ALSO 🌈

go read those too, iykyk πŸ“š


🧚 HISTORY 🧚

the feature_present() function first appeared in FreeBSD 8.0. a legend from day one, fr fr ⭐


quick reminder bestie: internal error β†’ 0. don't read that as a confident "nope," okay? πŸ™ˆ

and that's the page! this little gem came to you courtesy of Debian, dated January 8, 2008 β€” yeah, it's been iconic since '08 πŸ’œ mwah, go forth and feature-check responsibly 🫢

πŸ“¦ where this page comes from