Chris Cappuccio <ch...@nmedia.net> wrote: > Vitaliy Makkoveev [m...@openbsd.org] wrote: > > > > > > > On 26 Apr 2021, at 01:43, Theo de Raadt <dera...@openbsd.org> wrote: > > > > > > I am not a fan of this strange behaviour, where the min+max values > > > have additional behaviours. It is too surprising, and surprising > > > often turns into error-prone. > > > > Agreed. Also according sysctl_int_bounded() code this behaviour looks > > like non obvious side effect. > > > > Would 0, 0 min, max be a simple and obvious way to say "read only" ?
That is not as terrible. Or maybe a define like: + #define SYSCTL_BOUNDED_ARR_READONLY 0,0 int sysctl_bounded_arr(const struct sysctl_bounded_args *, u_int, int *, u_int, void *, size_t *, void *, size_t); Which can then be used in-place without confusion. But whatever we do, it must be documented clearly.