| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 1 | /*	$OpenBSD: stdio.h,v 1.35 2006/01/13 18:10:09 miod Exp $	*/ | 
|  | 2 | /*	$NetBSD: stdio.h,v 1.18 1996/04/25 18:29:21 jtc Exp $	*/ | 
|  | 3 |  | 
|  | 4 | /*- | 
|  | 5 | * Copyright (c) 1990 The Regents of the University of California. | 
|  | 6 | * All rights reserved. | 
|  | 7 | * | 
|  | 8 | * This code is derived from software contributed to Berkeley by | 
|  | 9 | * Chris Torek. | 
|  | 10 | * | 
|  | 11 | * Redistribution and use in source and binary forms, with or without | 
|  | 12 | * modification, are permitted provided that the following conditions | 
|  | 13 | * are met: | 
|  | 14 | * 1. Redistributions of source code must retain the above copyright | 
|  | 15 | *    notice, this list of conditions and the following disclaimer. | 
|  | 16 | * 2. Redistributions in binary form must reproduce the above copyright | 
|  | 17 | *    notice, this list of conditions and the following disclaimer in the | 
|  | 18 | *    documentation and/or other materials provided with the distribution. | 
|  | 19 | * 3. Neither the name of the University nor the names of its contributors | 
|  | 20 | *    may be used to endorse or promote products derived from this software | 
|  | 21 | *    without specific prior written permission. | 
|  | 22 | * | 
|  | 23 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | 
|  | 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 
|  | 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 
|  | 26 | * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | 
|  | 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 
|  | 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | 
|  | 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 
|  | 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 
|  | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 
|  | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 
|  | 33 | * SUCH DAMAGE. | 
|  | 34 | * | 
|  | 35 | *	@(#)stdio.h	5.17 (Berkeley) 6/3/91 | 
|  | 36 | */ | 
|  | 37 |  | 
|  | 38 | #ifndef	_STDIO_H_ | 
|  | 39 | #define	_STDIO_H_ | 
|  | 40 |  | 
|  | 41 | #include <sys/cdefs.h> | 
| Elliott Hughes | 3975cec | 2012-11-29 17:25:23 -0800 | [diff] [blame] | 42 | #include <sys/types.h> | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 43 |  | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 44 | #include <stdarg.h> | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 45 | #include <stddef.h> | 
|  | 46 |  | 
| Elliott Hughes | fd936ae | 2016-08-12 10:16:34 -0700 | [diff] [blame] | 47 | #include <bits/seek_constants.h> | 
|  | 48 |  | 
| Elliott Hughes | 95c6cd7 | 2019-12-20 13:26:14 -0800 | [diff] [blame] | 49 | #if __ANDROID_API__ < 24 | 
| Dan Albert | 3037ea4 | 2016-10-06 15:46:45 -0700 | [diff] [blame] | 50 | #include <bits/struct_file.h> | 
|  | 51 | #endif | 
|  | 52 |  | 
| Dan Albert | 658727e | 2014-10-07 11:10:36 -0700 | [diff] [blame] | 53 | __BEGIN_DECLS | 
|  | 54 |  | 
| Elliott Hughes | 9677fab | 2016-01-25 15:50:59 -0800 | [diff] [blame] | 55 | typedef off_t fpos_t; | 
|  | 56 | typedef off64_t fpos64_t; | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 57 |  | 
| Elliott Hughes | f0141df | 2015-10-12 12:44:23 -0700 | [diff] [blame] | 58 | struct __sFILE; | 
|  | 59 | typedef struct __sFILE FILE; | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 60 |  | 
| Elliott Hughes | 95c6cd7 | 2019-12-20 13:26:14 -0800 | [diff] [blame] | 61 | #if __ANDROID_API__ >= 23 | 
| Josh Gao | 14adff1 | 2016-04-29 12:00:55 -0700 | [diff] [blame] | 62 | extern FILE* stdin __INTRODUCED_IN(23); | 
|  | 63 | extern FILE* stdout __INTRODUCED_IN(23); | 
|  | 64 | extern FILE* stderr __INTRODUCED_IN(23); | 
| Dan Albert | 32c79c2 | 2016-07-15 11:32:23 -0700 | [diff] [blame] | 65 |  | 
| Elliott Hughes | 168667c | 2014-11-14 14:42:59 -0800 | [diff] [blame] | 66 | /* C99 and earlier plus current C++ standards say these must be macros. */ | 
|  | 67 | #define stdin stdin | 
|  | 68 | #define stdout stdout | 
|  | 69 | #define stderr stderr | 
| Dan Albert | 32c79c2 | 2016-07-15 11:32:23 -0700 | [diff] [blame] | 70 | #else | 
|  | 71 | /* Before M the actual symbols for stdin and friends had different names. */ | 
| Dan Albert | 3037ea4 | 2016-10-06 15:46:45 -0700 | [diff] [blame] | 72 | extern FILE __sF[] __REMOVED_IN(23); | 
| Dan Albert | 32c79c2 | 2016-07-15 11:32:23 -0700 | [diff] [blame] | 73 |  | 
| Dan Albert | 3037ea4 | 2016-10-06 15:46:45 -0700 | [diff] [blame] | 74 | #define stdin (&__sF[0]) | 
|  | 75 | #define stdout (&__sF[1]) | 
|  | 76 | #define stderr (&__sF[2]) | 
| Dan Albert | 32c79c2 | 2016-07-15 11:32:23 -0700 | [diff] [blame] | 77 | #endif | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 78 |  | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 79 | /* | 
|  | 80 | * The following three definitions are for ANSI C, which took them | 
|  | 81 | * from System V, which brilliantly took internal interface macros and | 
|  | 82 | * made them official arguments to setvbuf(), without renaming them. | 
|  | 83 | * Hence, these ugly _IOxxx names are *supposed* to appear in user code. | 
|  | 84 | * | 
|  | 85 | * Although numbered as their counterparts above, the implementation | 
|  | 86 | * does not rely on this. | 
|  | 87 | */ | 
|  | 88 | #define	_IOFBF	0		/* setvbuf should set fully buffered */ | 
|  | 89 | #define	_IOLBF	1		/* setvbuf should set line buffered */ | 
|  | 90 | #define	_IONBF	2		/* setvbuf should set unbuffered */ | 
|  | 91 |  | 
|  | 92 | #define	BUFSIZ	1024		/* size of buffer used by setbuf */ | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 93 | #define	EOF	(-1) | 
|  | 94 |  | 
|  | 95 | /* | 
| Elliott Hughes | d04c183 | 2013-05-14 16:08:43 -0700 | [diff] [blame] | 96 | * FOPEN_MAX is a minimum maximum, and is the number of streams that | 
|  | 97 | * stdio can provide without attempting to allocate further resources | 
|  | 98 | * (which could fail).  Do not use this for anything. | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 99 | */ | 
| Elliott Hughes | b15feb7 | 2017-07-31 17:20:18 -0700 | [diff] [blame] | 100 | #define FOPEN_MAX 20 | 
|  | 101 | #define FILENAME_MAX 4096 | 
| Elliott Hughes | d04c183 | 2013-05-14 16:08:43 -0700 | [diff] [blame] | 102 |  | 
| Elliott Hughes | b15feb7 | 2017-07-31 17:20:18 -0700 | [diff] [blame] | 103 | #define L_tmpnam 4096 | 
|  | 104 | #define TMP_MAX 308915776 | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 105 |  | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 106 | void clearerr(FILE* __fp); | 
|  | 107 | int fclose(FILE* __fp); | 
|  | 108 | int feof(FILE* __fp); | 
|  | 109 | int ferror(FILE* __fp); | 
|  | 110 | int fflush(FILE* __fp); | 
|  | 111 | int fgetc(FILE* __fp); | 
| George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 112 | char* fgets(char* __buf, int __size, FILE* __fp); | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 113 | int fprintf(FILE* __fp , const char* __fmt, ...) __printflike(2, 3); | 
|  | 114 | int fputc(int __ch, FILE* __fp); | 
|  | 115 | int fputs(const char* __s, FILE* __fp); | 
| George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 116 | size_t fread(void* __buf, size_t __size, size_t __count, FILE* __fp); | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 117 | int fscanf(FILE* __fp, const char* __fmt, ...) __scanflike(2, 3); | 
| George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 118 | size_t fwrite(const void* __buf, size_t __size, size_t __count, FILE* __fp); | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 119 | int getc(FILE* __fp); | 
|  | 120 | int getchar(void); | 
|  | 121 | ssize_t getdelim(char** __line_ptr, size_t* __line_length_ptr, int __delimiter, FILE* __fp) __INTRODUCED_IN(18); | 
|  | 122 | ssize_t getline(char** __line_ptr, size_t* __line_length_ptr, FILE* __fp) __INTRODUCED_IN(18); | 
| Elliott Hughes | c13fb75 | 2013-12-17 20:43:30 -0800 | [diff] [blame] | 123 |  | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 124 | void perror(const char* __msg); | 
|  | 125 | int printf(const char* __fmt, ...) __printflike(1, 2); | 
|  | 126 | int putc(int __ch, FILE* __fp); | 
|  | 127 | int putchar(int __ch); | 
|  | 128 | int puts(const char* __s); | 
|  | 129 | int remove(const char* __path); | 
|  | 130 | void rewind(FILE* __fp); | 
|  | 131 | int scanf(const char* __fmt, ...) __scanflike(1, 2); | 
|  | 132 | void setbuf(FILE* __fp, char* __buf); | 
|  | 133 | int setvbuf(FILE* __fp, char* __buf, int __mode, size_t __size); | 
|  | 134 | int sscanf(const char* __s, const char* __fmt, ...) __scanflike(2, 3); | 
|  | 135 | int ungetc(int __ch, FILE* __fp); | 
|  | 136 | int vfprintf(FILE* __fp, const char* __fmt, va_list __args) __printflike(2, 0); | 
|  | 137 | int vprintf(const char* __fp, va_list __args) __printflike(1, 0); | 
| Elliott Hughes | d04c183 | 2013-05-14 16:08:43 -0700 | [diff] [blame] | 138 |  | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 139 | int dprintf(int __fd, const char* __fmt, ...) __printflike(2, 3) __INTRODUCED_IN(21); | 
|  | 140 | int vdprintf(int __fd, const char* __fmt, va_list __args) __printflike(2, 0) __INTRODUCED_IN(21); | 
| Elliott Hughes | fcac8ff | 2014-05-22 01:24:30 -0700 | [diff] [blame] | 141 |  | 
| Elliott Hughes | f6495c7 | 2016-07-25 09:20:57 -0700 | [diff] [blame] | 142 | #if (defined(__STDC_VERSION__) && __STDC_VERSION__ < 201112L) || \ | 
|  | 143 | (defined(__cplusplus) && __cplusplus <= 201103L) | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 144 | char* gets(char* __buf) __attribute__((deprecated("gets is unsafe, use fgets instead"))); | 
| Dan Albert | 9635046 | 2014-06-17 23:31:21 +0000 | [diff] [blame] | 145 | #endif | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 146 | int sprintf(char* __s, const char* __fmt, ...) | 
| George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 147 | __printflike(2, 3) __warnattr_strict("sprintf is often misused; please use snprintf"); | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 148 | int vsprintf(char* __s, const char* __fmt, va_list __args) | 
| George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 149 | __printflike(2, 0) __warnattr_strict("vsprintf is often misused; please use vsnprintf"); | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 150 | char* tmpnam(char* __s) | 
| Elliott Hughes | 439ebbd | 2020-12-04 18:51:42 -0800 | [diff] [blame] | 151 | __warnattr("tmpnam is unsafe, use mkstemp or tmpfile instead"); | 
| Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 152 | #define P_tmpdir "/tmp/" /* deprecated */ | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 153 | char* tempnam(const char* __dir, const char* __prefix) | 
| George Burgess IV | 7cc779f | 2017-02-09 00:00:31 -0800 | [diff] [blame] | 154 | __warnattr("tempnam is unsafe, use mkstemp or tmpfile instead"); | 
| Elliott Hughes | d04c183 | 2013-05-14 16:08:43 -0700 | [diff] [blame] | 155 |  | 
| Elliott Hughes | 05b675e | 2019-04-17 13:01:06 -0700 | [diff] [blame] | 156 | /** | 
|  | 157 | * [rename(2)](http://man7.org/linux/man-pages/man2/rename.2.html) changes | 
|  | 158 | * the name or location of a file. | 
|  | 159 | * | 
|  | 160 | * Returns 0 on success, and returns -1 and sets `errno` on failure. | 
|  | 161 | */ | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 162 | int rename(const char* __old_path, const char* __new_path); | 
| Elliott Hughes | 05b675e | 2019-04-17 13:01:06 -0700 | [diff] [blame] | 163 |  | 
|  | 164 | /** | 
|  | 165 | * [renameat(2)](http://man7.org/linux/man-pages/man2/renameat.2.html) changes | 
|  | 166 | * the name or location of a file, interpreting relative paths using an fd. | 
|  | 167 | * | 
|  | 168 | * Returns 0 on success, and returns -1 and sets `errno` on failure. | 
|  | 169 | */ | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 170 | int renameat(int __old_dir_fd, const char* __old_path, int __new_dir_fd, const char* __new_path); | 
| Elliott Hughes | d04c183 | 2013-05-14 16:08:43 -0700 | [diff] [blame] | 171 |  | 
| Elliott Hughes | 05b675e | 2019-04-17 13:01:06 -0700 | [diff] [blame] | 172 | #if defined(__USE_GNU) | 
|  | 173 |  | 
|  | 174 | /** | 
|  | 175 | * Flag for [renameat2(2)](http://man7.org/linux/man-pages/man2/renameat2.2.html) | 
|  | 176 | * to fail if the new path already exists. | 
|  | 177 | */ | 
|  | 178 | #define RENAME_NOREPLACE (1<<0) | 
|  | 179 |  | 
|  | 180 | /** | 
|  | 181 | * Flag for [renameat2(2)](http://man7.org/linux/man-pages/man2/renameat2.2.html) | 
|  | 182 | * to atomically exchange the two paths. | 
|  | 183 | */ | 
|  | 184 | #define RENAME_EXCHANGE (1<<1) | 
|  | 185 |  | 
|  | 186 | /** | 
|  | 187 | * Flag for [renameat2(2)](http://man7.org/linux/man-pages/man2/renameat2.2.html) | 
|  | 188 | * to create a union/overlay filesystem object. | 
|  | 189 | */ | 
|  | 190 | #define RENAME_WHITEOUT (1<<2) | 
|  | 191 |  | 
|  | 192 | /** | 
|  | 193 | * [renameat2(2)](http://man7.org/linux/man-pages/man2/renameat2.2.html) changes | 
|  | 194 | * the name or location of a file, interpreting relative paths using an fd, | 
|  | 195 | * with optional `RENAME_` flags. | 
|  | 196 | * | 
|  | 197 | * Returns 0 on success, and returns -1 and sets `errno` on failure. | 
|  | 198 | */ | 
|  | 199 | int renameat2(int __old_dir_fd, const char* __old_path, int __new_dir_fd, const char* __new_path, unsigned __flags) __INTRODUCED_IN(30); | 
|  | 200 |  | 
|  | 201 | #endif | 
|  | 202 |  | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 203 | int fseek(FILE* __fp, long __offset, int __whence); | 
|  | 204 | long ftell(FILE* __fp); | 
| Elliott Hughes | 03e65eb | 2016-01-26 14:13:04 -0800 | [diff] [blame] | 205 |  | 
| Elliott Hughes | a348174 | 2017-11-28 14:47:17 -0800 | [diff] [blame] | 206 | /* See https://android.googlesource.com/platform/bionic/+/master/docs/32-bit-abi.md */ | 
| Elliott Hughes | 00fedf5 | 2017-07-05 15:23:50 -0700 | [diff] [blame] | 207 | #if defined(__USE_FILE_OFFSET64) | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 208 | int fgetpos(FILE* __fp, fpos_t* __pos) __RENAME(fgetpos64) __INTRODUCED_IN(24); | 
|  | 209 | int fsetpos(FILE* __fp, const fpos_t* __pos) __RENAME(fsetpos64) __INTRODUCED_IN(24); | 
|  | 210 | int fseeko(FILE* __fp, off_t __offset, int __whence) __RENAME(fseeko64) __INTRODUCED_IN(24); | 
|  | 211 | off_t ftello(FILE* __fp) __RENAME(ftello64) __INTRODUCED_IN(24); | 
| Elliott Hughes | 03e65eb | 2016-01-26 14:13:04 -0800 | [diff] [blame] | 212 | #  if defined(__USE_BSD) | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 213 | FILE* funopen(const void* __cookie, | 
|  | 214 | int (*__read_fn)(void*, char*, int), | 
|  | 215 | int (*__write_fn)(void*, const char*, int), | 
|  | 216 | fpos_t (*__seek_fn)(void*, fpos_t, int), | 
|  | 217 | int (*__close_fn)(void*)) __RENAME(funopen64) __INTRODUCED_IN(24); | 
| Elliott Hughes | 03e65eb | 2016-01-26 14:13:04 -0800 | [diff] [blame] | 218 | #  endif | 
| Elliott Hughes | 68dc20d | 2015-02-06 22:28:49 -0800 | [diff] [blame] | 219 | #else | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 220 | int fgetpos(FILE* __fp, fpos_t* __pos); | 
|  | 221 | int fsetpos(FILE* __fp, const fpos_t* __pos); | 
|  | 222 | int fseeko(FILE* __fp, off_t __offset, int __whence); | 
|  | 223 | off_t ftello(FILE* __fp); | 
| Elliott Hughes | 03e65eb | 2016-01-26 14:13:04 -0800 | [diff] [blame] | 224 | #  if defined(__USE_BSD) | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 225 | FILE* funopen(const void* __cookie, | 
|  | 226 | int (*__read_fn)(void*, char*, int), | 
|  | 227 | int (*__write_fn)(void*, const char*, int), | 
|  | 228 | fpos_t (*__seek_fn)(void*, fpos_t, int), | 
|  | 229 | int (*__close_fn)(void*)); | 
| Elliott Hughes | 03e65eb | 2016-01-26 14:13:04 -0800 | [diff] [blame] | 230 | #  endif | 
| Elliott Hughes | 68dc20d | 2015-02-06 22:28:49 -0800 | [diff] [blame] | 231 | #endif | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 232 | int fgetpos64(FILE* __fp, fpos64_t* __pos) __INTRODUCED_IN(24); | 
|  | 233 | int fsetpos64(FILE* __fp, const fpos64_t* __pos) __INTRODUCED_IN(24); | 
|  | 234 | int fseeko64(FILE* __fp, off64_t __offset, int __whence) __INTRODUCED_IN(24); | 
|  | 235 | off64_t ftello64(FILE* __fp) __INTRODUCED_IN(24); | 
| Elliott Hughes | 03e65eb | 2016-01-26 14:13:04 -0800 | [diff] [blame] | 236 | #if defined(__USE_BSD) | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 237 | FILE* funopen64(const void* __cookie, | 
|  | 238 | int (*__read_fn)(void*, char*, int), | 
|  | 239 | int (*__write_fn)(void*, const char*, int), | 
|  | 240 | fpos64_t (*__seek_fn)(void*, fpos64_t, int), | 
|  | 241 | int (*__close_fn)(void*)) __INTRODUCED_IN(24); | 
| Elliott Hughes | 03e65eb | 2016-01-26 14:13:04 -0800 | [diff] [blame] | 242 | #endif | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 243 |  | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 244 | FILE* fopen(const char* __path, const char* __mode); | 
|  | 245 | FILE* fopen64(const char* __path, const char* __mode) __INTRODUCED_IN(24); | 
|  | 246 | FILE* freopen(const char* __path, const char* __mode, FILE* __fp); | 
|  | 247 | FILE* freopen64(const char* __path, const char* __mode, FILE* __fp) __INTRODUCED_IN(24); | 
| Elliott Hughes | f226ee5 | 2016-02-03 11:24:28 -0800 | [diff] [blame] | 248 | FILE* tmpfile(void); | 
| Josh Gao | 14adff1 | 2016-04-29 12:00:55 -0700 | [diff] [blame] | 249 | FILE* tmpfile64(void) __INTRODUCED_IN(24); | 
| Elliott Hughes | f226ee5 | 2016-02-03 11:24:28 -0800 | [diff] [blame] | 250 |  | 
| George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 251 | int snprintf(char* __buf, size_t __size, const char* __fmt, ...) __printflike(3, 4); | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 252 | int vfscanf(FILE* __fp, const char* __fmt, va_list __args) __scanflike(2, 0); | 
|  | 253 | int vscanf(const char* __fmt , va_list __args) __scanflike(1, 0); | 
| George Burgess IV | 9024235 | 2018-02-06 12:51:31 -0800 | [diff] [blame] | 254 | int vsnprintf(char* __buf, size_t __size, const char* __fmt, va_list __args) __printflike(3, 0); | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 255 | int vsscanf(const char* __s, const char* __fmt, va_list __args) __scanflike(2, 0); | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 256 |  | 
| Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 257 | #define L_ctermid 1024 /* size for ctermid() */ | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 258 | char* ctermid(char* __buf) __INTRODUCED_IN(26); | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 259 |  | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 260 | FILE* fdopen(int __fd, const char* __mode); | 
|  | 261 | int fileno(FILE* __fp); | 
|  | 262 | int pclose(FILE* __fp); | 
|  | 263 | FILE* popen(const char* __command, const char* __mode); | 
|  | 264 | void flockfile(FILE* __fp); | 
|  | 265 | int ftrylockfile(FILE* __fp); | 
|  | 266 | void funlockfile(FILE* __fp); | 
|  | 267 | int getc_unlocked(FILE* __fp); | 
| Elliott Hughes | 3ba55f8 | 2016-06-08 18:11:23 -0700 | [diff] [blame] | 268 | int getchar_unlocked(void); | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 269 | int putc_unlocked(int __ch, FILE* __fp); | 
|  | 270 | int putchar_unlocked(int __ch); | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 271 |  | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 272 | FILE* fmemopen(void* __buf, size_t __size, const char* __mode) __INTRODUCED_IN(23); | 
|  | 273 | FILE* open_memstream(char** __ptr, size_t* __size_ptr) __INTRODUCED_IN(23); | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 274 |  | 
| Elliott Hughes | 9c8d711 | 2016-06-13 13:23:42 -0700 | [diff] [blame] | 275 | #if defined(__USE_BSD) || defined(__BIONIC__) /* Historically bionic exposed these. */ | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 276 | int  asprintf(char** __s_ptr, const char* __fmt, ...) __printflike(2, 3); | 
|  | 277 | char* fgetln(FILE* __fp, size_t* __length_ptr); | 
|  | 278 | int fpurge(FILE* __fp); | 
|  | 279 | void setbuffer(FILE* __fp, char* __buf, int __size); | 
|  | 280 | int setlinebuf(FILE* __fp); | 
|  | 281 | int vasprintf(char** __s_ptr, const char* __fmt, va_list __args) __printflike(2, 0); | 
|  | 282 | void clearerr_unlocked(FILE* __fp) __INTRODUCED_IN(23); | 
|  | 283 | int feof_unlocked(FILE* __fp) __INTRODUCED_IN(23); | 
|  | 284 | int ferror_unlocked(FILE* __fp) __INTRODUCED_IN(23); | 
|  | 285 | int fileno_unlocked(FILE* __fp) __INTRODUCED_IN(24); | 
| Elliott Hughes | 03e65eb | 2016-01-26 14:13:04 -0800 | [diff] [blame] | 286 | #define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) | 
|  | 287 | #define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) | 
| Elliott Hughes | 37ad959 | 2017-10-30 17:47:12 -0700 | [diff] [blame] | 288 | #endif | 
|  | 289 |  | 
|  | 290 | #if defined(__USE_BSD) | 
| Elliott Hughes | cc0fe6e | 2018-01-30 08:54:12 -0800 | [diff] [blame] | 291 | int fflush_unlocked(FILE* __fp) __INTRODUCED_IN(28); | 
|  | 292 | int fgetc_unlocked(FILE* __fp) __INTRODUCED_IN(28); | 
|  | 293 | int fputc_unlocked(int __ch, FILE* __fp) __INTRODUCED_IN(28); | 
|  | 294 | size_t fread_unlocked(void* __buf, size_t __size, size_t __count, FILE* __fp) __INTRODUCED_IN(28); | 
|  | 295 | size_t fwrite_unlocked(const void* __buf, size_t __size, size_t __count, FILE* __fp) __INTRODUCED_IN(28); | 
| Elliott Hughes | 37ad959 | 2017-10-30 17:47:12 -0700 | [diff] [blame] | 296 | #endif | 
|  | 297 |  | 
|  | 298 | #if defined(__USE_GNU) | 
| Elliott Hughes | cc0fe6e | 2018-01-30 08:54:12 -0800 | [diff] [blame] | 299 | int fputs_unlocked(const char* __s, FILE* __fp) __INTRODUCED_IN(28); | 
|  | 300 | char* fgets_unlocked(char* __buf, int __size, FILE* __fp) __INTRODUCED_IN(28); | 
| Elliott Hughes | 37ad959 | 2017-10-30 17:47:12 -0700 | [diff] [blame] | 301 | #endif | 
| The Android Open Source Project | 1dc9e47 | 2009-03-03 19:28:35 -0800 | [diff] [blame] | 302 |  | 
| George Burgess IV | b97049c | 2017-07-24 15:05:05 -0700 | [diff] [blame] | 303 | #if defined(__BIONIC_INCLUDE_FORTIFY_HEADERS) | 
|  | 304 | #include <bits/fortify/stdio.h> | 
|  | 305 | #endif | 
| Nick Kralevich | cffdf66 | 2012-06-11 15:50:57 -0700 | [diff] [blame] | 306 |  | 
| Dan Albert | 658727e | 2014-10-07 11:10:36 -0700 | [diff] [blame] | 307 | __END_DECLS | 
|  | 308 |  | 
| Elliott Hughes | ff26a16 | 2017-08-17 22:34:21 +0000 | [diff] [blame] | 309 | #endif |