semanage_query(3)
β¨ semanage_query(3) β¨
okay bestie, so this is a page from the Libsemanage API documentation and it's all about semanage_query, the little function that goes and finds you a semanage record. it's giving "where is my stuff" energy and honestly? iconic. π
πΈ NAME πΈ
semanage_query β SELinux Management API. yes that's the whole name section, she's brief and she knows it π
π¦ SYNOPSIS π¦
so here's the tea: the query function below works for any semanage record. you just swap out the function name and the object name to match whatever you're querying, okurrr? π«Ά
extern int QUERY_FUNCTION (
semanage_handle_t *handle,
const semanage_OBJECT_key_t *key,
semanage_OBJECT_t **response);
π DESCRIPTION π
π₯ Behavior
lowkey the rules are simple:
- the query function will fail if a matching key is not found β no key, no vibes, no record π
- otherwise, the corresponding object gets returned to you. slay. β¨
π Parameters
let's break down who's who in this little friend group:
- the
handleβ this one tracks persistent state across all your semanage calls, and it's also the one that reports errors. main character energy fr fr. π - the
keyβ identifies the object you're querying. the matching object gets stored in the address pointed to byresponse. and here's the important part: the key is a property of the caller, so it will not be stored or modified internally. it's just visiting, not moving in. π - the object returned β that becomes a property of the caller too, which means you have to free it with
semanage_OBJECT_free. don't forget bestie, that's a memory leak waiting to happen π
β Requirements
this function needs an semanage connection to already be established β go check semanage_connect(3) if you haven't done that yet. no connection, no query, periodt. π
π RETURN VALUE π
- if it fails,
-1is returned and the semanage error callback gets invoked to describe what went wrong. rude but informative. π - otherwise you get a non-negative integer back β and that's a commit number. the same number will be returned by all the other semanage object read calls until the next commit. consistent queen. β¨
π SEE ALSO π
semanage_handle_create(3)semanage_connect(3)
and that's the whole page, bestie!! π§ written by ivg2@cornell.edu on 15 March 2006 β yes she's been serving this documentation since 2006 and she still ate. ππΈπ
π¦ where this page comes from
- centos-stream 10: libsemanage-devel 3.11-3.el10 Β· LGPL-2.1-or-later
- debian trixie: libsemanage-dev 3.8.1-1 Β· LGPL-2.1-or-later
- fedora 43: libsemanage-devel 3.9-4.fc43 Β· LGPL-2.1-or-later
- fedora 43: libsemanage-devel 3.9-4.fc43 Β· LGPL-2.1-or-later
- fedora 44: libsemanage-devel 3.10-1.fc44 Β· LGPL-2.1-or-later
- fedora 44: libsemanage-devel 3.10-1.fc44 Β· LGPL-2.1-or-later
- fedora 44: libsemanage-devel 3.11-1.fc44 Β· LGPL-2.1-or-later
- fedora 44: libsemanage-devel 3.11-1.fc44 Β· LGPL-2.1-or-later
- nixos 26.05: libsemanage 3.10
- nixpkgs unstable: libsemanage 3.11
- opensuse-leap 16.0: libsemanage-devel 3.8.1-160000.3.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libsemanage-devel 3.8.1-160000.3.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libsemanage-devel 3.8.1-160000.3.1 Β· LGPL-2.1-or-later
- opensuse-leap 16.0: libsemanage-devel 3.8.1-160000.3.1 Β· LGPL-2.1-or-later
- ubuntu questing: libsemanage-dev 3.8.1-1
- ubuntu resolute: libsemanage-dev 3.9-1build1 Β· LGPL-2.1-or-later
- ubuntu stonking: libsemanage-dev 3.11-1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms