[PATCH] SPU use 4 bytes for uid_t, gid_t and dev_t

Jeff Johnston jjohnstn@redhat.com
Tue Sep 11 16:31:00 GMT 2007


Patrick Mansfield wrote:
> On Wed, Sep 05, 2007 at 09:29:22AM -0700, Patrick Mansfield wrote:
>> For SPU, use 4 bytes for uid_t and gid_t.
>>
>> Use 4 bytes for dev_t to match the linux kernel dev_t size, though glibc
>> uses 8 bytes, we want to keep our assist call ABI the same for now (in
>> jsre_stat and mknod), and only the low 32 bits of dev are used in
>> glibc.
>>
>> newlib ChangeLog:
>>
>> 2007-09-05 Patrick Mansfield <patmans@us.ibm.com>
>>
>> 	* libc/include/sys/types.h: For SPU, use 4 byte uid_t and gid_t,
>> 	and 4 byte dev_t.
> 
> Jeff - do you want this redone, changing types.h and SPU machine _types.h?
> 
> If so, what should I use for define names? types.h already uses lower case
> (like __timer_t_defined), but the other patch I made used uppercase
> (__FPOS_T_DEFINED).
> 
> i.e. which form of case and underscore prefix: __gid_t_defined,
> _gid_t_defined, __GID_T_DEFINED or _GID_T_DEFINED?
> 
> -- Patrick Mansfield
>

Yes, please redo.

My take is to treat these types like _fpos_t.  I suggest using double 
underscores for the new types: __uid_t, __gid_t, and __dev_t.  Define 
defaults in sys/_types.h as is done for the other types.  In 
sys/types.h, simply do typedef __uid_t uid_t; etc... where they are 
found.  Leave special cases alone for the mean-time (e.g. RTEMS).

In spu/machine/_types.h define the desired __uid_t, etc...

Regarding consistency of flag names, we can lower-case all the new ones 
recently added since spu is the only one using them at present.  So, an 
example of a new flag would be: __gid_t_defined and an old one would now 
be __fpos_t_defined.

-- Jeff J.

>> Index: src/newlib/libc/include/sys/types.h
>> ===================================================================
>> --- src.orig/newlib/libc/include/sys/types.h
>> +++ src/newlib/libc/include/sys/types.h
>> @@ -161,6 +161,8 @@ typedef int32_t register_t;
>>  #if defined(__rtems__)
>>  /* device numbers are 32-bit major and and 32-bit minor */
>>  typedef unsigned long long dev_t;
>> +#elif defined(__SPU__)
>> +typedef unsigned dev_t;
>>  #else
>>  #ifndef __CYGWIN__
>>  typedef	short	dev_t;
>> @@ -170,9 +172,14 @@ typedef	short	dev_t;
>>  #ifndef __CYGWIN__	/* which defines these types in it's own types.h. */
>>  typedef long		off_t;
>>
>> +#ifdef __SPU__
>> +typedef	unsigned int	uid_t;
>> +typedef	unsigned int	gid_t;
>> +#else
>>  typedef	unsigned short	uid_t;
>>  typedef	unsigned short	gid_t;
>>  #endif
>> +#endif
>>
>>  typedef int pid_t;
>>  #ifndef __CYGWIN__



More information about the Newlib mailing list