IO::So...eneric(3pm)

πŸ“¦
version 0.05 Β· 2 versions
, in fedora 43

✨ 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 => NUMBER
  • name => STRING
  • version => NUMBER
  • hdrsize => NUMBER
  • maxattr => 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_GENERIC netlink socket protocol
  • IO::Socket::Netlink β€” Object interface to AF_NETLINK domain 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