semanage_list(3)

πŸ“¦
version 3.11 Β· 2 versions
, in centos-stream 10, debian trixie, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– semanage_list β€” SELinux Lists Management API πŸ’–

okay bestie, welcome to semanage_list(3) from the SELinux management API docs 🫢 this one's a lil function family, not a single function, so buckle up.


✨ SYNOPSIS ✨

so here's the thing: this one list function works for any SELinux management record. you just swap in whatever function name and object name you actually need β€” LIST_FUNCTION and OBJECT are literally placeholders, like a lil outfit you dress up per record πŸ‘—

extern int LIST_FUNCTION (
     semanage_handle_t *handle,
     semanage_OBJECT_t ***objects,
     unsigned int* count);

🌸 DESCRIPTION 🌸

πŸ’… Behavior

the list function hands you back an array containing every single object chillin' in the location you picked. all of them. the whole squad. no cap. ✨

πŸŽ€ Parameters

  • handle β€” this is your state-tracking bestie. it keeps persistent state alive across all your semanage calls and it's also where error reporting lives. lowkey the most important girlypop in the room.
  • objects β€” the function is gonna allocate the array of objects and fill it up, then stash it at the location that objects points to. so you pass the address-of-the-pointer, it does the rest πŸͺ„
  • count β€” it writes the number of objects right there at the location count points to. so you know exactly how many you got.
🚨 IMPORTANT BESTIE 🚨 the array and every single object inside it become the property of the caller. that's you. you own them now. each object must be freed with semanage_OBJECT_free. don't ghost them, free them πŸ’€

πŸ¦‹ Requirements

this function needs a semanage connection to already be established β€” go peek at semanage_connect(3) if you haven't set that up yet. no connection, no vibes, no list. periodt.


⭐ RETURN VALUE ⭐

if it flops, you get -1 back, and the semanage error callback gets invoked to tell you what went wrong. read it, it's giving helpful.

otherwise you get a non-negative integer β€” that's a commit number πŸ‘‘ and here's the cute part: every other semanage object read call will return that exact same number until the next commit happens. consistent queen behavior, we love to see it πŸ’œ


🌈 SEE ALSO 🌈

  • semanage_handle_create(3)
  • semanage_connect(3)

that's the whole page bestie, you ate it πŸ’… this lil gem came from ivg2@cornell.edu and it's dated 16 March 2006 β€” yes it's vintage, yes it still slays πŸŽ€βœ¨πŸ¦‹