diff options
Diffstat (limited to 'libio')
-rw-r--r-- | libio/ftello.c | 2 | ||||
-rw-r--r-- | libio/ftello64.c | 2 | ||||
-rw-r--r-- | libio/iofgetpos.c | 2 | ||||
-rw-r--r-- | libio/iofgetpos64.c | 2 | ||||
-rw-r--r-- | libio/iofsetpos.c | 2 | ||||
-rw-r--r-- | libio/iofsetpos64.c | 2 | ||||
-rw-r--r-- | libio/ioftell.c | 2 | ||||
-rw-r--r-- | libio/iolibio.h | 4 | ||||
-rw-r--r-- | libio/ioseekoff.c | 26 | ||||
-rw-r--r-- | libio/ioseekpos.c | 25 | ||||
-rw-r--r-- | libio/libioP.h | 6 | ||||
-rw-r--r-- | libio/oldiofgetpos.c | 2 | ||||
-rw-r--r-- | libio/oldiofgetpos64.c | 2 | ||||
-rw-r--r-- | libio/oldiofsetpos.c | 2 | ||||
-rw-r--r-- | libio/oldiofsetpos64.c | 2 |
15 files changed, 52 insertions, 31 deletions
diff --git a/libio/ftello.c b/libio/ftello.c index 94a2541b25..e14866408f 100644 --- a/libio/ftello.c +++ b/libio/ftello.c @@ -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) diff --git a/libio/ftello64.c b/libio/ftello64.c index bbf77679f3..b2da11d133 100644 --- a/libio/ftello64.c +++ b/libio/ftello64.c @@ -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) diff --git a/libio/iofgetpos.c b/libio/iofgetpos.c index 4b50898a07..0c80b2fae5 100644 --- a/libio/iofgetpos.c +++ b/libio/iofgetpos.c @@ -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) diff --git a/libio/iofgetpos64.c b/libio/iofgetpos64.c index 525a75c7ef..3ad7e11cd0 100644 --- a/libio/iofgetpos64.c +++ b/libio/iofgetpos64.c @@ -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) diff --git a/libio/iofsetpos.c b/libio/iofsetpos.c index 3c3e61db57..f3821e2fa5 100644 --- a/libio/iofsetpos.c +++ b/libio/iofsetpos.c @@ -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 diff --git a/libio/iofsetpos64.c b/libio/iofsetpos64.c index f8c5374d17..4746d720c3 100644 --- a/libio/iofsetpos64.c +++ b/libio/iofsetpos64.c @@ -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 diff --git a/libio/ioftell.c b/libio/ioftell.c index 2a389c37be..fd5da6b618 100644 --- a/libio/ioftell.c +++ b/libio/ioftell.c @@ -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) diff --git a/libio/iolibio.h b/libio/iolibio.h index 80fb527d88..db71be25c8 100644 --- a/libio/iolibio.h +++ b/libio/iolibio.h @@ -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) \ diff --git a/libio/ioseekoff.c b/libio/ioseekoff.c index eff6d3874d..09c138869e 100644 --- a/libio/ioseekoff.c +++ b/libio/ioseekoff.c @@ -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) diff --git a/libio/ioseekpos.c b/libio/ioseekpos.c index 8aa151a41e..37d32af340 100644 --- a/libio/ioseekpos.c +++ b/libio/ioseekpos.c @@ -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) diff --git a/libio/libioP.h b/libio/libioP.h index 9cdfebceb1..105ffccecc 100644 --- a/libio/libioP.h +++ b/libio/libioP.h @@ -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 *)); diff --git a/libio/oldiofgetpos.c b/libio/oldiofgetpos.c index 0d6d1878fd..596c40599f 100644 --- a/libio/oldiofgetpos.c +++ b/libio/oldiofgetpos.c @@ -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); diff --git a/libio/oldiofgetpos64.c b/libio/oldiofgetpos64.c index b7fecbd426..4a38c38e86 100644 --- a/libio/oldiofgetpos64.c +++ b/libio/oldiofgetpos64.c @@ -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); diff --git a/libio/oldiofsetpos.c b/libio/oldiofsetpos.c index 39adc5f5a3..ce3bb12363 100644 --- a/libio/oldiofsetpos.c +++ b/libio/oldiofsetpos.c @@ -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 diff --git a/libio/oldiofsetpos64.c b/libio/oldiofsetpos64.c index 88071339e3..834f154c21 100644 --- a/libio/oldiofsetpos64.c +++ b/libio/oldiofsetpos64.c @@ -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 |