NG_DEVICE(4)
π NG_DEVICE π
okay bestie, welcome to the manual page for ng_device β that's the device netgraph node type, from the Kernel Interfaces Manual section 4. sit down, grab a boba, we're gonna get you fluent in this fr fr π§β¨
β¨ NAME β¨
ng_device β the device netgraph node type π
πΈ SYNOPSIS πΈ
#include <netgraph/ng_device.h>
π¦ DESCRIPTION π¦
So a device node is literally two things at once, no cap: it's a netgraph node and a system device interface. main character energy honestly π
The way that when a device node gets created, a whole new device entry just appears β and you can reach it with all your regular file operators like open(2), close(2), read(2), write(2), etc. iconic behaviour, we love to see it π
And the naming? Obsessed. The first node shows up as /dev/ngd0, and then every subsequent one is /dev/ngd1, /dev/ngd2, etc. β just counting up forever like a little queue of cuties π
π«Ά HOOKS π«Ά
A device node has a single hook, and you can give it any arbitrary name you want. Slay, freedom of expression π
Here's the tea on the data flow:
- everything coming in over the hook gets presented to the device for
read(2)π₯ - everything coming in from the device entry via
write(2)gets forwarded to the hook π€
it's giving two-way street, it's giving communication, it's giving π¦
π₯ CONTROL MESSAGES π₯
This node supports exactly one non-generic control message, and here she is:
NGM_DEVICE_GET_DEVNAMEβ returns the device name that corresponds to a node β¨
π SHUTDOWN π
This node shuts down when:
- it receives a
NGM_SHUTDOWNcontrol message, or - the hook gets disconnected π
And when that happens, the associated device entry is removed and becomes available for use by future device nodes. recycling queen β»οΈβ¨
π SEE ALSO π
π HISTORY π
The device node type was first implemented in FreeBSD 5.0. a legend was born, periodt π
π AUTHORS π
- Mark Santcroos
<marks@ripe.net> - Gleb Smirnoff
<glebius@FreeBSD.org>
and that's the whole page bestie!! this one's from the Debian crew, dated October 19, 2004, and it's page NG_DEVICE(4) in section 4 β go forth and netgraph responsibly, ily, mwah ππ¦πΈ
π¦ 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) 2002 Mark Santcroos <marks@ripe.net>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms