Page MenuHomeFreeBSD

kqueue: tidy knlist_init
Needs ReviewPublic

Authored by freebsdphab-AX9_cmx.ietfng.org on Dec 7 2020, 8:53 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Apr 29, 4:52 AM
Unknown Object (File)
Dec 12 2023, 7:32 PM
Unknown Object (File)
Sep 25 2023, 8:27 AM
Unknown Object (File)
Sep 5 2023, 2:26 AM

Details

Reviewers
jmg
Summary

IMHO, it doesn't really make sense to mix and match between knlist_mtx_{,un,assert_}lock and other functions filling those roles, unless all three are replaced (e.g., by knlist_rw_{,un,assert_}lock), so it's a little strange that knlist_init() allows its function pointer parameters to be NULL or not, independently. Indeed, glancing at all the in-tree knlist_init() calls, it appears that only knlist_init_mtx() took knlist_init() up on its offer of NULL-signaled defaults. Instead, explicitly pass in the _mtx variants in knlist_init_mtx() and assert() against NULL values in knlist_init().

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

Can you please send me the git send-email prepared patch, with proper commit message and attributions (e.g. right author name/email), ready for commit?

sys/kern/kern_event.c
2421

We usually do not assert that pointers are not NULL, allowing them to simply fault on dereference. Otherwise, half of our code would consist of non-NULL asserts.

That said, I can see an argument that there it allows to see the place where the harm was done.

At least, please fix the continuation line to have +4 spaces assert.