NULLOP(9)

πŸ“¦ version 11.0, in nixpkgs unstable

πŸ’… NULLOP(9) β€” like, the kernel's built-in do nothing squad

okay bestie so this is a Kernel Developer's Manual page, section 9, and it's literally about functions that do absolutely nothing (or fail on purpose). no cap, that's the whole vibe. πŸŽ€


✨ NAME ✨

nullop β€” dummy functions 🫢

🌸 SYNOPSIS 🌸

#include <sys/systm.h>

int
nullop(void *v);

void
voidop(void);

int
enodev(void);

int
enxio(void);

int
enoioctl(void);

int
enosys(void);

int
eopnotsupp(void);

πŸ¦‹ DESCRIPTION πŸ¦‹

k so, nullop() is the original "null operation" β€” a generic one. it always returns the value 0. that's it. that's the whole job. iconic honestly. ✨

voidop() takes no arguments and does nothing. queen of minding her own business πŸ’…

and then we have the fail squad β€” enodev(), enxio(), enoioctl(), enosys(), and eopnotsupp(). these always fail, and they return ENODEV, ENXIO, ENOTTY, ENOSYS, and EOPNOTSUPP, respectively. yes, in that exact order, don't mix them up bestie 😭

ngl the mapping is the whole point: enoioctl() hands back ENOTTY (not ENOIOCTL, which isn't a thing), so keep your eyes on that one πŸ™ˆ

πŸ”₯ EXAMPLES πŸ”₯

here's a case where nullop() genuinely comes in clutch:

uint64_t xc;

...

xc = xc_broadcast(0, (xcfunc_t)nullop, NULL, NULL);
xc_wait(xc);

like, you need a function pointer and you've got nothing to actually do? boom. nullop. main character energy πŸ‘‘


πŸ’– that's the whole page babes πŸ’– this is from the Debian edition, dated July 25, 2010 β€” vintage, honestly. go forth and return 0 πŸ§šβ€β™€οΈπŸŒΈ

πŸ“¦ where this page comes from