From 3f5e3f5d066dcffb80af48ae2cf35a01a85a8f10 Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Fri, 6 Jul 2018 16:53:48 +0200 Subject: libio: Implement internal function __libc_readline_unlocked This is a variant of fgets which fails with ERANGE if the buffer is too small, and the buffer length is given as an argument of type size_t. This function will be useful for implementing NSS file reading operations. Compared to a direct implementation using the public API, it avoids an lseek system call in case the line terminator can be found in the internal read buffer. --- libio/ftello.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'libio/ftello.c') diff --git a/libio/ftello.c b/libio/ftello.c index 5405821..5a3caf4 100644 --- a/libio/ftello.c +++ b/libio/ftello.c @@ -24,12 +24,15 @@ This exception applies to code released by its copyright holders in files containing the exception. */ +/* We need to disable the redirect for __ftello64 for the alias + definitions below to work. */ +#define __ftello64 __ftello64_disable + #include #include #include #include - off_t __ftello (FILE *fp) { @@ -61,4 +64,7 @@ weak_alias (__ftello, ftello) #ifdef __OFF_T_MATCHES_OFF64_T weak_alias (__ftello, ftello64) +# undef __ftello64 +strong_alias (__ftello, __ftello64) +libc_hidden_ver (__ftello, __ftello64) #endif -- cgit v1.1