diff options
-rw-r--r-- | libc/bionic/tmpfile.cpp | 1 | ||||
-rw-r--r-- | libc/include/stdio.h | 11 | ||||
-rw-r--r-- | libc/libc.arm.brillo.map | 3 | ||||
-rw-r--r-- | libc/libc.arm.map | 3 | ||||
-rw-r--r-- | libc/libc.arm64.map | 3 | ||||
-rw-r--r-- | libc/libc.map.txt | 3 | ||||
-rw-r--r-- | libc/libc.mips.brillo.map | 3 | ||||
-rw-r--r-- | libc/libc.mips.map | 3 | ||||
-rw-r--r-- | libc/libc.mips64.map | 3 | ||||
-rw-r--r-- | libc/libc.x86.brillo.map | 3 | ||||
-rw-r--r-- | libc/libc.x86.map | 3 | ||||
-rw-r--r-- | libc/libc.x86_64.map | 3 | ||||
-rw-r--r-- | libc/stdio/stdio.cpp | 2 | ||||
-rwxr-xr-x | libc/tools/check-symbols-glibc.py | 1 | ||||
-rw-r--r-- | tests/stdio_test.cpp | 14 |
15 files changed, 55 insertions, 4 deletions
diff --git a/libc/bionic/tmpfile.cpp b/libc/bionic/tmpfile.cpp index 602d40752..dc142a94e 100644 --- a/libc/bionic/tmpfile.cpp +++ b/libc/bionic/tmpfile.cpp @@ -112,3 +112,4 @@ FILE* tmpfile() { } return fp; } +__strong_alias(tmpfile64, tmpfile); diff --git a/libc/include/stdio.h b/libc/include/stdio.h index b61809133..623995b29 100644 --- a/libc/include/stdio.h +++ b/libc/include/stdio.h @@ -109,14 +109,11 @@ int ferror(FILE *); int fflush(FILE *); int fgetc(FILE *); char *fgets(char * __restrict, int, FILE * __restrict); -FILE *fopen(const char * __restrict , const char * __restrict); int fprintf(FILE * __restrict , const char * __restrict, ...) __printflike(2, 3); int fputc(int, FILE *); int fputs(const char * __restrict, FILE * __restrict); size_t fread(void * __restrict, size_t, size_t, FILE * __restrict); -FILE *freopen(const char * __restrict, const char * __restrict, - FILE * __restrict); int fscanf(FILE * __restrict, const char * __restrict, ...) __scanflike(2, 3); size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict); @@ -140,7 +137,6 @@ void setbuf(FILE * __restrict, char * __restrict); int setvbuf(FILE * __restrict, char * __restrict, int, size_t); int sscanf(const char * __restrict, const char * __restrict, ...) __scanflike(2, 3); -FILE *tmpfile(void); int ungetc(int, FILE *); int vfprintf(FILE * __restrict, const char * __restrict, __va_list) __printflike(2, 0); @@ -208,6 +204,13 @@ FILE* funopen64(const void*, int (*)(void*)); #endif +FILE* fopen(const char* __restrict, const char* __restrict); +FILE* fopen64(const char* __restrict, const char* __restrict); +FILE* freopen(const char* __restrict, const char* __restrict, FILE* __restrict); +FILE* freopen64(const char* __restrict, const char* __restrict, FILE* __restrict); +FILE* tmpfile(void); +FILE* tmpfile64(void); + #if __ISO_C_VISIBLE >= 1999 || __BSD_VISIBLE int snprintf(char * __restrict, size_t, const char * __restrict, ...) __printflike(3, 4); diff --git a/libc/libc.arm.brillo.map b/libc/libc.arm.brillo.map index 84cd9d1c2..9251de22d 100644 --- a/libc/libc.arm.brillo.map +++ b/libc/libc.arm.brillo.map @@ -1226,7 +1226,9 @@ LIBC_N { __write_chk; fgetpos64; fileno_unlocked; + fopen64; freeifaddrs; + freopen64; fseeko64; fsetpos64; ftello64; @@ -1258,6 +1260,7 @@ LIBC_N { scandirat; scandirat64; strchrnul; + tmpfile64; } LIBC; LIBC_PRIVATE { diff --git a/libc/libc.arm.map b/libc/libc.arm.map index 001476e8c..f5ddfd3e3 100644 --- a/libc/libc.arm.map +++ b/libc/libc.arm.map @@ -1226,7 +1226,9 @@ LIBC_N { __write_chk; fgetpos64; fileno_unlocked; + fopen64; freeifaddrs; + freopen64; fseeko64; fsetpos64; ftello64; @@ -1258,6 +1260,7 @@ LIBC_N { scandirat; scandirat64; strchrnul; + tmpfile64; } LIBC; LIBC_PRIVATE { diff --git a/libc/libc.arm64.map b/libc/libc.arm64.map index 14f90ad48..271460f80 100644 --- a/libc/libc.arm64.map +++ b/libc/libc.arm64.map @@ -1149,7 +1149,9 @@ LIBC_N { __write_chk; fgetpos64; fileno_unlocked; + fopen64; freeifaddrs; + freopen64; fseeko64; fsetpos64; ftello64; @@ -1180,6 +1182,7 @@ LIBC_N { scandirat; scandirat64; strchrnul; + tmpfile64; } LIBC; LIBC_PRIVATE { diff --git a/libc/libc.map.txt b/libc/libc.map.txt index e2aede554..c859d8143 100644 --- a/libc/libc.map.txt +++ b/libc/libc.map.txt @@ -1252,7 +1252,9 @@ LIBC_N { __write_chk; fgetpos64; fileno_unlocked; + fopen64; freeifaddrs; + freopen64; fseeko64; fsetpos64; ftello64; @@ -1284,6 +1286,7 @@ LIBC_N { scandirat; scandirat64; strchrnul; + tmpfile64; } LIBC; LIBC_PRIVATE { diff --git a/libc/libc.mips.brillo.map b/libc/libc.mips.brillo.map index ee33d0e92..e5376bec6 100644 --- a/libc/libc.mips.brillo.map +++ b/libc/libc.mips.brillo.map @@ -1210,7 +1210,9 @@ LIBC_N { __write_chk; fgetpos64; fileno_unlocked; + fopen64; freeifaddrs; + freopen64; fseeko64; fsetpos64; ftello64; @@ -1242,6 +1244,7 @@ LIBC_N { scandirat; scandirat64; strchrnul; + tmpfile64; } LIBC; LIBC_PRIVATE { diff --git a/libc/libc.mips.map b/libc/libc.mips.map index c65846044..4902f57c2 100644 --- a/libc/libc.mips.map +++ b/libc/libc.mips.map @@ -1210,7 +1210,9 @@ LIBC_N { __write_chk; fgetpos64; fileno_unlocked; + fopen64; freeifaddrs; + freopen64; fseeko64; fsetpos64; ftello64; @@ -1242,6 +1244,7 @@ LIBC_N { scandirat; scandirat64; strchrnul; + tmpfile64; } LIBC; LIBC_PRIVATE { diff --git a/libc/libc.mips64.map b/libc/libc.mips64.map index 14f90ad48..271460f80 100644 --- a/libc/libc.mips64.map +++ b/libc/libc.mips64.map @@ -1149,7 +1149,9 @@ LIBC_N { __write_chk; fgetpos64; fileno_unlocked; + fopen64; freeifaddrs; + freopen64; fseeko64; fsetpos64; ftello64; @@ -1180,6 +1182,7 @@ LIBC_N { scandirat; scandirat64; strchrnul; + tmpfile64; } LIBC; LIBC_PRIVATE { diff --git a/libc/libc.x86.brillo.map b/libc/libc.x86.brillo.map index a72fa61cd..bbf9d57d3 100644 --- a/libc/libc.x86.brillo.map +++ b/libc/libc.x86.brillo.map @@ -1209,7 +1209,9 @@ LIBC_N { __write_chk; fgetpos64; fileno_unlocked; + fopen64; freeifaddrs; + freopen64; fseeko64; fsetpos64; ftello64; @@ -1241,6 +1243,7 @@ LIBC_N { scandirat; scandirat64; strchrnul; + tmpfile64; } LIBC; LIBC_PRIVATE { diff --git a/libc/libc.x86.map b/libc/libc.x86.map index 5a7a5047a..fb0f109fa 100644 --- a/libc/libc.x86.map +++ b/libc/libc.x86.map @@ -1209,7 +1209,9 @@ LIBC_N { __write_chk; fgetpos64; fileno_unlocked; + fopen64; freeifaddrs; + freopen64; fseeko64; fsetpos64; ftello64; @@ -1241,6 +1243,7 @@ LIBC_N { scandirat; scandirat64; strchrnul; + tmpfile64; } LIBC; LIBC_PRIVATE { diff --git a/libc/libc.x86_64.map b/libc/libc.x86_64.map index 14f90ad48..271460f80 100644 --- a/libc/libc.x86_64.map +++ b/libc/libc.x86_64.map @@ -1149,7 +1149,9 @@ LIBC_N { __write_chk; fgetpos64; fileno_unlocked; + fopen64; freeifaddrs; + freopen64; fseeko64; fsetpos64; ftello64; @@ -1180,6 +1182,7 @@ LIBC_N { scandirat; scandirat64; strchrnul; + tmpfile64; } LIBC; LIBC_PRIVATE { diff --git a/libc/stdio/stdio.cpp b/libc/stdio/stdio.cpp index 16cbd555c..1c31a277f 100644 --- a/libc/stdio/stdio.cpp +++ b/libc/stdio/stdio.cpp @@ -222,6 +222,7 @@ FILE* fopen(const char* file, const char* mode) { return fp; } +__strong_alias(fopen64, fopen); FILE* fdopen(int fd, const char* mode) { int oflags; @@ -358,6 +359,7 @@ FILE* freopen(const char* file, const char* mode, FILE* fp) { if (oflags & O_APPEND) __sseek64(fp, 0, SEEK_END); return fp; } +__strong_alias(freopen64, freopen); int fclose(FILE* fp) { if (fp->_flags == 0) { diff --git a/libc/tools/check-symbols-glibc.py b/libc/tools/check-symbols-glibc.py index 27b92c489..c5dbdcf22 100755 --- a/libc/tools/check-symbols-glibc.py +++ b/libc/tools/check-symbols-glibc.py @@ -79,6 +79,7 @@ bsd_stuff = set([ 'fgetln', 'fpurge', 'funopen', + 'funopen64', 'gamma_r', 'gammaf_r', 'getprogname', diff --git a/tests/stdio_test.cpp b/tests/stdio_test.cpp index 0d21dec57..2912be4aa 100644 --- a/tests/stdio_test.cpp +++ b/tests/stdio_test.cpp @@ -79,6 +79,12 @@ TEST(STDIO_TEST, tmpfile_fileno_fprintf_rewind_fgets) { fclose(fp); } +TEST(STDIO_TEST, tmpfile64) { + FILE* fp = tmpfile64(); + ASSERT_TRUE(fp != nullptr); + fclose(fp); +} + TEST(STDIO_TEST, dprintf) { TemporaryFile tf; @@ -875,6 +881,14 @@ TEST(STDIO_TEST, freopen_CLOEXEC) { fclose(fp); } +TEST(STDIO_TEST, fopen64_freopen64) { + FILE* fp = fopen64("/proc/version", "r"); + ASSERT_TRUE(fp != nullptr); + fp = freopen64("/proc/version", "re", fp); + ASSERT_TRUE(fp != nullptr); + fclose(fp); +} + // https://code.google.com/p/android/issues/detail?id=81155 // http://b/18556607 TEST(STDIO_TEST, fread_unbuffered_pathological_performance) { |