This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
[PATCH] SPU use 4 bytes for uid_t, gid_t and dev_t
On Mon, Sep 10, 2007 at 04:56:52PM -0700, Patrick Mansfield wrote:
> 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?
OK, like this patch. I don't know how to build any other archs let alone
rtems, so I'm paranoid about adding other changes (adding an rtems
_types.h with its own dev_t), or AFAICT a cygwin _types.h that has just
#defines.
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-11 Patrick Mansfield <patmans@us.ibm.com>
* libc/include/sys/types.h: Add ifdef wrappers around dev_t,
uid_t, and gid_t.
* libc/machine/spu/machine/_types.h: Add SPU specific typedefs for
dev_t, uid_t, and gid_t making them all 4 bytes.
Index: push-sdk3-patches-quilt-base/newlib/libc/include/sys/types.h
===================================================================
--- push-sdk3-patches-quilt-base.orig/newlib/libc/include/sys/types.h
+++ push-sdk3-patches-quilt-base/newlib/libc/include/sys/types.h
@@ -163,16 +163,22 @@ typedef int32_t register_t;
typedef unsigned long long dev_t;
#else
#ifndef __CYGWIN__
+#ifndef __DEV_T_DEFINED
typedef short dev_t;
#endif
#endif
+#endif
#ifndef __CYGWIN__ /* which defines these types in it's own types.h. */
typedef long off_t;
+#ifndef __UID_T_DEFINED
typedef unsigned short uid_t;
+#endif
+#ifndef __GID_T_DEFINED
typedef unsigned short gid_t;
#endif
+#endif
typedef int pid_t;
#ifndef __CYGWIN__
Index: push-sdk3-patches-quilt-base/newlib/libc/machine/spu/machine/_types.h
===================================================================
--- push-sdk3-patches-quilt-base.orig/newlib/libc/machine/spu/machine/_types.h
+++ push-sdk3-patches-quilt-base/newlib/libc/machine/spu/machine/_types.h
@@ -49,4 +49,12 @@ typedef struct {
typedef _fpos_t _fpos64_t;
#endif
+#define __DEV_T_DEFINED
+typedef int dev_t;
+
+#define __UID_T_DEFINED
+typedef unsigned int uid_t;
+#define __GID_T_DEFINED
+typedef unsigned int gid_t;
+
#endif /* _MACHINE__TYPES_H */