This is the mail archive of the newlib@sources.redhat.com 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] Cygwin specific changes to allow 64bit file access [was Re: [PATCH] lseek64r.c: Change off64_t to __off64_t]


On Fri, Mar 07, 2003 at 10:53:28AM +0100, Corinna Vinschen wrote:
> the following patch changes the usage of the datatype off64_t in
> reent/lseek64_r.c to __off64_t.  [...]

This path overrides the previous one.  It makes (hopefully) all necessary
changes to newlib which will allow Cygwin to switch to 64bit file access
at one point.  It also fixes two compile time problems (including the one
from the patch before) which are a result of using the "external" types
off64_t and fpos64_t instead of __off64_t and _fpo64_t in newlib internal
source files.

Note that this patch just *enables* to change Cygwin to 64bit file access.
The necessary changes to Cygwin itself aren't made yet, though.

Corinna

2003-03-07  Corinna Vinschen  <corinna at vinschen dot de>

	* configure.host: Define stdio64_dir for Cygwin.
	* libc/include/stdio.h: Change definition of fpos_t to fulfill
	Cygwin 64bit file access requirements.
	Drop definition of f*64() functions when compiled for Cygwin.
	* libc/include/sys/config.h: Define __LARGE64_FILES for Cygwin.
	* libc/reent/lseek64r.c: Use __off64_t instead of off64_t.
	* libc/stdio64/local64.h: Use _fpos64_t instead of fpos64_t.

Index: configure.host
===================================================================
RCS file: /cvs/src/src/newlib/configure.host,v
retrieving revision 1.46
diff -p -u -r1.46 configure.host
--- configure.host	20 Feb 2003 19:14:11 -0000	1.46
+++ configure.host	7 Mar 2003 14:13:03 -0000
@@ -288,6 +288,7 @@ case "${host}" in
   *-*-cygwin*)
 	sys_dir=cygwin
 	posix_dir=posix
+	stdio64_dir=stdio64
 	;;
   *-*-netware*)
 	signal_dir=
Index: libc/include/stdio.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/stdio.h,v
retrieving revision 1.19
diff -p -u -r1.19 stdio.h
--- libc/include/stdio.h	23 Jul 2002 19:40:45 -0000	1.19
+++ libc/include/stdio.h	7 Mar 2003 14:13:06 -0000
@@ -47,12 +47,20 @@
 
 _BEGIN_STD_C
 
-typedef _fpos_t fpos_t;
 typedef __FILE FILE;
 
+#ifdef __CYGWIN__
+#ifdef __CYGWIN_USE_BIG_TYPES__
+typedef _fpos64_t fpos_t;
+#else
+typedef _fpos_t fpos_t;
+#endif
+#else
+typedef _fpos_t fpos_t;
 #ifdef __LARGE64_FILES
 typedef _fpos64_t fpos64_t;
 #endif
+#endif /* !__CYGWIN__ */
 
 #include <sys/stdio.h>
 
@@ -287,6 +295,7 @@ ssize_t _EXFUN(__getdelim, (char **, siz
 ssize_t _EXFUN(__getline, (char **, size_t *, FILE *));
 
 #ifdef __LARGE64_FILES
+#ifndef __CYGWIN__
 FILE *  _EXFUN(fopen64, (const char *, const char *));
 _off64_t _EXFUN(ftello64, (FILE *));
 _off64_t _EXFUN(fseeko64, (FILE *, _off64_t, int));
@@ -300,6 +309,7 @@ _off64_t _EXFUN(_fseeko64_r, (struct _re
 int     _EXFUN(_fgetpos64_r, (struct _reent *, FILE *, _fpos64_t *));
 int     _EXFUN(_fsetpos64_r, (struct _reent *, FILE *, const _fpos64_t *));
 FILE *  _EXFUN(_tmpfile64_r, (struct _reent *));
+#endif /* !__CYGWIN__ */
 #endif /* __LARGE64_FILES */
  
 /*
Index: libc/include/sys/config.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/config.h,v
retrieving revision 1.35
diff -p -u -r1.35 config.h
--- libc/include/sys/config.h	16 Dec 2002 22:35:32 -0000	1.35
+++ libc/include/sys/config.h	7 Mar 2003 14:13:06 -0000
@@ -151,6 +151,7 @@
 #if defined(__CYGWIN32__) || defined(__CYGWIN__)
 #define __FILENAME_MAX__ (260 - 1 /* NUL */)
 #define _READ_WRITE_RETURN_TYPE _ssize_t
+#define __LARGE64_FILES 1
 #if defined(__INSIDE_CYGWIN__) || defined(_COMPILING_NEWLIB)
 #define __IMPORT
 #else
Index: libc/reent/lseek64r.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/reent/lseek64r.c,v
retrieving revision 1.2
diff -p -u -r1.2 lseek64r.c
--- libc/reent/lseek64r.c	26 Aug 2002 18:56:06 -0000	1.2
+++ libc/reent/lseek64r.c	7 Mar 2003 14:13:06 -0000
@@ -48,17 +48,17 @@ DESCRIPTION
         with large file support.
 */
 
-off64_t
+__off64_t
 _lseek64_r (ptr, fd, pos, whence)
      struct _reent *ptr;
      int fd;
-     off64_t pos;
+     __off64_t pos;
      int whence;
 {
-  off64_t ret;
+  __off64_t ret;
 
   errno = 0;
-  if ((ret = _lseek64 (fd, pos, whence)) == (off64_t) -1 && errno != 0)
+  if ((ret = _lseek64 (fd, pos, whence)) == (__off64_t) -1 && errno != 0)
     ptr->_errno = errno;
   return ret;
 }
Index: libc/stdio64/local64.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/stdio64/local64.h,v
retrieving revision 1.1
diff -p -u -r1.1 local64.h
--- libc/stdio64/local64.h	17 Jul 2002 23:25:44 -0000	1.1
+++ libc/stdio64/local64.h	7 Mar 2003 14:13:07 -0000
@@ -6,8 +6,8 @@
 #include "local.h"
 
 #ifdef __LARGE64_FILES
-extern fpos64_t _EXFUN(__sseek64,(void *, fpos64_t, int));
-extern fpos64_t _EXFUN(__sseek64_error,(void *, fpos64_t, int));
+extern _fpos64_t _EXFUN(__sseek64,(void *, _fpos64_t, int));
+extern _fpos64_t _EXFUN(__sseek64_error,(void *, _fpos64_t, int));
 extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite64,(void *, char const *, int));
 #endif
 

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen at redhat dot com


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