IO::So...eneric(3pm)
β¨ NAME β¨
IO::Socket::Netlink::Generic β bestie, it's an object interface to NETLINK_GENERIC netlink protocol sockets π¦
πΈ SYNOPSIS πΈ
use IO::Socket::Netlink::Generic;
my $genlsock = IO::Socket::Netlink::Generic->new or die "socket: $!";
printf "TASKSTATS family ID is %d\n",
$genlsock->get_family_by_name( "TASKSTATS" )->{id};
okay so you literally just make the socket and then go ask the kernel what's good π
π DESCRIPTION π
So this is a subclass of IO::Socket::Netlink, and it implements the NETLINK_GENERIC protocol. Slay. And the whole vibe is that it's meant to be a base class for specific generic families to extend β like it's the main character and everyone else is the supporting cast π«Ά
π CLASS METHODS π
register_family_name
$class->register_family_name( $name )
A subclass that's implementing some particular protocol family must call this to declare its family name. Then the very first time a socket in that class gets constructed, this name gets looked up into an ID number. no cap π
π METHODS π
get_family_by_name
$family = $sock->get_family_by_name( $name )
get_family_by_id
$family = $sock->get_family_by_id( $id )
These two go query the kernel for info on the NETLINK_GENERIC family you specified β by name or by ID number, your choice, pick your fighter β and hand you back the deets. It returns a HASH reference with these fields:
id => NUMBERname => STRINGversion => NUMBERhdrsize => NUMBERmaxattr => NUMBER
(also lowkey note: the original spells it "specifed", but I'm not gonna fix that, I'm just gonna love it as it is π)
π§ MESSAGE OBJECTS π§
Sockets in this class hook you up with these extra field accessors on their message objects, obsessed:
$message->cmdβ the ID number of the command you're giving to the family$message->versionβ the version number of the interface$message->genlmsgβ accessor for the trailing data buffer; it's intended for subclasses to use π
π SEE ALSO π
- Socket::Netlink::Generic β interface to Linux's
NETLINK_GENERICnetlink socket protocol - IO::Socket::Netlink β Object interface to
AF_NETLINKdomain sockets
π AUTHOR π
Paul Evans <leonerd@leonerd.org.uk> β an icon, fr fr π«Ά
and that's the whole page bestie, we ate and left no crumbs π
this was IO::So...eneric(3pm) from the User Contributed Perl Documentation, perl v5.42.0, dated 2025-07-25 β periodt β¨ππ¦
π¦ where this page comes from
- fedora 43: perl-Socket-Netlink 0.05-32.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms