modernc.org/cc@v1.0.1/v2/headers/linux_386/usr/include/stdio.h (about) 1 /* Define ISO C stdio on top of C++ iostreams. 2 Copyright (C) 1991-2018 Free Software Foundation, Inc. 3 This file is part of the GNU C Library. 4 5 The GNU C Library is free software; you can redistribute it and/or 6 modify it under the terms of the GNU Lesser General Public 7 License as published by the Free Software Foundation; either 8 version 2.1 of the License, or (at your option) any later version. 9 10 The GNU C Library is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 Lesser General Public License for more details. 14 15 You should have received a copy of the GNU Lesser General Public 16 License along with the GNU C Library; if not, see 17 <http://www.gnu.org/licenses/>. */ 18 19 /* 20 * ISO C99 Standard: 7.19 Input/output <stdio.h> 21 */ 22 23 #ifndef _STDIO_H 24 #define _STDIO_H 1 25 26 #define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION 27 #include <bits/libc-header-start.h> 28 29 __BEGIN_DECLS 30 #define __need_size_t 31 #define __need_NULL 32 #include <stddef.h> 33 #include <bits/types.h> 34 #include <bits/types/__FILE.h> 35 #include <bits/types/FILE.h> 36 #define _STDIO_USES_IOSTREAM 37 #include <bits/libio.h> 38 #if defined __USE_XOPEN || defined __USE_XOPEN2K8 39 # ifdef __GNUC__ 40 # ifndef _VA_LIST_DEFINED 41 typedef _G_va_list va_list; 42 # define _VA_LIST_DEFINED 43 # endif 44 # else 45 # include <stdarg.h> 46 # endif 47 #endif 48 #if defined __USE_UNIX98 || defined __USE_XOPEN2K 49 # ifndef __off_t_defined 50 # ifndef __USE_FILE_OFFSET64 51 typedef __off_t off_t; 52 # else 53 typedef __off64_t off_t; 54 # endif 55 # define __off_t_defined 56 # endif 57 # if defined __USE_LARGEFILE64 && !defined __off64_t_defined 58 typedef __off64_t off64_t; 59 # define __off64_t_defined 60 # endif 61 #endif 62 63 #ifdef __USE_XOPEN2K8 64 # ifndef __ssize_t_defined 65 typedef __ssize_t ssize_t; 66 # define __ssize_t_defined 67 # endif 68 #endif 69 70 /* The type of the second argument to `fgetpos' and `fsetpos'. */ 71 #ifndef __USE_FILE_OFFSET64 72 typedef _G_fpos_t fpos_t; 73 #else 74 typedef _G_fpos64_t fpos_t; 75 #endif 76 #ifdef __USE_LARGEFILE64 77 typedef _G_fpos64_t fpos64_t; 78 #endif 79 80 /* The possibilities for the third argument to `setvbuf'. */ 81 #define _IOFBF 0 /* Fully buffered. */ 82 #define _IOLBF 1 /* Line buffered. */ 83 #define _IONBF 2 /* No buffering. */ 84 85 /* Default buffer size. */ 86 #ifndef BUFSIZ 87 # define BUFSIZ _IO_BUFSIZ 88 #endif 89 90 /* End of file character. 91 Some things throughout the library rely on this being -1. */ 92 #ifndef EOF 93 # define EOF (-1) 94 #endif 95 96 /* The possibilities for the third argument to `fseek'. 97 These values should not be changed. */ 98 #define SEEK_SET 0 /* Seek from beginning of file. */ 99 #define SEEK_CUR 1 /* Seek from current position. */ 100 #define SEEK_END 2 /* Seek from end of file. */ 101 #ifdef __USE_GNU 102 # define SEEK_DATA 3 /* Seek to next data. */ 103 # define SEEK_HOLE 4 /* Seek to next hole. */ 104 #endif 105 106 #if defined __USE_MISC || defined __USE_XOPEN 107 /* Default path prefix for `tempnam' and `tmpnam'. */ 108 # define P_tmpdir "/tmp" 109 #endif 110 111 /* Get the values: 112 L_tmpnam How long an array of chars must be to be passed to `tmpnam'. 113 TMP_MAX The minimum number of unique filenames generated by tmpnam 114 (and tempnam when it uses tmpnam's name space), 115 or tempnam (the two are separate). 116 L_ctermid How long an array to pass to `ctermid'. 117 L_cuserid How long an array to pass to `cuserid'. 118 FOPEN_MAX Minimum number of files that can be open at once. 119 FILENAME_MAX Maximum length of a filename. */ 120 #include <bits/stdio_lim.h> 121 122 /* Standard streams. */ 123 extern struct _IO_FILE *stdin; /* Standard input stream. */ 124 extern struct _IO_FILE *stdout; /* Standard output stream. */ 125 extern struct _IO_FILE *stderr; /* Standard error output stream. */ 126 /* C89/C99 say they're macros. Make them happy. */ 127 #define stdin stdin 128 #define stdout stdout 129 #define stderr stderr 130 131 /* Remove file FILENAME. */ 132 extern int remove(const char *__filename) __THROW; 133 /* Rename file OLD to NEW. */ 134 extern int rename(const char *__old, const char *__new) __THROW; 135 136 #ifdef __USE_ATFILE 137 /* Rename file OLD relative to OLDFD to NEW relative to NEWFD. */ 138 extern int renameat(int __oldfd, const char *__old, int __newfd, const char *__new) __THROW; 139 #endif 140 141 /* Create a temporary file and open it read/write. 142 143 This function is a possible cancellation point and therefore not 144 marked with __THROW. */ 145 #ifndef __USE_FILE_OFFSET64 146 extern FILE *tmpfile(void) __wur; 147 #else 148 # ifdef __REDIRECT 149 extern FILE *__REDIRECT(tmpfile, (void), tmpfile64) __wur; 150 # else 151 # define tmpfile tmpfile64 152 # endif 153 #endif 154 155 #ifdef __USE_LARGEFILE64 156 extern FILE *tmpfile64(void) __wur; 157 #endif 158 159 /* Generate a temporary filename. */ 160 extern char *tmpnam(char *__s) 161 __THROW __wur; 162 163 #ifdef __USE_MISC 164 /* This is the reentrant variant of `tmpnam'. The only difference is 165 that it does not allow S to be NULL. */ 166 extern char *tmpnam_r(char *__s) 167 __THROW __wur; 168 #endif 169 170 #if defined __USE_MISC || defined __USE_XOPEN 171 /* Generate a unique temporary filename using up to five characters of PFX 172 if it is not NULL. The directory to put this file in is searched for 173 as follows: First the environment variable "TMPDIR" is checked. 174 If it contains the name of a writable directory, that directory is used. 175 If not and if DIR is not NULL, that value is checked. If that fails, 176 P_tmpdir is tried and finally "/tmp". The storage for the filename 177 is allocated by `malloc'. */ 178 extern char *tempnam(const char *__dir, const char *__pfx) 179 __THROW __attribute_malloc__ __wur; 180 #endif 181 182 /* Close STREAM. 183 184 This function is a possible cancellation point and therefore not 185 marked with __THROW. */ 186 extern int fclose(FILE * __stream); 187 /* Flush STREAM, or all streams if STREAM is NULL. 188 189 This function is a possible cancellation point and therefore not 190 marked with __THROW. */ 191 extern int fflush(FILE * __stream); 192 193 #ifdef __USE_MISC 194 /* Faster versions when locking is not required. 195 196 This function is not part of POSIX and therefore no official 197 cancellation point. But due to similarity with an POSIX interface 198 or due to the implementation it is a cancellation point and 199 therefore not marked with __THROW. */ 200 extern int fflush_unlocked(FILE * __stream); 201 #endif 202 203 #ifdef __USE_GNU 204 /* Close all streams. 205 206 This function is not part of POSIX and therefore no official 207 cancellation point. But due to similarity with an POSIX interface 208 or due to the implementation it is a cancellation point and 209 therefore not marked with __THROW. */ 210 extern int fcloseall(void); 211 #endif 212 213 #ifndef __USE_FILE_OFFSET64 214 /* Open a file and create a new stream for it. 215 216 This function is a possible cancellation point and therefore not 217 marked with __THROW. */ 218 extern FILE *fopen(const char *__restrict __filename, const char *__restrict __modes) __wur; 219 /* Open a file, replacing an existing stream with it. 220 221 This function is a possible cancellation point and therefore not 222 marked with __THROW. */ 223 extern FILE *freopen(const char *__restrict __filename, const char *__restrict __modes, FILE * __restrict __stream) __wur; 224 #else 225 # ifdef __REDIRECT 226 extern FILE *__REDIRECT(fopen, (const char *__restrict __filename, const char *__restrict __modes), fopen64) __wur; 227 extern FILE *__REDIRECT(freopen, (const char *__restrict __filename, const char *__restrict __modes, FILE * __restrict __stream), freopen64) __wur; 228 # else 229 # define fopen fopen64 230 # define freopen freopen64 231 # endif 232 #endif 233 #ifdef __USE_LARGEFILE64 234 extern FILE *fopen64(const char *__restrict __filename, const char *__restrict __modes) __wur; 235 extern FILE *freopen64(const char *__restrict __filename, const char *__restrict __modes, FILE * __restrict __stream) __wur; 236 #endif 237 238 #ifdef __USE_POSIX 239 /* Create a new stream that refers to an existing system file descriptor. */ 240 extern FILE *fdopen(int __fd, const char *__modes) 241 __THROW __wur; 242 #endif 243 244 #ifdef __USE_GNU 245 /* Create a new stream that refers to the given magic cookie, 246 and uses the given functions for input and output. */ 247 extern FILE *fopencookie(void *__restrict __magic_cookie, const char *__restrict __modes, _IO_cookie_io_functions_t __io_funcs) 248 __THROW __wur; 249 #endif 250 251 #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) 252 /* Create a new stream that refers to a memory buffer. */ 253 extern FILE *fmemopen(void *__s, size_t __len, const char *__modes) 254 __THROW __wur; 255 256 /* Open a stream that writes into a malloc'd buffer that is expanded as 257 necessary. *BUFLOC and *SIZELOC are updated with the buffer's location 258 and the number of characters written on fflush or fclose. */ 259 extern FILE *open_memstream(char **__bufloc, size_t * __sizeloc) 260 __THROW __wur; 261 #endif 262 263 /* If BUF is NULL, make STREAM unbuffered. 264 Else make it use buffer BUF, of size BUFSIZ. */ 265 extern void setbuf(FILE * __restrict __stream, char *__restrict __buf) __THROW; 266 /* Make STREAM use buffering mode MODE. 267 If BUF is not NULL, use N bytes of it for buffering; 268 else allocate an internal buffer N bytes long. */ 269 extern int setvbuf(FILE * __restrict __stream, char *__restrict __buf, int __modes, size_t __n) __THROW; 270 271 #ifdef __USE_MISC 272 /* If BUF is NULL, make STREAM unbuffered. 273 Else make it use SIZE bytes of BUF for buffering. */ 274 extern void setbuffer(FILE * __restrict __stream, char *__restrict __buf, size_t __size) __THROW; 275 276 /* Make STREAM line-buffered. */ 277 extern void setlinebuf(FILE * __stream) __THROW; 278 #endif 279 280 /* Write formatted output to STREAM. 281 282 This function is a possible cancellation point and therefore not 283 marked with __THROW. */ 284 extern int fprintf(FILE * __restrict __stream, const char *__restrict __format, ...); 285 /* Write formatted output to stdout. 286 287 This function is a possible cancellation point and therefore not 288 marked with __THROW. */ 289 extern int printf(const char *__restrict __format, ...); 290 /* Write formatted output to S. */ 291 extern int sprintf(char *__restrict __s, const char *__restrict __format, ...) __THROWNL; 292 293 /* Write formatted output to S from argument list ARG. 294 295 This function is a possible cancellation point and therefore not 296 marked with __THROW. */ 297 extern int vfprintf(FILE * __restrict __s, const char *__restrict __format, _G_va_list __arg); 298 /* Write formatted output to stdout from argument list ARG. 299 300 This function is a possible cancellation point and therefore not 301 marked with __THROW. */ 302 extern int vprintf(const char *__restrict __format, _G_va_list __arg); 303 /* Write formatted output to S from argument list ARG. */ 304 extern int vsprintf(char *__restrict __s, const char *__restrict __format, _G_va_list __arg) __THROWNL; 305 306 #if defined __USE_ISOC99 || defined __USE_UNIX98 307 /* Maximum chars of output to write in MAXLEN. */ 308 extern int snprintf(char *__restrict __s, size_t __maxlen, const char *__restrict __format, ...) 309 __THROWNL __attribute__ ((__format__(__printf__, 3, 4))); 310 311 extern int vsnprintf(char *__restrict __s, size_t __maxlen, const char *__restrict __format, _G_va_list __arg) 312 __THROWNL __attribute__ ((__format__(__printf__, 3, 0))); 313 #endif 314 315 #if __GLIBC_USE (LIB_EXT2) 316 /* Write formatted output to a string dynamically allocated with `malloc'. 317 Store the address of the string in *PTR. */ 318 extern int vasprintf(char **__restrict __ptr, const char *__restrict __f, _G_va_list __arg) 319 __THROWNL __attribute__ ((__format__(__printf__, 2, 0))) __wur; 320 extern int __asprintf(char **__restrict __ptr, const char *__restrict __fmt, ...) 321 __THROWNL __attribute__ ((__format__(__printf__, 2, 3))) __wur; 322 extern int asprintf(char **__restrict __ptr, const char *__restrict __fmt, ...) 323 __THROWNL __attribute__ ((__format__(__printf__, 2, 3))) __wur; 324 #endif 325 326 #ifdef __USE_XOPEN2K8 327 /* Write formatted output to a file descriptor. */ 328 extern int vdprintf(int __fd, const char *__restrict __fmt, _G_va_list __arg) 329 __attribute__ ((__format__(__printf__, 2, 0))); 330 extern int dprintf(int __fd, const char *__restrict __fmt, ...) 331 __attribute__ ((__format__(__printf__, 2, 3))); 332 #endif 333 334 /* Read formatted input from STREAM. 335 336 This function is a possible cancellation point and therefore not 337 marked with __THROW. */ 338 extern int fscanf(FILE * __restrict __stream, const char *__restrict __format, ...) __wur; 339 /* Read formatted input from stdin. 340 341 This function is a possible cancellation point and therefore not 342 marked with __THROW. */ 343 extern int scanf(const char *__restrict __format, ...) __wur; 344 /* Read formatted input from S. */ 345 extern int sscanf(const char *__restrict __s, const char *__restrict __format, ...) __THROW; 346 347 #if defined __USE_ISOC99 && !defined __USE_GNU \ 348 && (!defined __LDBL_COMPAT || !defined __REDIRECT) \ 349 && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) 350 # ifdef __REDIRECT 351 /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[ 352 GNU extension which conflicts with valid %a followed by letter 353 s, S or [. */ 354 extern int __REDIRECT(fscanf, (FILE * __restrict __stream, const char *__restrict __format, ...), __isoc99_fscanf) __wur; 355 extern int __REDIRECT(scanf, (const char *__restrict __format, ...), __isoc99_scanf) __wur; 356 extern int __REDIRECT_NTH(sscanf, (const char *__restrict __s, const char *__restrict __format, ...), __isoc99_sscanf); 357 # else 358 extern int __isoc99_fscanf(FILE * __restrict __stream, const char *__restrict __format, ...) __wur; 359 extern int __isoc99_scanf(const char *__restrict __format, ...) __wur; 360 extern int __isoc99_sscanf(const char *__restrict __s, const char *__restrict __format, ...) __THROW; 361 # define fscanf __isoc99_fscanf 362 # define scanf __isoc99_scanf 363 # define sscanf __isoc99_sscanf 364 # endif 365 #endif 366 367 #ifdef __USE_ISOC99 368 /* Read formatted input from S into argument list ARG. 369 370 This function is a possible cancellation point and therefore not 371 marked with __THROW. */ 372 extern int vfscanf(FILE * __restrict __s, const char *__restrict __format, _G_va_list __arg) 373 __attribute__ ((__format__(__scanf__, 2, 0))) __wur; 374 375 /* Read formatted input from stdin into argument list ARG. 376 377 This function is a possible cancellation point and therefore not 378 marked with __THROW. */ 379 extern int vscanf(const char *__restrict __format, _G_va_list __arg) 380 __attribute__ ((__format__(__scanf__, 1, 0))) __wur; 381 382 /* Read formatted input from S into argument list ARG. */ 383 extern int vsscanf(const char *__restrict __s, const char *__restrict __format, _G_va_list __arg) 384 __THROW __attribute__ ((__format__(__scanf__, 2, 0))); 385 386 # if !defined __USE_GNU \ 387 && (!defined __LDBL_COMPAT || !defined __REDIRECT) \ 388 && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K) 389 # ifdef __REDIRECT 390 /* For strict ISO C99 or POSIX compliance disallow %as, %aS and %a[ 391 GNU extension which conflicts with valid %a followed by letter 392 s, S or [. */ 393 extern int __REDIRECT(vfscanf, (FILE * __restrict __s, const char *__restrict __format, _G_va_list __arg), __isoc99_vfscanf) 394 __attribute__ ((__format__(__scanf__, 2, 0))) __wur; 395 extern int __REDIRECT(vscanf, (const char *__restrict __format, _G_va_list __arg), __isoc99_vscanf) 396 __attribute__ ((__format__(__scanf__, 1, 0))) __wur; 397 extern int __REDIRECT_NTH(vsscanf, (const char *__restrict __s, const char *__restrict __format, _G_va_list __arg), __isoc99_vsscanf) 398 __attribute__ ((__format__(__scanf__, 2, 0))); 399 # else 400 extern int __isoc99_vfscanf(FILE * __restrict __s, const char *__restrict __format, _G_va_list __arg) __wur; 401 extern int __isoc99_vscanf(const char *__restrict __format, _G_va_list __arg) __wur; 402 extern int __isoc99_vsscanf(const char *__restrict __s, const char *__restrict __format, _G_va_list __arg) __THROW; 403 # define vfscanf __isoc99_vfscanf 404 # define vscanf __isoc99_vscanf 405 # define vsscanf __isoc99_vsscanf 406 # endif 407 # endif 408 #endif /* Use ISO C9x. */ 409 410 /* Read a character from STREAM. 411 412 These functions are possible cancellation points and therefore not 413 marked with __THROW. */ 414 extern int fgetc(FILE * __stream); 415 extern int getc(FILE * __stream); 416 417 /* Read a character from stdin. 418 419 This function is a possible cancellation point and therefore not 420 marked with __THROW. */ 421 extern int getchar(void); 422 423 /* The C standard explicitly says this is a macro, so we always do the 424 optimization for it. */ 425 #define getc(_fp) _IO_getc (_fp) 426 427 #ifdef __USE_POSIX199506 428 /* These are defined in POSIX.1:1996. 429 430 These functions are possible cancellation points and therefore not 431 marked with __THROW. */ 432 extern int getc_unlocked(FILE * __stream); 433 extern int getchar_unlocked(void); 434 #endif /* Use POSIX. */ 435 436 #ifdef __USE_MISC 437 /* Faster version when locking is not necessary. 438 439 This function is not part of POSIX and therefore no official 440 cancellation point. But due to similarity with an POSIX interface 441 or due to the implementation it is a cancellation point and 442 therefore not marked with __THROW. */ 443 extern int fgetc_unlocked(FILE * __stream); 444 #endif /* Use MISC. */ 445 446 /* Write a character to STREAM. 447 448 These functions are possible cancellation points and therefore not 449 marked with __THROW. 450 451 These functions is a possible cancellation point and therefore not 452 marked with __THROW. */ 453 extern int fputc(int __c, FILE * __stream); 454 extern int putc(int __c, FILE * __stream); 455 456 /* Write a character to stdout. 457 458 This function is a possible cancellation point and therefore not 459 marked with __THROW. */ 460 extern int putchar(int __c); 461 462 /* The C standard explicitly says this can be a macro, 463 so we always do the optimization for it. */ 464 #define putc(_ch, _fp) _IO_putc (_ch, _fp) 465 466 #ifdef __USE_MISC 467 /* Faster version when locking is not necessary. 468 469 This function is not part of POSIX and therefore no official 470 cancellation point. But due to similarity with an POSIX interface 471 or due to the implementation it is a cancellation point and 472 therefore not marked with __THROW. */ 473 extern int fputc_unlocked(int __c, FILE * __stream); 474 #endif /* Use MISC. */ 475 476 #ifdef __USE_POSIX199506 477 /* These are defined in POSIX.1:1996. 478 479 These functions are possible cancellation points and therefore not 480 marked with __THROW. */ 481 extern int putc_unlocked(int __c, FILE * __stream); 482 extern int putchar_unlocked(int __c); 483 #endif /* Use POSIX. */ 484 485 #if defined __USE_MISC \ 486 || (defined __USE_XOPEN && !defined __USE_XOPEN2K) 487 /* Get a word (int) from STREAM. */ 488 extern int getw(FILE * __stream); 489 490 /* Write a word (int) to STREAM. */ 491 extern int putw(int __w, FILE * __stream); 492 #endif 493 494 /* Get a newline-terminated string of finite length from STREAM. 495 496 This function is a possible cancellation point and therefore not 497 marked with __THROW. */ 498 extern char *fgets(char *__restrict __s, int __n, FILE * __restrict __stream) __wur; 499 500 #if __GLIBC_USE (DEPRECATED_GETS) 501 /* Get a newline-terminated string from stdin, removing the newline. 502 503 This function is impossible to use safely. It has been officially 504 removed from ISO C11 and ISO C++14, and we have also removed it 505 from the _GNU_SOURCE feature list. It remains available when 506 explicitly using an old ISO C, Unix, or POSIX standard. 507 508 This function is a possible cancellation point and therefore not 509 marked with __THROW. */ 510 extern char *gets(char *__s) 511 __wur __attribute_deprecated__; 512 #endif 513 514 #ifdef __USE_GNU 515 /* This function does the same as `fgets' but does not lock the stream. 516 517 This function is not part of POSIX and therefore no official 518 cancellation point. But due to similarity with an POSIX interface 519 or due to the implementation it is a cancellation point and 520 therefore not marked with __THROW. */ 521 extern char *fgets_unlocked(char *__restrict __s, int __n, FILE * __restrict __stream) __wur; 522 #endif 523 524 #if defined __USE_XOPEN2K8 || __GLIBC_USE (LIB_EXT2) 525 /* Read up to (and including) a DELIMITER from STREAM into *LINEPTR 526 (and null-terminate it). *LINEPTR is a pointer returned from malloc (or 527 NULL), pointing to *N characters of space. It is realloc'd as 528 necessary. Returns the number of characters read (not including the 529 null terminator), or -1 on error or EOF. 530 531 These functions are not part of POSIX and therefore no official 532 cancellation point. But due to similarity with an POSIX interface 533 or due to the implementation they are cancellation points and 534 therefore not marked with __THROW. */ 535 extern _IO_ssize_t __getdelim(char **__restrict __lineptr, size_t * __restrict __n, int __delimiter, FILE * __restrict __stream) __wur; 536 extern _IO_ssize_t getdelim(char **__restrict __lineptr, size_t * __restrict __n, int __delimiter, FILE * __restrict __stream) __wur; 537 538 /* Like `getdelim', but reads up to a newline. 539 540 This function is not part of POSIX and therefore no official 541 cancellation point. But due to similarity with an POSIX interface 542 or due to the implementation it is a cancellation point and 543 therefore not marked with __THROW. */ 544 extern _IO_ssize_t getline(char **__restrict __lineptr, size_t * __restrict __n, FILE * __restrict __stream) __wur; 545 #endif 546 547 /* Write a string to STREAM. 548 549 This function is a possible cancellation point and therefore not 550 marked with __THROW. */ 551 extern int fputs(const char *__restrict __s, FILE * __restrict __stream); 552 553 /* Write a string, followed by a newline, to stdout. 554 555 This function is a possible cancellation point and therefore not 556 marked with __THROW. */ 557 extern int puts(const char *__s); 558 559 /* Push a character back onto the input buffer of STREAM. 560 561 This function is a possible cancellation point and therefore not 562 marked with __THROW. */ 563 extern int ungetc(int __c, FILE * __stream); 564 565 /* Read chunks of generic data from STREAM. 566 567 This function is a possible cancellation point and therefore not 568 marked with __THROW. */ 569 extern size_t fread(void *__restrict __ptr, size_t __size, size_t __n, FILE * __restrict __stream) __wur; 570 /* Write chunks of generic data to STREAM. 571 572 This function is a possible cancellation point and therefore not 573 marked with __THROW. */ 574 extern size_t fwrite(const void *__restrict __ptr, size_t __size, size_t __n, FILE * __restrict __s); 575 576 #ifdef __USE_GNU 577 /* This function does the same as `fputs' but does not lock the stream. 578 579 This function is not part of POSIX and therefore no official 580 cancellation point. But due to similarity with an POSIX interface 581 or due to the implementation it is a cancellation point and 582 therefore not marked with __THROW. */ 583 extern int fputs_unlocked(const char *__restrict __s, FILE * __restrict __stream); 584 #endif 585 586 #ifdef __USE_MISC 587 /* Faster versions when locking is not necessary. 588 589 These functions are not part of POSIX and therefore no official 590 cancellation point. But due to similarity with an POSIX interface 591 or due to the implementation they are cancellation points and 592 therefore not marked with __THROW. */ 593 extern size_t fread_unlocked(void *__restrict __ptr, size_t __size, size_t __n, FILE * __restrict __stream) __wur; 594 extern size_t fwrite_unlocked(const void *__restrict __ptr, size_t __size, size_t __n, FILE * __restrict __stream); 595 #endif 596 597 /* Seek to a certain position on STREAM. 598 599 This function is a possible cancellation point and therefore not 600 marked with __THROW. */ 601 extern int fseek(FILE * __stream, long int __off, int __whence); 602 /* Return the current position of STREAM. 603 604 This function is a possible cancellation point and therefore not 605 marked with __THROW. */ 606 extern long int ftell(FILE * __stream) __wur; 607 /* Rewind to the beginning of STREAM. 608 609 This function is a possible cancellation point and therefore not 610 marked with __THROW. */ 611 extern void rewind(FILE * __stream); 612 613 /* The Single Unix Specification, Version 2, specifies an alternative, 614 more adequate interface for the two functions above which deal with 615 file offset. `long int' is not the right type. These definitions 616 are originally defined in the Large File Support API. */ 617 618 #if defined __USE_LARGEFILE || defined __USE_XOPEN2K 619 # ifndef __USE_FILE_OFFSET64 620 /* Seek to a certain position on STREAM. 621 622 This function is a possible cancellation point and therefore not 623 marked with __THROW. */ 624 extern int fseeko(FILE * __stream, __off_t __off, int __whence); 625 /* Return the current position of STREAM. 626 627 This function is a possible cancellation point and therefore not 628 marked with __THROW. */ 629 extern __off_t ftello(FILE * __stream) __wur; 630 # else 631 # ifdef __REDIRECT 632 extern int __REDIRECT(fseeko, (FILE * __stream, __off64_t __off, int __whence), fseeko64); 633 extern __off64_t __REDIRECT(ftello, (FILE * __stream), ftello64); 634 # else 635 # define fseeko fseeko64 636 # define ftello ftello64 637 # endif 638 # endif 639 #endif 640 641 #ifndef __USE_FILE_OFFSET64 642 /* Get STREAM's position. 643 644 This function is a possible cancellation point and therefore not 645 marked with __THROW. */ 646 extern int fgetpos(FILE * __restrict __stream, fpos_t * __restrict __pos); 647 /* Set STREAM's position. 648 649 This function is a possible cancellation point and therefore not 650 marked with __THROW. */ 651 extern int fsetpos(FILE * __stream, const fpos_t * __pos); 652 #else 653 # ifdef __REDIRECT 654 extern int __REDIRECT(fgetpos, (FILE * __restrict __stream, fpos_t * __restrict __pos), fgetpos64); 655 extern int __REDIRECT(fsetpos, (FILE * __stream, const fpos_t * __pos), fsetpos64); 656 # else 657 # define fgetpos fgetpos64 658 # define fsetpos fsetpos64 659 # endif 660 #endif 661 662 #ifdef __USE_LARGEFILE64 663 extern int fseeko64(FILE * __stream, __off64_t __off, int __whence); 664 extern __off64_t ftello64(FILE * __stream) __wur; 665 extern int fgetpos64(FILE * __restrict __stream, fpos64_t * __restrict __pos); 666 extern int fsetpos64(FILE * __stream, const fpos64_t * __pos); 667 #endif 668 669 /* Clear the error and EOF indicators for STREAM. */ 670 extern void clearerr(FILE * __stream) __THROW; 671 /* Return the EOF indicator for STREAM. */ 672 extern int feof(FILE * __stream) 673 __THROW __wur; 674 /* Return the error indicator for STREAM. */ 675 extern int ferror(FILE * __stream) 676 __THROW __wur; 677 678 #ifdef __USE_MISC 679 /* Faster versions when locking is not required. */ 680 extern void clearerr_unlocked(FILE * __stream) __THROW; 681 extern int feof_unlocked(FILE * __stream) 682 __THROW __wur; 683 extern int ferror_unlocked(FILE * __stream) 684 __THROW __wur; 685 #endif 686 687 /* Print a message describing the meaning of the value of errno. 688 689 This function is a possible cancellation point and therefore not 690 marked with __THROW. */ 691 extern void perror(const char *__s); 692 693 /* Provide the declarations for `sys_errlist' and `sys_nerr' if they 694 are available on this system. Even if available, these variables 695 should not be used directly. The `strerror' function provides 696 all the necessary functionality. */ 697 #include <bits/sys_errlist.h> 698 699 #ifdef __USE_POSIX 700 /* Return the system file descriptor for STREAM. */ 701 extern int fileno(FILE * __stream) 702 __THROW __wur; 703 #endif /* Use POSIX. */ 704 705 #ifdef __USE_MISC 706 /* Faster version when locking is not required. */ 707 extern int fileno_unlocked(FILE * __stream) 708 __THROW __wur; 709 #endif 710 711 #ifdef __USE_POSIX2 712 /* Create a new stream connected to a pipe running the given command. 713 714 This function is a possible cancellation point and therefore not 715 marked with __THROW. */ 716 extern FILE *popen(const char *__command, const char *__modes) __wur; 717 718 /* Close a stream opened by popen and return the status of its child. 719 720 This function is a possible cancellation point and therefore not 721 marked with __THROW. */ 722 extern int pclose(FILE * __stream); 723 #endif 724 725 #ifdef __USE_POSIX 726 /* Return the name of the controlling terminal. */ 727 extern char *ctermid(char *__s) __THROW; 728 #endif /* Use POSIX. */ 729 730 #if (defined __USE_XOPEN && !defined __USE_XOPEN2K) || defined __USE_GNU 731 /* Return the name of the current user. */ 732 extern char *cuserid(char *__s); 733 #endif /* Use X/Open, but not issue 6. */ 734 735 #ifdef __USE_GNU 736 struct obstack; /* See <obstack.h>. */ 737 738 /* Write formatted output to an obstack. */ 739 extern int obstack_printf(struct obstack *__restrict __obstack, const char *__restrict __format, ...) 740 __THROWNL __attribute__ ((__format__(__printf__, 2, 3))); 741 extern int obstack_vprintf(struct obstack *__restrict __obstack, const char *__restrict __format, _G_va_list __args) 742 __THROWNL __attribute__ ((__format__(__printf__, 2, 0))); 743 #endif /* Use GNU. */ 744 745 #ifdef __USE_POSIX199506 746 /* These are defined in POSIX.1:1996. */ 747 748 /* Acquire ownership of STREAM. */ 749 extern void flockfile(FILE * __stream) __THROW; 750 751 /* Try to acquire ownership of STREAM but do not block if it is not 752 possible. */ 753 extern int ftrylockfile(FILE * __stream) 754 __THROW __wur; 755 756 /* Relinquish the ownership granted for STREAM. */ 757 extern void funlockfile(FILE * __stream) __THROW; 758 #endif /* POSIX */ 759 760 #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU 761 /* X/Open Issues 1-5 required getopt to be declared in this 762 header. It was removed in Issue 6. GNU follows Issue 6. */ 763 # include <bits/getopt_posix.h> 764 #endif 765 766 /* If we are compiling with optimizing read this file. It contains 767 several optimizing inline functions and macros. */ 768 #ifdef __USE_EXTERN_INLINES 769 # include <bits/stdio.h> 770 #endif 771 #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function 772 # include <bits/stdio2.h> 773 #endif 774 #ifdef __LDBL_COMPAT 775 # include <bits/stdio-ldbl.h> 776 #endif 777 778 __END_DECLS 779 #endif /* <stdio.h> included. */