label_cmp(9)
π label_cmp(9) β yes bestie, we're in the Kernel API Manual for this one
Okay so picture this: you're deep in the kernel, you've got a bunch of labels, and you need to know which one comes first. That's the whole gig. label_cmp is literally the label comparison for set ordering β it's the function that tells the sorting gods how to line aa_label structs up. β¨
πΈ NAME πΈ
label_cmp β label comparison for set ordering
Like, that's it. That's the function. It compares labels so sets can be ordered. No cap. π
π¦ SYNOPSIS π¦
int label_cmp (const struct aa_label *a , const struct aa_label *b );
π ARGUMENTS π
aβ label to compare. NOT NULL, bestie, I'm serious. Do not passNULLhere, that's not the vibe. πbβ the other label to compare. Also NOT NULL. Both of them. Non-negotiable. π
β RETURN β
The return value is giving comparison-function classic:
<0ifa<b==0ifa==b>0ifa>b
So basically the standard three-state thing β negative, zero, positive. Iconic behaviour, zero surprises. π
π₯ SEE ALSO π₯
Okay this list is long long, so buckle up, we're going on a tour of AppArmor label internals. π
- Kernel file
./security/apparmor/label.c ns_cmp(9)profile_cmp(9)vec_cmp(9)aa_vec_unique(9)aa_label_alloc(9)__aa_label_next_not_in_set(9)aa_label_is_subset(9)aa_label_is_unconfined_subset(9)__label_remove(9)__label_replace(9)__label_insert(9)__vec_find(9)__label_find(9)aa_label_remove(9)aa_label_replace(9)vec_find(9)aa_label_insert(9)aa_label_next_in_merge(9)label_merge_cmp(9)label_merge_insert(9)labelset_of_merge(9)__label_find_merge(9)aa_label_find_merge(9)aa_label_merge(9)label_compound_match(9)label_components_match(9)aa_label_match(9)aa_update_label_name(9)aa_profile_snxprint(9)aa_label_snxprint(9)aa_label_asxprint(9)aa_label_acntsxprint(9)aa_label_strn_parse(9)aa_labelset_destroy(9)__label_update(9)__labelset_update(9)__aa_labelset_update_subtree(9)
That's the whole squad, fr fr. π«Ά
Friendly reminder from your girl:aandbare both NOT NULL. PassingNULLis not a slay, it's a crash waiting to happen. π
β¨ mwah, that's the page β¨ this little number lives in ./security/apparmor and it's dated October 2026 β so go forth, compare those labels, and stay hydrated. ππ¦πΈ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms