UNW_SET...HE_SIZE(3libunwind)

πŸ’– UNW_SET_CACHE_SIZE β€” bestie edition πŸ’–

okay so this is a page from the Programming Library manual, third section of libunwind (3libunwind), and today we're learning about unw_set_cache_size. sit down, get comfy, we're doing this 🫢


✨ NAME ✨

unw_set_cache_size β€” set the unwind cache size, that's literally it, that's the whole job πŸ’…


🌸 SYNOPSIS 🌸

#include <libunwind.h>

int unw_set_cache_size(unw_addr_space_t as, size_t size, int flag);

πŸ¦‹ DESCRIPTION πŸ¦‹

so the unw_set_cache_size() routine sets the cache size of the address space as so it can hold at least as many items as the number you pass in size. key word: at least. it might hold more items than you asked for, because that's up to the implementation, not you, bestie πŸ™ˆ

and if you want to turn caching off entirely? call unw_set_caching_policy) with a policy of UNW_CACHE_NONE. yes, that's the move. no notes. ✨

oh and flag? it's currently unused and must be 0. not "should be", not "preferably", it must be 0. periodt. πŸ‘‘


πŸ’œ RETURN VALUE πŸ’œ

when it works, unw_set_cache_size() returns 0. slay. πŸŽ€

when it doesn't work, you get the negative value of one of the error codes listed below. so like, the bad vibes come with a minus sign. πŸ’€


πŸ”₯ THREAD AND SIGNAL SAFETY πŸ”₯

unw_set_cache_size() is thread-safe β€” go off, multi-threaded queens πŸ‘‘

but it is not safe to use from a signal handler. do not do that. that's the vibe check it fails. 🚫


πŸ’€ ERRORS πŸ’€

  • UNW_ENOMEM β€” the desired cache size could not be established because the application is out of memory. the cache simply said "i can't, i'm full" 😭

🌈 SEE ALSO 🌈

go read those next, iykyk 🧚


πŸ‘‘ AUTHOR πŸ‘‘

Dave Watson


and that's the whole page, bestie, no cap, fr fr πŸ’– this was Programming Library business, dated 29 August 2023, filed under UNW_SET...HE_SIZE(3libunwind) β€” bye, love u, go set some cache sizes responsibly πŸ“βœ¨