DEVTONAME(9)

πŸ’– DEVTONAME β€” the kernel devs' manual, but make it cute πŸ’–

okay bestie, welcome to DEVTONAME(9), aka the Kernel Developer's Manual page for one lil function that does exactly one lil thing and does it flawlessly. no cap. it's giving "small but mighty." πŸŽ€


✨ NAME ✨

devtoname β€” converts a character device into a string that tells you the device name πŸ¦‹

like. that's the whole job. and she ate. πŸ’…


🌸 SYNOPSIS 🌸

okay so first you gotta bring in the girls:

#include <sys/param.h>
#include <sys/conf.h>

then, the moment you've been waiting for:

const char *
devtoname(struct cdev *dev);

that's it. that's the whole signature. iconic. πŸ‘‘


πŸ’œ DESCRIPTION πŸ’œ

so the devtoname() function hands you back a pointer to the name of the device you passed in. 🫢

and what is that name, you ask? it's whatever was set to it in make_dev(). that's it. no mystery, no plot twist, no secret second source. whatever make_dev() named it is what you're getting back. periodt. ✨

lowkey important vibe check: the function gives you a pointer to the name β€” it doesn't make you a fresh copy or anything. just so you know what you're holding. πŸ™ˆ

🌈 HISTORY 🌈

the devtoname() interface first appeared in FreeBSD 4.0 πŸ’– she's been here since forever and she's still serving. a true main character. 🌟


and that's the whole page, bestie!! πŸŽ€ ty for reading, ily, go name some devices πŸ’–

this cutie was brought to you by the Debian crew, dated February 10, 2012 β€” stan them, fr fr 🫢✨

πŸ“¦ where this page comes from