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 Tue, Sep 11, 2007 at 09:33:10AM -0700, Patrick Mansfield wrote:
> OK ... crossed paths there, I will repost a third version with lower case
> #defines, and use __uid_t etc.
Third variant of the patch.
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: Use _dev_t, _uid_t, and _gid_t to
typedef dev_t, gid_t, and uid_t.
* libc/include/sys/_types.h: Move previous dev_t, uid_t and gid_t
types.h code to here, but typedef _dev_t, _uid_t, and _gid_t instead.
* libc/machine/spu/machine/_types.h: Add SPU specific _dev_t,
_uid_t, and _gid_t making them all four 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
@@ -158,20 +158,12 @@ typedef int32_t register_t;
* how the file was compiled (e.g. -mint16 vs -mint32, etc.).
*/
-#if defined(__rtems__)
-/* device numbers are 32-bit major and and 32-bit minor */
-typedef unsigned long long dev_t;
-#else
-#ifndef __CYGWIN__
-typedef short dev_t;
-#endif
-#endif
+typedef _dev_t dev_t;
#ifndef __CYGWIN__ /* which defines these types in it's own types.h. */
typedef long off_t;
-
-typedef unsigned short uid_t;
-typedef unsigned short gid_t;
+typedef _uid_t uid_t;
+typedef _gid_t gid_t;
#endif
typedef int pid_t;
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 */
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
@@ -16,6 +16,24 @@
typedef long _off_t;
#endif
+#if defined(__rtems__)
+/* device numbers are 32-bit major and and 32-bit minor */
+typedef unsigned long long _dev_t;
+#else
+#ifndef __CYGWIN__
+#ifndef __dev_t_defined
+typedef short _dev_t;
+#endif
+#endif
+#endif
+
+#ifndef __uid_t_defined
+typedef unsigned short _uid_t;
+#endif
+#ifndef __gid_t_defined
+typedef unsigned short _gid_t;
+#endif
+
#ifndef __OFF64_T_DEFINED
__extension__ typedef long long _off64_t;
#endif