DEVICE_SET_DESC(9)
β¨ DEVICE_SET_DESC β¨
okay bestie, this is a kernel developer's manual page for DEVICE_SET_DESC(9) β yes, section 9, we're in the deep kernel lore today π«Ά
π NAME π
device_set_desc, device_set_desc_copy, device_get_desc β the trio that handles the description of a device β¨
π SYNOPSIS π
#include <sys/param.h>
#include <sys/bus.h>
void
device_set_desc(device_t dev, const char *desc);
void
device_set_desc_copy(device_t dev, const char *desc);
const char *
device_get_desc(device_t dev);
πΈ DESCRIPTION πΈ
So here's the vibe: these three functions manipulate the verbose description of a device. That's it, that's the whole job π
That description β if it's present β gets printed as part of the message when the device is attached during autoconfiguration. So it's like the device's little name tag at the party π
Now, the plot twist: device_set_desc_copy() is the variation you reach for when the string you're passing is a temporary buffer that's gonna get overwritten. In that case, the system copies the string for you. Otherwise β meaning with plain old device_set_desc() β the pointer you passed gets used directly. no copy, no safety net, just vibes (and also the responsibility of keeping that memory alive, iykyk π).
fr fr, that pointer thing is not a joke. if your buffer is temporary, use the _copy one. periodt.
π₯ SEE ALSO π₯
π AUTHORS π
This manual page was written by Doug Rabson π
and that's the whole page, bestie, you ate it π This cutie came to you from Debian, dated June 16, 1998 β yeah, this page is older than most of us and it's still iconic π¦π go forth and describe your devices, main character πβ¨
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 1998 Doug Rabson
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms