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


Patch checked in. Thanks Patrick.

-- Jeff J.

Patrick Mansfield wrote:
On Tue, Sep 11, 2007 at 03:24:01PM -0400, Jeff Johnston wrote:

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.

OK. There are still some pre-existing types using one underscore.


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

I folded the above into the other CYGWIN ifndef.


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).

I did not find any defines of the (uppercase) __nnn_T_DEFINED outside of the spu/_types.h.

Modified patch:

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.
	Change to lower case for all __foo_t_defined names.
	* libc/machine/spu/machine/_types.h: Add SPU specific __dev_t,
	__uid_t, and __gid_t making them all four bytes. Change to lower case
	for all __foo_t_defined names.

Index: quilt/newlib/libc/include/sys/types.h
===================================================================
--- quilt.orig/newlib/libc/include/sys/types.h
+++ quilt/newlib/libc/include/sys/types.h
@@ -158,20 +158,11 @@ 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
-
#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 __dev_t dev_t;
+typedef __uid_t uid_t;
+typedef __gid_t gid_t;
#endif
typedef int pid_t;
Index: quilt/newlib/libc/machine/spu/machine/_types.h
===================================================================
--- quilt.orig/newlib/libc/machine/spu/machine/_types.h
+++ quilt/newlib/libc/machine/spu/machine/_types.h
@@ -39,14 +39,22 @@
/*
* fpos_t large enough for either 32 or 64 bit ppc glibc fpos_t.
*/
-#define __FPOS_T_DEFINED
+#define __fpos_t_defined
typedef struct {
char __pos[16];
} _fpos_t;
#ifdef __LARGE64_FILES
-#define __FPOS64_T_DEFINED
+#define __fpos64_t_defined
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: quilt/newlib/libc/include/sys/_types.h
===================================================================
--- quilt.orig/newlib/libc/include/sys/_types.h
+++ quilt/newlib/libc/include/sys/_types.h
@@ -12,11 +12,27 @@
#include <machine/_types.h>
#include <sys/lock.h>
-#ifndef __OFF_T_DEFINED
+#ifndef __off_t_defined
typedef long _off_t;
#endif
-#ifndef __OFF64_T_DEFINED
+#if defined(__rtems__)
+/* device numbers are 32-bit major and and 32-bit minor */
+typedef unsigned long long __dev_t;
+#else
+#ifndef __dev_t_defined
+typedef short __dev_t;
+#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
@@ -24,18 +40,18 @@ __extension__ typedef long long _off64_t
* We need fpos_t for the following, but it doesn't have a leading "_",
* so we use _fpos_t instead.
*/
-#ifndef __FPOS_T_DEFINED
+#ifndef __fpos_t_defined
typedef long _fpos_t; /* XXX must match off_t in <sys/types.h> */
/* (and must be `long' for now) */
#endif
#ifdef __LARGE64_FILES
-#ifndef __FPOS64_T_DEFINED
+#ifndef __fpos64_t_defined
typedef _off64_t _fpos64_t;
#endif
#endif
-#ifndef __SSIZE_T_DEFINED
+#ifndef __ssize_t_defined
#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647
typedef int _ssize_t;
#else
@@ -46,7 +62,7 @@ typedef long _ssize_t;
#define __need_wint_t
#include <stddef.h>
-#ifndef __MBSTATE_T_DEFINED
+#ifndef __mbstate_t_defined
/* Conversion state information. */
typedef struct
{
@@ -59,11 +75,11 @@ typedef struct
} _mbstate_t;
#endif
-#ifndef __FLOCK_T_DEFINED
+#ifndef __flock_t_defined
typedef _LOCK_RECURSIVE_T _flock_t;
#endif
-#ifndef __ICONV_T_DEFINED
+#ifndef __iconv_t_defined
/* Iconv descriptor type */
typedef void *_iconv_t;
#endif


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