2015-01-02 16:28:19 +00:00
|
|
|
/* Copyright (C) 1993-2015 Free Software Foundation, Inc.
|
2001-07-06 04:58:11 +00:00
|
|
|
This file is part of the GNU C Library.
|
1998-07-04 10:39:13 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1998-07-04 10:39:13 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
1998-07-04 10:39:13 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:58:11 +00:00
|
|
|
Lesser General Public License for more details.
|
1998-07-04 10:39:13 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
2012-02-09 23:18:22 +00:00
|
|
|
License along with the GNU C Library; if not, see
|
|
|
|
<http://www.gnu.org/licenses/>.
|
1998-07-04 10:39:13 +00:00
|
|
|
|
2001-07-06 04:58:11 +00:00
|
|
|
As a special exception, if you link the code in this file with
|
|
|
|
files compiled with a GNU compiler to produce an executable,
|
|
|
|
that does not cause the resulting executable to be covered by
|
|
|
|
the GNU Lesser General Public License. This exception does not
|
|
|
|
however invalidate any other reasons why the executable file
|
|
|
|
might be covered by the GNU Lesser General Public License.
|
|
|
|
This exception applies to code released by its copyright holders
|
|
|
|
in files containing the exception. */
|
1998-07-04 10:39:13 +00:00
|
|
|
|
|
|
|
#include "libioP.h"
|
1998-07-06 17:09:00 +00:00
|
|
|
#include <stdio.h>
|
1998-07-04 10:39:13 +00:00
|
|
|
|
1998-11-12 18:03:43 +00:00
|
|
|
#undef fread_unlocked
|
|
|
|
|
1998-07-04 10:39:13 +00:00
|
|
|
_IO_size_t
|
Fix tzfile.c namespace (bug 17583).
tzfile.c is brought in by various ISO C functions, but calls fileno,
fread_unlocked and ftello, which are not ISO C functions. This patch
adds names __fileno, __fread_unlocked and __ftello for those
functions, making tzfile.c use those new names.
Note: there are various uses of fileno elsewhere in glibc that I
didn't change, although it may turn out that some of those also need
to use __fileno.
Tested for x86_64 with the glibc testsuite. Changed line numbers in
tzfile.c cause changes in assertions, and for some reason this ends up
with different instruction choice and register allocation, affecting
the size of __tzfile_read and so making comparison of disassembly for
libc.so problematic.
[BZ #17583]
* libio/fileno.c (fileno): Rename to __fileno and define as weak
alias of __fileno. Use libc_hidden_weak.
(__fileno): Use libc_hidden_def.
[weak_alias] (fileno_unlocked): Define as weak alias of __fileno.
* libio/ftello.c (ftello): Rename to __ftello and define as weak
alias of __ftello.
[__OFF_T_MATCHES_OFF64_T] (ftello64): Define as weak alias of
__ftello.
* libio/iofread.c [weak_alias && !_IO_MTSAFE_IO]
(__fread_unlocked): Define as strong alias of _IO_fread. Use
libc_hidden_def.
(fread_unlocked): Don't use libc_hidden_ver.
* libio/iofread_u.c (fread_unlocked): Rename to __fread_unlocked
and define as weak alias of __fread_unlocked. Don't use
libc_hidden_def.
(__fread_unlocked): Use libc_hidden_def.
* include/stdio.h (__fileno): Declare. Use libc_hidden_proto.
(ftello): Don't use libc_hidden_proto.
(__ftello): Declare. Use libc_hidden_proto.
(fread_unlocked): Don't use libc_hidden_proto.
(__fread_unlocked): Declare. Use libc_hidden_proto.
* time/tzfile.c (__tzfile_read): Use __fileno, __fread_unlocked
and __ftello instead of fileno, fread_unlocked and ftello.
2014-11-12 16:22:51 +00:00
|
|
|
__fread_unlocked (buf, size, count, fp)
|
1998-07-04 10:39:13 +00:00
|
|
|
void *buf;
|
|
|
|
_IO_size_t size;
|
|
|
|
_IO_size_t count;
|
|
|
|
_IO_FILE *fp;
|
|
|
|
{
|
1998-11-12 18:03:43 +00:00
|
|
|
_IO_size_t bytes_requested = size * count;
|
1998-07-04 10:39:13 +00:00
|
|
|
_IO_size_t bytes_read;
|
|
|
|
CHECK_FILE (fp, 0);
|
|
|
|
if (bytes_requested == 0)
|
|
|
|
return 0;
|
2012-05-23 11:33:15 +00:00
|
|
|
bytes_read = _IO_sgetn (fp, (char *) buf, bytes_requested);
|
1998-07-04 10:39:13 +00:00
|
|
|
return bytes_requested == bytes_read ? count : bytes_read / size;
|
|
|
|
}
|
Fix tzfile.c namespace (bug 17583).
tzfile.c is brought in by various ISO C functions, but calls fileno,
fread_unlocked and ftello, which are not ISO C functions. This patch
adds names __fileno, __fread_unlocked and __ftello for those
functions, making tzfile.c use those new names.
Note: there are various uses of fileno elsewhere in glibc that I
didn't change, although it may turn out that some of those also need
to use __fileno.
Tested for x86_64 with the glibc testsuite. Changed line numbers in
tzfile.c cause changes in assertions, and for some reason this ends up
with different instruction choice and register allocation, affecting
the size of __tzfile_read and so making comparison of disassembly for
libc.so problematic.
[BZ #17583]
* libio/fileno.c (fileno): Rename to __fileno and define as weak
alias of __fileno. Use libc_hidden_weak.
(__fileno): Use libc_hidden_def.
[weak_alias] (fileno_unlocked): Define as weak alias of __fileno.
* libio/ftello.c (ftello): Rename to __ftello and define as weak
alias of __ftello.
[__OFF_T_MATCHES_OFF64_T] (ftello64): Define as weak alias of
__ftello.
* libio/iofread.c [weak_alias && !_IO_MTSAFE_IO]
(__fread_unlocked): Define as strong alias of _IO_fread. Use
libc_hidden_def.
(fread_unlocked): Don't use libc_hidden_ver.
* libio/iofread_u.c (fread_unlocked): Rename to __fread_unlocked
and define as weak alias of __fread_unlocked. Don't use
libc_hidden_def.
(__fread_unlocked): Use libc_hidden_def.
* include/stdio.h (__fileno): Declare. Use libc_hidden_proto.
(ftello): Don't use libc_hidden_proto.
(__ftello): Declare. Use libc_hidden_proto.
(fread_unlocked): Don't use libc_hidden_proto.
(__fread_unlocked): Declare. Use libc_hidden_proto.
* time/tzfile.c (__tzfile_read): Use __fileno, __fread_unlocked
and __ftello instead of fileno, fread_unlocked and ftello.
2014-11-12 16:22:51 +00:00
|
|
|
libc_hidden_def (__fread_unlocked)
|
|
|
|
weak_alias (__fread_unlocked, fread_unlocked)
|