STRUCT LINEHANDLE_STATE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct linehandle_state β€” a Kernel API Manual moment πŸ’–

ok so bestie, this is the manual page for struct linehandle_state(9) and honestly? it's giving "small struct, big responsibilities." sit down, grab a strawberry πŸ“, and let's get into it.


✨ NAME ✨

struct linehandle_state β€” bestie, it literally contains the state of a userspace handle. that's the whole vibe. it's the struct that holds the receipts for a handle that userspace is holding onto πŸŽ€


🌸 SYNOPSIS 🌸

here's the shape of it, copy-pasted exactly because we do NOT freestyle struct definitions:

struct linehandle_state {
    struct gpio_device *gdev;
    const char *label;
    struct gpio_desc *descs[GPIOHANDLES_MAX];
    u32 num_descs;
};

like… four fields. four. and every single one of them matters. no filler, no fluff, main character energy only πŸ‘‘


πŸ¦‹ Members πŸ¦‹

okay let's go member by member, no cap:

  • gdev β€” the GPIO device the handle pertains to. this is the "which device are we even talking about" field, aka the anchor of the whole situation πŸ’…
  • label β€” the consumer label used to tag descriptors. it's the little name tag your descriptors wear so everyone knows who they belong to 🏷️✨
  • descs β€” the GPIO descriptors held by this handle. note that it's an array, sized GPIOHANDLES_MAX, so it can hold a whole squad of descriptors, not just one 😭
  • num_descs β€” the number of descriptors held in the descs array. because an array of GPIOHANDLES_MAX doesn't tell you how many are actually in there, and this u32 swoops in to save the day 🫢
ngl, num_descs and descs are in a committed relationship. you do not read one without the other. that's the rule. πŸ™ˆ

πŸ”₯ SEE ALSO πŸ”₯

if you're obsessed with this struct (and why wouldn't you be), the kernel file to go stare at is ./drivers/gpio/gpiolib-cdev.c β€” that's where the lore lives. then go read these besties too:

all of them, fr fr. go read them. i'll wait πŸ’œ


aaaand that's the page!! 🌈 this one came from ./drivers/gpio, landing in October 2026 β€” so like, mark your calendar bestie, that's the version and date, slay πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from