2002-11-05  Ulrich Drepper  <drepper@redhat.com>

	* libio/ioseekoff.c: Remove INTDEF.  Define _IO_seekoff_unlocked.  Same
	as old code without locking.  _IO_seekoff calls this function after
	locking the stream.
	* libio/ioseekpos.c: Likewise for _IO_seekpos.
	* libio/libioP.h: Replace _IO_seekoff_internal and _IO_seekpos_internal
	prototypes with _IO_seekoff_unlocked and _IO_seekpos_unlocked
	prototypes.
	* libio/iolibio.h (_IO_fseek): Call _IO_seekoff_unlocked instead
	of _IO_seekoff_internal.
	(_IO_rewind): Likewise.
	* libio/ioftell.c: Likewise.
	* libio/ftello.c: Likewise.
	* libio/ftello64.c: Likewise.
	* libio/iofgetpos.c: Likewise.
	* libio/iofgetpos64.c: Likewise.
	* libio/oldiofgetpos.c: Likewise.
	* libio/oldiofgetpos64.c: Likewise.
	* libio/iofsetpos.c: Call _IO_seekpos_unlocked instead of
	_IO_seekpos_internal.
	* libio/iofsetpos64.c: Likewise.
	* libio/oldiofsetpos.c: Likewise.
	* libio/oldiofsetpos64.c: Likewise.

	* libio/wfileops.c (_IO_wfile_seekoff): Don't modify _offset and
	_wide_data->_IO_read_end if adjustment can be made in the current
	buffer.
This commit is contained in:
Ulrich Drepper 2002-11-05 08:43:05 +00:00
parent 2fdeb7ca4f
commit 52a16e5801
17 changed files with 84 additions and 32 deletions

View File

@ -1,3 +1,28 @@
2002-11-05 Ulrich Drepper <drepper@redhat.com>
* libio/ioseekoff.c: Remove INTDEF. Define _IO_seekoff_unlocked. Same
as old code without locking. _IO_seekoff calls this function after
locking the stream.
* libio/ioseekpos.c: Likewise for _IO_seekpos.
* libio/libioP.h: Replace _IO_seekoff_internal and _IO_seekpos_internal
prototypes with _IO_seekoff_unlocked and _IO_seekpos_unlocked
prototypes.
* libio/iolibio.h (_IO_fseek): Call _IO_seekoff_unlocked instead
of _IO_seekoff_internal.
(_IO_rewind): Likewise.
* libio/ioftell.c: Likewise.
* libio/ftello.c: Likewise.
* libio/ftello64.c: Likewise.
* libio/iofgetpos.c: Likewise.
* libio/iofgetpos64.c: Likewise.
* libio/oldiofgetpos.c: Likewise.
* libio/oldiofgetpos64.c: Likewise.
* libio/iofsetpos.c: Call _IO_seekpos_unlocked instead of
_IO_seekpos_internal.
* libio/iofsetpos64.c: Likewise.
* libio/oldiofsetpos.c: Likewise.
* libio/oldiofsetpos64.c: Likewise.
2002-11-04 Roland McGrath <roland@redhat.com>
* sysdeps/unix/sysv/linux/powerpc/chown.c: Use INLINE_SYSCALL macro.
@ -55,6 +80,10 @@
2002-11-04 Ulrich Drepper <drepper@redhat.com>
* libio/wfileops.c (_IO_wfile_seekoff): Don't modify _offset and
_wide_data->_IO_read_end if adjustment can be made in the current
buffer.
* sysdeps/unix/sysv/linux/fexecve.c: New file.
* libio/bug-wfflush.c (do_test): Using fseek is not allowed when

4
NEWS
View File

@ -1,4 +1,4 @@
GNU C Library NEWS -- history of user-visible changes. 2002-10-13
GNU C Library NEWS -- history of user-visible changes. 2002-11-5
Copyright (C) 1992-2001, 2002 Free Software Foundation, Inc.
See the end for copying conditions.
@ -15,6 +15,8 @@ Version 2.3.2
* The new dynamic string token $LIB is expanded in shared library names.
This normally expands to lib, but on some 64-bit platforms to lib64 instead.
* fexecve is implemented on Linux.
Version 2.3

View File

@ -39,7 +39,7 @@ ftello (fp)
CHECK_FILE (fp, -1L);
_IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, fp);
_IO_flockfile (fp);
pos = INTUSE(_IO_seekoff) (fp, 0, _IO_seek_cur, 0);
pos = _IO_seekoff_unlocked (fp, 0, _IO_seek_cur, 0);
if (_IO_in_backup (fp))
{
if (fp->_mode <= 0)

View File

@ -40,7 +40,7 @@ ftello64 (fp)
CHECK_FILE (fp, -1L);
_IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, fp);
_IO_flockfile (fp);
pos = INTUSE(_IO_seekoff) (fp, 0, _IO_seek_cur, 0);
pos = _IO_seekoff_unlocked (fp, 0, _IO_seek_cur, 0);
if (_IO_in_backup (fp))
{
if (fp->_mode <= 0)

View File

@ -40,7 +40,7 @@ _IO_new_fgetpos (fp, posp)
CHECK_FILE (fp, EOF);
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
pos = INTUSE(_IO_seekoff) (fp, 0, _IO_seek_cur, 0);
pos = _IO_seekoff_unlocked (fp, 0, _IO_seek_cur, 0);
if (_IO_in_backup (fp))
{
if (fp->_mode <= 0)

View File

@ -40,7 +40,7 @@ _IO_new_fgetpos64 (fp, posp)
CHECK_FILE (fp, EOF);
_IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, fp);
_IO_flockfile (fp);
pos = INTUSE(_IO_seekoff) (fp, 0, _IO_seek_cur, 0);
pos = _IO_seekoff_unlocked (fp, 0, _IO_seek_cur, 0);
if (_IO_in_backup (fp))
{
if (fp->_mode <= 0)

View File

@ -38,7 +38,7 @@ _IO_new_fsetpos (fp, posp)
CHECK_FILE (fp, EOF);
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
if (INTUSE(_IO_seekpos) (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT)
if (_IO_seekpos_unlocked (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT)
== _IO_pos_BAD)
{
/* ANSI explicitly requires setting errno to a positive value on

View File

@ -39,7 +39,7 @@ _IO_new_fsetpos64 (fp, posp)
CHECK_FILE (fp, EOF);
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
if (INTUSE(_IO_seekpos) (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT)
if (_IO_seekpos_unlocked (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT)
== _IO_pos_BAD)
{
/* ANSI explicitly requires setting errno to a positive value on

View File

@ -38,7 +38,7 @@ _IO_ftell (fp)
CHECK_FILE (fp, -1L);
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
pos = INTUSE(_IO_seekoff) (fp, 0, _IO_seek_cur, 0);
pos = _IO_seekoff_unlocked (fp, 0, _IO_seek_cur, 0);
if (_IO_in_backup (fp))
{
if (fp->_vtable_offset != 0 || fp->_mode <= 0)

View File

@ -56,10 +56,10 @@ extern int _IO_obstack_printf __P ((struct obstack *, const char *, ...));
#endif
#define _IO_clearerr(FP) ((FP)->_flags &= ~(_IO_ERR_SEEN|_IO_EOF_SEEN))
#define _IO_fseek(__fp, __offset, __whence) \
(INTUSE(_IO_seekoff)(__fp, __offset, __whence, _IOS_INPUT|_IOS_OUTPUT) \
(_IO_seekoff_unlocked (__fp, __offset, __whence, _IOS_INPUT|_IOS_OUTPUT) \
== _IO_pos_BAD ? EOF : 0)
#define _IO_rewind(FILE) \
(void)INTUSE(_IO_seekoff)(FILE, 0, 0, _IOS_INPUT|_IOS_OUTPUT)
(void) _IO_seekoff_unlocked (FILE, 0, 0, _IOS_INPUT|_IOS_OUTPUT)
#define _IO_vprintf(FORMAT, ARGS) \
INTUSE(_IO_vfprintf) (_IO_stdout, FORMAT, ARGS)
#define _IO_freopen(FILENAME, MODE, FP) \

View File

@ -36,14 +36,12 @@ extern int errno;
#endif
_IO_off64_t
_IO_seekoff (fp, offset, dir, mode)
_IO_seekoff_unlocked (fp, offset, dir, mode)
_IO_FILE *fp;
_IO_off64_t offset;
int dir;
int mode;
{
_IO_off64_t retval;
if (dir != _IO_seek_cur && dir != _IO_seek_set && dir != _IO_seek_end)
{
__set_errno (EINVAL);
@ -53,9 +51,6 @@ _IO_seekoff (fp, offset, dir, mode)
/* If we have a backup buffer, get rid of it, since the __seekoff
callback may not know to do the right thing about it.
This may be over-kill, but it'll do for now. TODO */
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
if (mode != 0 && ((_IO_fwide (fp, 0) < 0 && _IO_have_backup (fp))
|| (_IO_fwide (fp, 0) > 0 && _IO_have_wbackup (fp))))
{
@ -72,10 +67,25 @@ _IO_seekoff (fp, offset, dir, mode)
INTUSE(_IO_free_wbackup_area) (fp);
}
retval = _IO_SEEKOFF (fp, offset, dir, mode);
return _IO_SEEKOFF (fp, offset, dir, mode);
}
_IO_off64_t
_IO_seekoff (fp, offset, dir, mode)
_IO_FILE *fp;
_IO_off64_t offset;
int dir;
int mode;
{
_IO_off64_t retval;
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
retval = _IO_seekoff_unlocked (fp, offset, dir, mode);
_IO_funlockfile (fp);
_IO_cleanup_region_end (0);
return retval;
}
INTDEF(_IO_seekoff)

View File

@ -28,19 +28,14 @@
#include <libioP.h>
_IO_off64_t
_IO_seekpos (fp, pos, mode)
_IO_seekpos_unlocked (fp, pos, mode)
_IO_FILE *fp;
_IO_off64_t pos;
int mode;
{
_IO_off64_t retval;
/* If we have a backup buffer, get rid of it, since the __seekoff
callback may not know to do the right thing about it.
This may be over-kill, but it'll do for now. TODO */
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
if (_IO_fwide (fp, 0) <= 0)
{
if (_IO_have_backup (fp))
@ -52,10 +47,24 @@ _IO_seekpos (fp, pos, mode)
INTUSE(_IO_free_wbackup_area) (fp);
}
retval = _IO_SEEKPOS (fp, pos, mode);
return _IO_SEEKPOS (fp, pos, mode);
}
_IO_off64_t
_IO_seekpos (fp, pos, mode)
_IO_FILE *fp;
_IO_off64_t pos;
int mode;
{
_IO_off64_t retval;
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
retval = _IO_seekpos_unlocked (fp, pos, mode);
_IO_funlockfile (fp);
_IO_cleanup_region_end (0);
return retval;
}
INTDEF(_IO_seekpos)

View File

@ -730,8 +730,10 @@ extern int _IO_vfprintf_internal (_IO_FILE *__restrict, const char *__restrict,
_IO_va_list);
extern void _IO_doallocbuf_internal __P ((_IO_FILE *));
extern void _IO_wsetb_internal __P ((_IO_FILE *, wchar_t *, wchar_t *, int));
extern _IO_off64_t _IO_seekoff_internal (_IO_FILE *, _IO_off64_t, int, int);
extern _IO_off64_t _IO_seekpos_internal (_IO_FILE *, _IO_off64_t, int);
extern _IO_off64_t _IO_seekoff_unlocked (_IO_FILE *, _IO_off64_t, int, int)
attribute_hidden;
extern _IO_off64_t _IO_seekpos_unlocked (_IO_FILE *, _IO_off64_t, int)
attribute_hidden;
extern int _IO_putc_internal (int __c, _IO_FILE *__fp);
extern void _IO_init_internal __P ((_IO_FILE *, int));
extern void _IO_un_link_internal __P ((struct _IO_FILE_plus *));

View File

@ -40,7 +40,7 @@ _IO_old_fgetpos (fp, posp)
CHECK_FILE (fp, EOF);
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
pos = INTUSE(_IO_seekoff) (fp, 0, _IO_seek_cur, 0);
pos = _IO_seekoff_unlocked (fp, 0, _IO_seek_cur, 0);
if (_IO_in_backup (fp))
pos -= fp->_IO_save_end - fp->_IO_save_base;
_IO_funlockfile (fp);

View File

@ -41,7 +41,7 @@ _IO_old_fgetpos64 (fp, posp)
CHECK_FILE (fp, EOF);
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
pos = INTUSE(_IO_seekoff) (fp, 0, _IO_seek_cur, 0);
pos = _IO_seekoff_unlocked (fp, 0, _IO_seek_cur, 0);
if (_IO_in_backup (fp))
pos -= fp->_IO_save_end - fp->_IO_save_base;
_IO_funlockfile (fp);

View File

@ -39,7 +39,7 @@ _IO_old_fsetpos (fp, posp)
CHECK_FILE (fp, EOF);
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
if (INTUSE(_IO_seekpos) (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT)
if (_IO_seekpos_unlocked (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT)
== _IO_pos_BAD)
{
/* ANSI explicitly requires setting errno to a positive value on

View File

@ -41,7 +41,7 @@ _IO_old_fsetpos64 (fp, posp)
CHECK_FILE (fp, EOF);
_IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp);
_IO_flockfile (fp);
if (INTUSE(_IO_seekpos) (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT)
if (_IO_seekpos_unlocked (fp, posp->__pos, _IOS_INPUT|_IOS_OUTPUT)
== _IO_pos_BAD)
{
/* ANSI explicitly requires setting errno to a positive value on