__next_ns(9)
π __next_ns(9) β the kernel API manual, but make it make sense
okay bestie, welcome to the <pink>__next_ns</pink> page from the Kernel API Manual β¨ this one lives in the AppArmor corner of the kernel and it's literally just "find the next namespace to list" π that's the whole NAME section, we ate π
β¨ SYNOPSIS β¨
struct aa_ns * __next_ns (struct aa_ns *root , struct aa_ns *ns );
that's it, that's the whole vibe check π¦ two pointers in, one pointer out, no cap.
πΈ ARGUMENTS πΈ
rootβ the root namespace where the search stops π it isNOT NULL, so do not come in here with a null, bestie, that's not the move πnsβ your current ns position, like where you're standing right now π alsoNOT NULL. same energy. no nulls allowed, periodt.
π DESCRIPTION π
so the way this works is: it finds the next namespace after ns, but only the ones hanging out under root β and it handles all the locking needed while it switches the current namespace π like it does the whole lock choreography for you so you don't have to, which is honestly iconic of it π
π RETURN π
you get the next namespace back π or NULL if you're already at the last namespace under root β that's the "no more, we're done here" signal π
and the requirement, fr fr: ns->parent->lock has to be held. that's not optional, that's the whole deal π«Ά
β NOTE β
heads up, bestie: it will not unlock root->lock π¨ so don't go thinking it'll clean that up for you β that lock is yours to deal with, iykyk π
π¦ SEE ALSO π¦
kernel file ./security/apparmor/apparmorfs.c π and the whole friend group:
mangle_name(9)__aafs_setup_d_inode(9)aafs_create(9)aafs_create_file(9)aafs_create_dir(9)aafs_remove(9)aa_simple_write_to_buffer(9)aa_get_data_from_compressed(9)query_data(9)query_label(9)aa_write_access(9)__first_profile(9)__next_profile(9)next_profile(9)p_start(9)p_next(9)p_stop(9)seq_show_profile(9)entry_create_file(9)entry_create_dir(9)entry_remove_file(9)entry_remove_dir(9)aa_destroy_aafs(9)aa_create_aafs(9)
that's the page, babe π this came out of ./security/apparmor, dated October 2026, and it's filed under __next_ns(9) β go forth and iterate your namespaces responsibly π
β¨π₯
π¦ 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