This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Patrick Mansfield wrote:
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.


Still needs a bit of tweaking. I want the new underscore types to be double-underscored, e.g. __uid_t. Historically, we have single-underscored types, but we should be using double-underscored lower-case types to keep out of the user's name-space.


Secondly, leave the #if __CYGWIN__ checks alone in sys/types.h. They are there because Cygwin screws up our header system by not having a libc/sys/cygwin directory and later in the file, includes their own magic types header. Some clean-up is needed for Cygwin as I am not a fan of this. You can move the __rtems__ stuff over as you did. So you would have the following example for dev_t, in sys/types.h:

#ifndef __CYGWIN__
typedef	__dev_t dev_t;
#endif

The new flags are fine, but I would like you to lower-case all the flags in sys/_types.h (including the ones not used by SPU and the previous ones for fpos_t and fpos64_t).

-- Jeff J.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]