Vitaliy Makkoveev <m...@openbsd.org> writes: > On Tue, Apr 27, 2021 at 09:12:56PM +0200, Alexander Bluhm wrote: >> On Tue, Apr 27, 2021 at 12:18:02PM -0600, Theo de Raadt wrote: >> > Actually, your variation seems pretty good. Is there any reason to not >> > use this type of define? >> >> This would look like this. >> >> I think sysctl_int() and sysctl_rdint() should be the primitive >> functions. This brings us back the 4.4BSD implementation. Then >> sysctl_int_bounded() builds the magic on top like sysctl_int_lower() >> does it. sysctl_bounded_arr() is a wrapper around it. >> >> I just added a few defines that my simple grep found. We could >> search for more. > > This looks much better, I like the direction.
I like this too. I somehow got the impression that macros are severely frowned upon and didn't offer this kind of interface before. If you get this submitted, I can do a pass through the codebase to be sure we catch them all. Thanks Greg