HomeFreeBSD

linux: getsockopt(): Simplify exporting groups a bit

Description

linux: getsockopt(): Simplify exporting groups a bit

No functional change (intended).

Go through conversion to a 'l_gid_t' before copying out in order to cope
with differing group types (except for not representable values, of
course). This is what is done, e.g., for getgroups() in 'linux_misc.c'.
As Linux's group type is the same as ours on all architectures, we could
as well just stop bothering and copy out our memory representation,
eliminating the loop here. Whatever the choice, though, it has to be
consistent here and there.

Introduce 'out' of type 'l_gid_t' to avoid performing "by hand" array
arithmetics when copying out.

MFC after: 5 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52280

(cherry picked from commit 10b789d7e14862c77f77f07e8af84d73d73012c6)

Details

Provenance
olceAuthored on Aug 29 2025, 8:26 AM
Differential Revision
D52280: linux: getsockopt(): Simplify exporting groups a bit
Parents
rGdb27bce904be: linux: setgroups16(): Pre-extend the groups array
Branches
Unknown
Tags
Unknown