mas_insert(9)
π mas_insert(9)
okay so this is mas_insert, from section 9 of the Kernel API Manual (yes, the kernel one β we're fancy now β¨). She's an internal call to insert a value, and honestly? she's a lil diva with a very specific job. let's get into it π
β¨ SYNOPSIS β¨
void * mas_insert (struct ma_state *mas , void *entry );
like literally that's the whole signature bestie, two args, one pointer coming back at you π«Ά
πΈ ARGUMENTS πΈ
masβ the maple state π this is the whole vibe-holder, the state struct you're working inside ofentryβ the entry to store π this is the thing you're yeeting into the tree
π RETURN π
so the return is giving "it depends" energy, and here's the deal:
- it returns
NULL, or - it returns the contents that already exist at the requested index otherwise π₯
β οΈ important caveat bestie, do NOT skip this: you have to check the maple state for error conditions. like, the return value alone is not the whole story β the state holds the tea on whether things went sideways. so check it, fr fr π
π¦ SEE ALSO π¦
okay this list is long and I'm obsessed, everything lives in the kernel file ./lib/maple_tree.c β buckle up:
mas_prealloc_calc(9)mas_wr_preallocate(9)mas_alloc_cyclic(9)mas_walk(9)mte_dead_walk(9)mt_free_walk(9)mas_store(9)mas_store_gfp(9)mas_store_prealloc(9)mas_preallocate(9)mas_next(9)mas_next_range(9)mt_next(9)mas_prev(9)mas_prev_range(9)mt_prev(9)mas_pause(9)mas_find_setup(9)mas_find(9)mas_find_range(9)mas_find_rev_setup(9)mas_find_rev(9)mas_find_range_rev(9)mas_erase(9)mas_nomem(9)mas_nomem_nofail(9)mtree_load(9)mtree_store_range(9)mtree_store(9)mtree_insert_range(9)mtree_insert(9)mtree_alloc_cyclic(9)mtree_erase(9)__mt_dup(9)mtree_dup(9)__mt_destroy(9)mtree_destroy(9)mt_find(9)mt_find_after(9)
like I said. iconic. entire extended universe of maple tree functions π
signed, sealed, delivered π«Ά this one came out of ./lib, dated October 2026, and it's filed under mas_insert(9) β periodt π
π¦ 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