This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: [RFD] Trying to move Cygwin over to 64 bit file access
On Tue, Jun 11, 2002 at 03:56:44PM -0400, J. Johnston wrote:
> Actually, this should be relatively straightforward. What you need to
> do is to extend the current __sFILE structure and create a new __sFILE64.
> You still need the old __sFILE struct. The new structure adds a 64-bit
> offset field to the end and changes the prototype of the _seek function pointer.
> You also need to add a new flag to stdio.h (0x8000 is still available) which means "this
Yeah, that sounds good to me.
> is a 64-bit offset file". The flag gets set on by fopen64 which returns a
> struct __sFILE64 pointer. You can set fopen -> fopen64 and FILE to be struct __sFILE64
> by default so it is all hidden for new code.
This is done by some Makefile magic in Cygwin then. We already use
this technique to give new applications access to POSIX regex funcs
while old apps still use the original V8 regex implementation.
> For the REENT struct you can just always let the default std streams default as 32-bit
> files. If there is any reason to check, you can always look at the difference
> between the original stdin, stdout, and stderr pointers which will tell you which
> type of FILE was used at compilation time.
Would it hurt to redefine REENT using __sFILE64? All these are pointers
so the REENT struct wouldn't grow. It's just the evaluation of 32/64
bit needed additionally.
Style question:
What about the newlib functions? Just to pick an example, is it ok to
define e.g. _lseek_r in libc/reent/lseekr.c as
#ifdef __CYGWIN__
typedef __off64_t __loff_t
#define LSEEK lseek64
#else
typedef off_t __loff_t
#define LSEEK _lseek
#endif
__loff_t
_lseek_r (ptr, fd, pos, whence)
struct _reent *ptr;
int fd;
__loff_t pos;
int whence;
{
__loff_t ret;
errno = 0;
if ((ret = LSEEK (fd, pos, whence)) == (off_t) -1 && errno != 0)
ptr->_errno = errno;
return ret;
}
or would you prefer a different way to do stuff like that?
Corinna
--
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com