* libc/stdio64/local64.h: Delete, move contents to...

* libc/stdio/local.h: ...here.
	* libc/stdio64/fdopen64.c: Update includes.
	* libc/stdio64/fopen64.c: Likewise.
	* libc/stdio64/freopen64.c: Likewise.
	* libc/stdio64/fseeko64.c: Likewise.
	* libc/stdio64/ftello64.c: Likewise.
	* libc/stdio/findfp.c (std) [__LARGE64_FILES]: Open stdin, stdout,
	and stderr with 64-bit offset.
	* libc/stdio/fseek.c (_fseek_r): Avoid compile warning.
	* libc/stdio/makebuf.c (__smakebuf_r): Likewise.
	* libc/stdio/mktemp.c (_gettemp): Likewise.
This commit is contained in:
Eric Blake 2007-05-01 23:03:36 +00:00
parent 2babeb3d94
commit b4f095585f
12 changed files with 70 additions and 45 deletions

View File

@ -1,3 +1,18 @@
2007-05-01 Eric Blake <ebb9@byu.net>
* libc/stdio64/local64.h: Delete, move contents to...
* libc/stdio/local.h: ...here.
* libc/stdio64/fdopen64.c: Update includes.
* libc/stdio64/fopen64.c: Likewise.
* libc/stdio64/freopen64.c: Likewise.
* libc/stdio64/fseeko64.c: Likewise.
* libc/stdio64/ftello64.c: Likewise.
* libc/stdio/findfp.c (std) [__LARGE64_FILES]: Open stdin, stdout,
and stderr with 64-bit offset.
* libc/stdio/fseek.c (_fseek_r): Avoid compile warning.
* libc/stdio/makebuf.c (__smakebuf_r): Likewise.
* libc/stdio/mktemp.c (_gettemp): Likewise.
2007-05-01 Cary R. <cygcary <at> yahoo.com> 2007-05-01 Cary R. <cygcary <at> yahoo.com>
* libm/math/e_pow.c: Fix to be consistent with glibc with regards * libm/math/e_pow.c: Fix to be consistent with glibc with regards
@ -66,7 +81,7 @@
2007-04-25 Patrick Mansfield <patmans@us.ibm.com> 2007-04-25 Patrick Mansfield <patmans@us.ibm.com>
* libm/machine/spu/headers/feholdexcept.h: Use *envp not env so * libm/machine/spu/headers/feholdexcept.h: Use *envp not env so
we clear the proper bits in the fpscr, and don't set some random ones. we clear the proper bits in the fpscr, and don't set some random ones.
2007-04-24 Eric Blake <ebb9@byu.net> 2007-04-24 Eric Blake <ebb9@byu.net>

View File

@ -52,7 +52,13 @@ _DEFUN(std, (ptr, flags, file, data),
ptr->_lbfsize = 0; ptr->_lbfsize = 0;
ptr->_cookie = ptr; ptr->_cookie = ptr;
ptr->_read = __sread; ptr->_read = __sread;
#ifndef __LARGE64_FILES
ptr->_write = __swrite; ptr->_write = __swrite;
#else /* __LARGE64_FILES */
ptr->_write = __swrite64;
ptr->_seek64 = __sseek64;
ptr->_flags |= __SL64;
#endif /* __LARGE64_FILES */
ptr->_seek = __sseek; ptr->_seek = __sseek;
ptr->_close = __sclose; ptr->_close = __sclose;
#if !defined(__SINGLE_THREAD__) && !defined(_REENT_SMALL) #if !defined(__SINGLE_THREAD__) && !defined(_REENT_SMALL)
@ -100,7 +106,7 @@ _DEFUN(__sfp, (d),
int n; int n;
struct _glue *g; struct _glue *g;
__sfp_lock_acquire (); __sfp_lock_acquire ();
if (!_GLOBAL_REENT->__sdidinit) if (!_GLOBAL_REENT->__sdidinit)
__sinit (_GLOBAL_REENT); __sinit (_GLOBAL_REENT);
@ -113,7 +119,7 @@ _DEFUN(__sfp, (d),
(g->_next = __sfmoreglue (d, NDYNAMIC)) == NULL) (g->_next = __sfmoreglue (d, NDYNAMIC)) == NULL)
break; break;
} }
__sfp_lock_release (); __sfp_lock_release ();
d->_errno = ENOMEM; d->_errno = ENOMEM;
return NULL; return NULL;
@ -123,7 +129,7 @@ found:
#ifndef __SINGLE_THREAD__ #ifndef __SINGLE_THREAD__
__lock_init_recursive (fp->_lock); __lock_init_recursive (fp->_lock);
#endif #endif
__sfp_lock_release (); __sfp_lock_release ();
fp->_p = NULL; /* no current pointer */ fp->_p = NULL; /* no current pointer */
fp->_w = 0; /* nothing to read or write */ fp->_w = 0; /* nothing to read or write */
@ -198,7 +204,7 @@ _DEFUN(__sinit, (s),
std (s->_stdin, __SRD, 0, s); std (s->_stdin, __SRD, 0, s);
/* on platforms that have true file system I/O, we can verify whether stdout /* on platforms that have true file system I/O, we can verify whether stdout
is an interactive terminal or not. For all other platforms, we will is an interactive terminal or not. For all other platforms, we will
default to line buffered mode here. */ default to line buffered mode here. */
#ifdef HAVE_FCNTL #ifdef HAVE_FCNTL
@ -220,25 +226,25 @@ __LOCK_INIT_RECURSIVE(static, __sinit_lock);
_VOID _VOID
_DEFUN_VOID(__sfp_lock_acquire) _DEFUN_VOID(__sfp_lock_acquire)
{ {
__lock_acquire_recursive (__sfp_lock); __lock_acquire_recursive (__sfp_lock);
} }
_VOID _VOID
_DEFUN_VOID(__sfp_lock_release) _DEFUN_VOID(__sfp_lock_release)
{ {
__lock_release_recursive (__sfp_lock); __lock_release_recursive (__sfp_lock);
} }
_VOID _VOID
_DEFUN_VOID(__sinit_lock_acquire) _DEFUN_VOID(__sinit_lock_acquire)
{ {
__lock_acquire_recursive (__sinit_lock); __lock_acquire_recursive (__sinit_lock);
} }
_VOID _VOID
_DEFUN_VOID(__sinit_lock_release) _DEFUN_VOID(__sinit_lock_release)
{ {
__lock_release_recursive (__sinit_lock); __lock_release_recursive (__sinit_lock);
} }
/* Walkable file locking routine. */ /* Walkable file locking routine. */
@ -264,7 +270,7 @@ _DEFUN(__fp_unlock, (ptr),
_VOID _VOID
_DEFUN_VOID(__fp_lock_all) _DEFUN_VOID(__fp_lock_all)
{ {
__sfp_lock_acquire (); __sfp_lock_acquire ();
_CAST_VOID _fwalk (_REENT, __fp_lock); _CAST_VOID _fwalk (_REENT, __fp_lock);
} }

View File

@ -32,9 +32,9 @@ ANSI_SYNOPSIS
#include <stdio.h> #include <stdio.h>
int fseek(FILE *<[fp]>, long <[offset]>, int <[whence]>) int fseek(FILE *<[fp]>, long <[offset]>, int <[whence]>)
int fseeko(FILE *<[fp]>, off_t <[offset]>, int <[whence]>) int fseeko(FILE *<[fp]>, off_t <[offset]>, int <[whence]>)
int _fseek_r(struct _reent *<[ptr]>, FILE *<[fp]>, int _fseek_r(struct _reent *<[ptr]>, FILE *<[fp]>,
long <[offset]>, int <[whence]>) long <[offset]>, int <[whence]>)
int _fseeko_r(struct _reent *<[ptr]>, FILE *<[fp]>, int _fseeko_r(struct _reent *<[ptr]>, FILE *<[fp]>,
off_t <[offset]>, int <[whence]>) off_t <[offset]>, int <[whence]>)
TRAD_SYNOPSIS TRAD_SYNOPSIS
@ -126,7 +126,11 @@ _DEFUN(_fseek_r, (ptr, fp, offset, whence),
_fpos_t target; _fpos_t target;
_fpos_t curoff = 0; _fpos_t curoff = 0;
size_t n; size_t n;
#ifdef __USE_INTERNAL_STAT64
struct stat64 st;
#else
struct stat st; struct stat st;
#endif
int havepos; int havepos;
/* Make sure stdio is set up. */ /* Make sure stdio is set up. */

View File

@ -46,6 +46,14 @@ extern int _EXFUN(_fwalk,(struct _reent *, int (*)(FILE *)));
extern int _EXFUN(_fwalk_reent,(struct _reent *, int (*)(struct _reent *, FILE *))); extern int _EXFUN(_fwalk_reent,(struct _reent *, int (*)(struct _reent *, FILE *)));
struct _glue * _EXFUN(__sfmoreglue,(struct _reent *,int n)); struct _glue * _EXFUN(__sfmoreglue,(struct _reent *,int n));
#ifdef __LARGE64_FILES
extern _fpos64_t _EXFUN(__sseek64,(void *, _fpos64_t, int));
extern _fpos64_t _EXFUN(__sseek64_r,(struct _reent *, void *, _fpos64_t, int));
extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite64,(void *, char const *, int));
extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite64_r,(struct _reent *, void *,
char const *, int));
#endif
/* Called by the main entry point fns to ensure stdio has been initialized. */ /* Called by the main entry point fns to ensure stdio has been initialized. */
#ifdef _REENT_SMALL #ifdef _REENT_SMALL

View File

@ -41,7 +41,11 @@ _DEFUN(__smakebuf_r, (ptr, fp),
{ {
register size_t size, couldbetty; register size_t size, couldbetty;
register _PTR p; register _PTR p;
#ifdef __USE_INTERNAL_STAT64
struct stat64 st;
#else
struct stat st; struct stat st;
#endif
if (fp->_flags & __SNBF) if (fp->_flags & __SNBF)
{ {

View File

@ -60,7 +60,7 @@ TRAD_SYNOPSIS
DESCRIPTION DESCRIPTION
<<mktemp>> and <<mkstemp>> attempt to generate a file name that is not <<mktemp>> and <<mkstemp>> attempt to generate a file name that is not
yet in use for any existing file. <<mkstemp>> creates the file and yet in use for any existing file. <<mkstemp>> creates the file and
opens it for reading and writing; <<mktemp>> simply generates the file name. opens it for reading and writing; <<mktemp>> simply generates the file name.
You supply a simple pattern for the generated file name, as the string You supply a simple pattern for the generated file name, as the string
@ -108,7 +108,11 @@ _DEFUN(_gettemp, (ptr, path, doopen),
register int *doopen) register int *doopen)
{ {
register char *start, *trv; register char *start, *trv;
#ifdef __USE_INTERNAL_STAT64
struct stat64 sbuf;
#else
struct stat sbuf; struct stat sbuf;
#endif
unsigned int pid; unsigned int pid;
pid = _getpid_r (ptr); pid = _getpid_r (ptr);

View File

@ -28,7 +28,7 @@ File pointer or <<NULL>>, as for <<fopen>>.
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include "local64.h" #include "local.h"
#include <_syslist.h> #include <_syslist.h>
#include <sys/lock.h> #include <sys/lock.h>

View File

@ -27,7 +27,7 @@ INDEX
ANSI_SYNOPSIS ANSI_SYNOPSIS
#include <stdio.h> #include <stdio.h>
FILE *fopen64(const char *<[file]>, const char *<[mode]>); FILE *fopen64(const char *<[file]>, const char *<[mode]>);
FILE *_fopen64_r(void *<[reent]>, FILE *_fopen64_r(void *<[reent]>,
const char *<[file]>, const char *<[mode]>); const char *<[file]>, const char *<[mode]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
@ -66,7 +66,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include "local64.h" #include "local.h"
#ifdef __CYGWIN__ #ifdef __CYGWIN__
#include <fcntl.h> #include <fcntl.h>
#endif #endif
@ -91,12 +91,12 @@ _DEFUN (_fopen64_r, (ptr, file, mode),
if ((f = _open64_r (ptr, file, oflags, 0666)) < 0) if ((f = _open64_r (ptr, file, oflags, 0666)) < 0)
{ {
__sfp_lock_acquire (); __sfp_lock_acquire ();
fp->_flags = 0; /* release */ fp->_flags = 0; /* release */
#ifndef __SINGLE_THREAD__ #ifndef __SINGLE_THREAD__
__lock_close_recursive (fp->_lock); __lock_close_recursive (fp->_lock);
#endif #endif
__sfp_lock_release (); __sfp_lock_release ();
return NULL; return NULL;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1990, 2006 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms are permitted * Redistribution and use in source and binary forms are permitted
@ -28,7 +28,7 @@ ANSI_SYNOPSIS
#include <stdio.h> #include <stdio.h>
FILE *freopen64(const char *<[file]>, const char *<[mode]>, FILE *freopen64(const char *<[file]>, const char *<[mode]>,
FILE *<[fp]>); FILE *<[fp]>);
FILE *_freopen64_r(struct _reent *<[ptr]>, const char *<[file]>, FILE *_freopen64_r(struct _reent *<[ptr]>, const char *<[file]>,
const char *<[mode]>, FILE *<[fp]>); const char *<[mode]>, FILE *<[fp]>);
TRAD_SYNOPSIS TRAD_SYNOPSIS
@ -78,7 +78,7 @@ Supporting OS subroutines required: <<close>>, <<fstat>>, <<isatty>>,
#include <fcntl.h> #include <fcntl.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/lock.h> #include <sys/lock.h>
#include "local64.h" #include "local.h"
/* /*
* Re-direct an existing, open (probably) file to some other file. * Re-direct an existing, open (probably) file to some other file.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1990, 2007 The Regents of the University of California. * Copyright (c) 1990 The Regents of the University of California.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms are permitted * Redistribution and use in source and binary forms are permitted
@ -27,7 +27,7 @@ INDEX
ANSI_SYNOPSIS ANSI_SYNOPSIS
#include <stdio.h> #include <stdio.h>
int fseeko64(FILE *<[fp]>, _off64_t <[offset]>, int <[whence]>) int fseeko64(FILE *<[fp]>, _off64_t <[offset]>, int <[whence]>)
int _fseeko64_r (struct _reent *<[ptr]>, FILE *<[fp]>, int _fseeko64_r (struct _reent *<[ptr]>, FILE *<[fp]>,
_off64_t <[offset]>, int <[whence]>) _off64_t <[offset]>, int <[whence]>)
TRAD_SYNOPSIS TRAD_SYNOPSIS
#include <stdio.h> #include <stdio.h>
@ -49,8 +49,8 @@ of the file your program has already read. Many of the <<stdio>> functions
depend on this position, and many change it as a side effect. depend on this position, and many change it as a side effect.
You can use <<fseeko64>> to set the position for the file identified by You can use <<fseeko64>> to set the position for the file identified by
<[fp]> that was opened via <<fopen64>>. The value of <[offset]> determines <[fp]> that was opened via <<fopen64>>. The value of <[offset]> determines
the new position, in one of three ways selected by the value of <[whence]> the new position, in one of three ways selected by the value of <[whence]>
(defined as macros in `<<stdio.h>>'): (defined as macros in `<<stdio.h>>'):
<<SEEK_SET>>---<[offset]> is the absolute file position (an offset <<SEEK_SET>>---<[offset]> is the absolute file position (an offset
@ -69,7 +69,7 @@ RETURNS
<<fseeko64>> returns <<0>> when successful. On failure, the <<fseeko64>> returns <<0>> when successful. On failure, the
result is <<EOF>>. The reason for failure is indicated in <<errno>>: result is <<EOF>>. The reason for failure is indicated in <<errno>>:
either <<ESPIPE>> (the stream identified by <[fp]> doesn't support either <<ESPIPE>> (the stream identified by <[fp]> doesn't support
repositioning or wasn't opened via <<fopen64>>) or <<EINVAL>> repositioning or wasn't opened via <<fopen64>>) or <<EINVAL>>
(invalid file position). (invalid file position).
PORTABILITY PORTABILITY
@ -86,7 +86,7 @@ Supporting OS subroutines required: <<close>>, <<fstat64>>, <<isatty>>,
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "local64.h" #include "local.h"
#define POS_ERR (-(_fpos64_t)1) #define POS_ERR (-(_fpos64_t)1)

View File

@ -60,7 +60,7 @@ An error occurs if the <[fp]> was not opened via <<fopen64>>.
RETURNS RETURNS
<<ftello64>> returns the file position, if possible. If it cannot do <<ftello64>> returns the file position, if possible. If it cannot do
this, it returns <<-1>>. Failure occurs on streams that do not support this, it returns <<-1>>. Failure occurs on streams that do not support
positioning or not opened via <<fopen64>>; the global <<errno>> indicates positioning or not opened via <<fopen64>>; the global <<errno>> indicates
this condition with the value <<ESPIPE>>. this condition with the value <<ESPIPE>>.
PORTABILITY PORTABILITY
@ -80,7 +80,7 @@ static char sccsid[] = "%W% (Berkeley) %G%";
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
#include "local64.h" #include "local.h"
#ifdef __LARGE64_FILES #ifdef __LARGE64_FILES

View File

@ -1,16 +0,0 @@
/*
* Information local to this implementation of stdio64,
* in particular, macros and private variables.
*/
#include "local.h"
#ifdef __LARGE64_FILES
extern _fpos64_t _EXFUN(__sseek64,(void *, _fpos64_t, int));
extern _fpos64_t _EXFUN(__sseek64_r,(struct _reent *, 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));
extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite64_r,(struct _reent *, void *,
char const *, int));
#endif