svn commit: r194838 - projects/libprocstat/sys/sys

Robert Watson rwatson at FreeBSD.org
Wed Jun 24 19:35:36 UTC 2009


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


More information about the svn-src-projects mailing list