Date: Thu, 26 Apr 2001 14:26:23 +1000 (EST) From: Bruce Evans <bde@zeta.org.au> To: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> Cc: arch@freebsd.org Subject: Re: gid_t vs. plain int Message-ID: <Pine.BSF.4.21.0104261354440.29302-100000@besplex.bde.org> In-Reply-To: <200104260251.WAA15799@khavrinen.lcs.mit.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 25 Apr 2001, Garrett Wollman wrote: > Bruce writes: > > >BTW, the kernel still uses int for gids in many places, e.g., > >kern/syscalls.master says that chown(2) takes an "int gid" arg. This > >depends on various type puns to work. > > Of course it has to do that in order to allow for the possibility that > gid_t might still be a short. No. If gid_t were short, then type puns are neither necessary nor sufficient for handling it properly. Lying about the arg types in syscalls.master just makes it harder for trap.c:syscall() to convert the args. syscall() repacks the args into the syscall args structs declared in <sys/sysproto.h>. It "just happens" that the repacking can be implemented using a simple copyin() on i386's and alphas. > Of course, this precludes gid_t from > being something-longer-than-int, but much larger parts of the ABI would > have to change at the same time in that case. The syscall args structs handle all cases that are likely to happen in practice, including short args on little-endian machines (minor adjustments are required for short args on big-endian machines). Short args already occur in practice for at least lchmod() (because NetBSD debogotified syscalls.master before FreeBSD obtained lchmod() from NetBSD). Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0104261354440.29302-100000>