Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 24 Jun 2009 20:35:32 +0100 (BST)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Bruce Evans <brde@optusnet.com.au>
Cc:        svn-src-projects@FreeBSD.org, Ulf Lilleengen <lulf@FreeBSD.org>, src-committers@FreeBSD.org, John Baldwin <jhb@FreeBSD.org>
Subject:   Re: svn commit: r194838 - projects/libprocstat/sys/sys
Message-ID:  <alpine.BSF.2.00.0906242033330.13224@fledge.watson.org>
In-Reply-To: <20090625050902.S33465@delplex.bde.org>
References:  <200906241500.n5OF0jTG017766@svn.freebsd.org> <200906241122.08934.jhb@freebsd.org> <20090625050902.S33465@delplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 25 Jun 2009, Bruce Evans wrote:

>>>   - Use the spare fields instead of expanding the struct.
>>>   - Use types with known size.
>> 
>> Note that mode_t and dev_t have fixed sizes already and are fine to use, 
>> same with off_t for the file size.
>> 
>>> From <sys/_types.h>:
>> 
>> typedef	__uint16_t	__mode_t;	/* permissions */
>> typedef	__int64_t	__off_t;	/* file offset */
>> typedef	__uint32_t	__dev_t;	/* device number */
>
> I don't agree with using fixed-width types, but it would be difficult to map 
> opaque types and their padding into the int spares.  Only fields of type int 
> can be mapped properly.  struct kinfo_proc also has long and pointer spares 
> so that more fields can be mapped properly.

I've been pondering defining a kptr_t that's 64-bit on all platforms, and 
adding a sysctl so that userspace can ask what the actual width of a kernel 
pointer is so that it can render correctly.  This woud allow 32-bit userspace 
tools to print 64-bit kernel pointers as opaque names in situations where that 
is useful -- both to name kernel objects, and for use with debugging.  (For 
example, for pipe endpoint names).

Robert N M Watson
Computer Laboratory
University of Cambridge



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.0906242033330.13224>