Re: [yocto-patches] [pseudo] [PATCH v2 1/2] ports/linux/guts: Implement close_range() instead of returning ENOSYS

Richard Purdie <[email protected]> Tue, 28 Jul 2026 11:48:23 +0100
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <a5225693f4c1f4d2066f584cff289f615d2ac406.camel@linuxfoundation.org>
On Tue, 2026-07-28 at 11:15 +0100, Richard Purdie via lists.yoctoproject.or=
g wrote:
> close_range(3, ~0U, xxx);
>=20
> Whether we should just force maxfd to INT_MAX always, I'm not sure. I
> don't think the high fds are usable.

Checking into the kernel, it would never handle fds between INT_MAX and
~0U so I think we can just clamp to INT_MAX for our code.

Also, I don't think pseudo needs both OP_CLOSEFROM and OP_CLOSERANGE.
I'd propose we just add a max parameter to OP_CLOSEFROM so it
effectively becomes OP_CLOSERANGE, I'm fine with renaming it too. We
can then use it from close_from with INT_MAX as the upper limit.

Are you ok to tweak the patches like that, handle the type conversions
safely, add a test for close_range(3, ~0U, xxx) working (with ~0U) and
then resend?

Cheers,

Richard