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]

[PATCH] SPU use a 16 byte fpos_t


fpos_t is 12 bytes for 32 bit ppc glibc, and 16 bytes for 64 bit.

Currently SPU newlib uses 4 bytes for fpos_t. This is always a problem
with 64 bit ppc, since the fgetpos() assist call writes 8 bytes back for
the offset, and is a potential problem with 32 bit ppc.

So for SPU always use 16 bytes for fpos_t and also make currently unused
(in SPU) _fpos64_t 16 bytes.

newlib ChangeLog:

2007-09-05 Patrick Mansfield <patmans@us.ibm.com>

	* libc/include/sys/reent.h: For SPU use a _fpos_t and _fpos64_t with
	sizes of 16 bytes.

Index: src/newlib/libc/include/sys/reent.h
===================================================================
--- src.orig/newlib/libc/include/sys/reent.h
+++ src/newlib/libc/include/sys/reent.h
@@ -112,6 +112,19 @@ struct __sbuf {
  * so we use _fpos_t instead.
  */
 
+#ifdef __SPU__
+/*
+ * Requires that the size be large enough to store a 64 bit ppc glibc
+ * fpos_t of 16 bytes.
+ */
+typedef struct {
+  char __pos[16];
+} _fpos_t;
+#ifdef __LARGE64_FILES
+typedef _fpos_t _fpos64_t;
+#endif
+
+#else
 typedef long _fpos_t;		/* XXX must match off_t in <sys/types.h> */
 				/* (and must be `long' for now) */
 
@@ -119,6 +132,8 @@ typedef long _fpos_t;		/* XXX must match
 typedef _off64_t _fpos64_t;
 #endif
 
+#endif
+
 /*
  * Stdio state variables.
  *


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