From owner-freebsd-arch Wed Apr 25 21:27:52 2001 Delivered-To: freebsd-arch@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 8002B37B423 for ; Wed, 25 Apr 2001 21:27:49 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id OAA31938; Thu, 26 Apr 2001 14:27:42 +1000 Date: Thu, 26 Apr 2001 14:26:23 +1000 (EST) From: Bruce Evans X-Sender: bde@besplex.bde.org To: Garrett Wollman Cc: arch@freebsd.org Subject: Re: gid_t vs. plain int In-Reply-To: <200104260251.WAA15799@khavrinen.lcs.mit.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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 . 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