Add a rather hackish implementation of kernel categories intended
to demostrate that the mechanism works. A refactor is required
to fill a caller provided buffer and to move adding "sys/" inside.
Sponsored by: Innovate UK
Differential D58238
uexterr_gettext(3): support dynamic kernel categories Authored by brooks on Tue, Jul 14, 8:08 PM. Tags None Referenced Files
Subscribers
Details
Diff Detail
Event TimelineComment Actions I think I want to refactor cat_to_filename() to take a buffer and to handle the selective prepending of sys/, perhaps bumping the uexterr_gettext ABI. It's fine for in-tree code, but definitely wrong for out of tree modules.
Comment Actions Having just hit submit... I wonder if we want to spend the available bit in EXTERR_CAT_SRC_MASK on in-tree vs out of tree or maybe just make pre-pending sys/ a legacy category source thing. Comment Actions This adds two syscalls to each dynamic syscall failure path. I understand that calling the sysctl is the easiest way to handle dynamically loaded modules. But I already got some negative comments due to exterrors adding some nanoseconds to the failing syscalls timings. Comment Actions I don't think performance of this path matters at all because users have to go out of their way to enable this code path with EXTERROR_VERBOSE. That being said, we could easily eliminate one system call by declaring mib _Thread_local and only initializing it once per thread and I suppose one could go further and make it once per-exec. Simple caching wouldn't be hard, just malloc an kern.exterr.ncategories length array of pointers and use atomics to access/update the slots. The most optimal implementation would be a no-syscall version using auxargs and shared pages like I mentioned in D58237, but it feels like pre-mature optimization and maximum correctness still requires a fallback like this. | ||||||||||||||||||||||||||||||||||||||