HOTPLUG(4)
π HOTPLUG(4) π
okay bestie, this one is from the Kernel Interfaces Manual and it's literally about devices hot plugging β like when your hardware just shows up or ghosts you, and Unix is like "noted π ".
β¨ NAME β¨
hotplug β devices hot plugging
like⦠the whole vibe is "device comes in, device leaves, and we're keeping receipts"
π¦ SYNOPSIS π¦
pseudo-device hotplug 1
#include <sys/types.h>
#include <sys/device.h>
#include <sys/hotplug.h>
πΈ DESCRIPTION πΈ
The hotplug pseudo-device passes device attachment and detachment events to userland. fr fr, that's its whole job. When a device attaches or detaches, the corresponding event is queued β like it's sliding into your DMs. The events can then be obtained from the queue through the read(2) call on the /dev/hotplug device file. Once an event has been read, it's deleted from the queue. periodt. The event queue has a limited size and if it's full all new events will be dropped β so yeah, it's giving "capacity issues, don't @ me" π. Each event is described with the following structure declared in the <sys/hotplug.h> header file:
struct hotplug_event {
int he_type; /* event type */
enum devclass he_devclass; /* device class */
char he_devname[16]; /* device name */
};
The he_type field describes the event type and can be either HOTPLUG_DEVAT for device attachment or HOTPLUG_DEVDT for detachment. The he_devclass field describes the device class. All device classes can be found in the <sys/device.h> header file:
enum devclass {
DV_DULL, /* generic, no special info */
DV_CPU, /* CPU (carries resource utilization) */
DV_DISK, /* disk drive (label, etc) */
DV_IFNET, /* network interface */
DV_TAPE, /* tape device */
DV_TTY /* serial line interface */
};
The he_devname is a device name including unit number, e.g. sd1.
Only one structure can be read per call. one. singular. no bundling bestie π. If there are no events in the queue, the read(2) call will block until an event appears β so it's just gonna sit there and wait, main character energy of "I'm not leaving until something happens".
π DIAGNOSTICS π
hotplug: event lost, queue fullβ New events will be dropped until all pending events have been read.
like the queue is literally full and it's turning people away at the door π«Ά
π₯ SEE ALSO π₯
read(2)hotplugd(8)
π HISTORY π
The hotplug device first appeared in OpenBSD 3.6. an icon, a legend, a moment in time β
π AUTHORS π
The hotplug driver was written by Alexander Yurchenko <grange@openbsd.org>. we stan a kernel dev π
and that's the tea, bestie π this page was brought to you by Debian, dated September 14, 2015, and filed under HOTPLUG(4) β go read some read(2) docs and slay β¨π
π¦ where this page comes from
- nixpkgs unstable: cvs-export
- Copyright (c) 2004 Alexander Yurchenko <grange@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms