PatchworkOS
Loading...
Searching...
No Matches
stdio.h File Reference
#include <stdarg.h>
#include "_internal/MAX_PATH.h"
#include "_internal/NULL.h"
#include "_internal/SEEK.h"
#include "_internal/config.h"
#include "_internal/fd_t.h"
#include "_internal/size_t.h"

Go to the source code of this file.

Macros

#define _IOFBF   (1u << 0)
 
#define _IOLBF   (1u << 1)
 
#define _IONBF   (1u << 2)
 
#define EOF   (-1)
 
#define BUFSIZ   1024
 
#define FOPEN_MAX   8
 
#define FILENAME_MAX   MAX_PATH
 
#define L_tmpnam   46
 
#define TMP_MAX   50
 

Typedefs

typedef struct fpos fpos_t
 

Functions

_PUBLIC int remove (const char *filename)
 
_PUBLIC int rename (const char *oldpath, const char *newpath)
 
_PUBLIC FILEtmpfile (void)
 
_PUBLIC char * tmpnam (char *s)
 
_PUBLIC int fclose (FILE *stream)
 
_PUBLIC int fflush (FILE *stream)
 
_PUBLIC FILEfopen (const char *_RESTRICT filename, const char *_RESTRICT mode)
 
_PUBLIC FILEfreopen (const char *_RESTRICT filename, const char *_RESTRICT mode, FILE *_RESTRICT stream)
 
_PUBLIC void setbuf (FILE *_RESTRICT stream, char *_RESTRICT buf)
 
_PUBLIC int setvbuf (FILE *_RESTRICT stream, char *_RESTRICT buf, int mode, size_t size)
 
_PUBLIC int fprintf (FILE *_RESTRICT stream, const char *_RESTRICT format,...)
 
_PUBLIC int fscanf (FILE *_RESTRICT stream, const char *_RESTRICT format,...)
 
_PUBLIC int printf (const char *_RESTRICT format,...)
 
_PUBLIC int scanf (const char *_RESTRICT format,...)
 
_PUBLIC int snprintf (char *_RESTRICT s, size_t n, const char *_RESTRICT format,...)
 
_PUBLIC int sprintf (char *_RESTRICT s, const char *_RESTRICT format,...)
 
_PUBLIC int sscanf (const char *_RESTRICT s, const char *_RESTRICT format,...)
 
_PUBLIC int vfprintf (FILE *_RESTRICT stream, const char *_RESTRICT format, va_list arg)
 
_PUBLIC int vfscanf (FILE *_RESTRICT stream, const char *_RESTRICT format, va_list arg)
 
_PUBLIC int vprintf (const char *_RESTRICT format, va_list arg)
 
_PUBLIC int vscanf (const char *_RESTRICT format, va_list arg)
 
_PUBLIC int vsnprintf (char *_RESTRICT s, size_t n, const char *_RESTRICT format, va_list arg)
 
_PUBLIC int vsprintf (char *_RESTRICT s, const char *_RESTRICT format, va_list arg)
 
_PUBLIC int vsscanf (const char *_RESTRICT s, const char *_RESTRICT format, va_list arg)
 
_PUBLIC int fgetc (FILE *stream)
 
_PUBLIC char * fgets (char *_RESTRICT s, int n, FILE *_RESTRICT stream)
 
_PUBLIC int fputc (int c, FILE *stream)
 
_PUBLIC int fputs (const char *_RESTRICT s, FILE *_RESTRICT stream)
 
_PUBLIC int getc (FILE *stream)
 
_PUBLIC int getchar (void)
 
_PUBLIC int putc (int c, FILE *stream)
 
_PUBLIC int putchar (int c)
 
_PUBLIC int puts (const char *s)
 
_PUBLIC int ungetc (int c, FILE *stream)
 
_PUBLIC size_t fread (void *_RESTRICT ptr, size_t size, size_t nmemb, FILE *_RESTRICT stream)
 
_PUBLIC size_t fwrite (const void *_RESTRICT ptr, size_t size, size_t nmemb, FILE *_RESTRICT stream)
 
_PUBLIC int fgetpos (FILE *_RESTRICT stream, fpos_t *_RESTRICT pos)
 
_PUBLIC int fseek (FILE *stream, long int offset, int whence)
 
_PUBLIC int fsetpos (FILE *stream, const fpos_t *pos)
 
_PUBLIC long int ftell (FILE *stream)
 
_PUBLIC void rewind (FILE *stream)
 
_PUBLIC void clearerr (FILE *stream)
 
_PUBLIC int feof (FILE *stream)
 
_PUBLIC int ferror (FILE *stream)
 
_PUBLIC void perror (const char *s)
 

Variables

FILEstdin
 
FILEstdout
 
FILEstderr
 

Macro Definition Documentation

◆ _IOFBF

#define _IOFBF   (1u << 0)

Definition at line 18 of file stdio.h.

◆ _IOLBF

#define _IOLBF   (1u << 1)

Definition at line 19 of file stdio.h.

◆ _IONBF

#define _IONBF   (1u << 2)

Definition at line 20 of file stdio.h.

◆ BUFSIZ

#define BUFSIZ   1024

Definition at line 26 of file stdio.h.

◆ EOF

#define EOF   (-1)

Definition at line 25 of file stdio.h.

◆ FILENAME_MAX

#define FILENAME_MAX   MAX_PATH

Definition at line 28 of file stdio.h.

◆ FOPEN_MAX

#define FOPEN_MAX   8

Definition at line 27 of file stdio.h.

◆ L_tmpnam

#define L_tmpnam   46

Definition at line 30 of file stdio.h.

◆ TMP_MAX

#define TMP_MAX   50

Definition at line 31 of file stdio.h.

Typedef Documentation

◆ fpos_t

typedef struct fpos fpos_t

Definition at line 22 of file stdio.h.

Function Documentation

◆ clearerr()

_PUBLIC void clearerr ( FILE stream)

Definition at line 5 of file clearerr.c.

References _FILE_EOF, _FILE_ERROR, and FILE::flags.

◆ fclose()

◆ feof()

_PUBLIC int feof ( FILE stream)

Definition at line 5 of file feof.c.

References _FILE_EOF, and FILE::flags.

Referenced by vfscanf().

◆ ferror()

_PUBLIC int ferror ( FILE stream)

Definition at line 5 of file ferror.c.

References _FILE_ERROR, and FILE::flags.

Referenced by vfscanf().

◆ fflush()

◆ fgetc()

_PUBLIC int fgetc ( FILE stream)

Definition at line 7 of file fgetc.c.

References _FILE_CHECK_AVAIL, _FILE_GETC, _file_prepare_read(), EOF, ERR, FILE::mtx, mtx_lock(), and mtx_unlock().

Referenced by getc(), and getchar().

◆ fgetpos()

_PUBLIC int fgetpos ( FILE *_RESTRICT  stream,
fpos_t *_RESTRICT  pos 
)

◆ fgets()

_PUBLIC char * fgets ( char *_RESTRICT  s,
int  n,
FILE *_RESTRICT  stream 
)

◆ fopen()

◆ fprintf()

_PUBLIC int fprintf ( FILE *_RESTRICT  stream,
const char *_RESTRICT  format,
  ... 
)

◆ fputc()

_PUBLIC int fputc ( int  c,
FILE stream 
)

◆ fputs()

_PUBLIC int fputs ( const char *_RESTRICT  s,
FILE *_RESTRICT  stream 
)

◆ fread()

_PUBLIC size_t fread ( void *_RESTRICT  ptr,
size_t  size,
size_t  nmemb,
FILE *_RESTRICT  stream 
)

Definition at line 7 of file fread.c.

References _FILE_CHECK_AVAIL, _FILE_GETC, _file_prepare_read(), ERR, mtx_lock(), and mtx_unlock().

◆ freopen()

_PUBLIC FILE * freopen ( const char *_RESTRICT  filename,
const char *_RESTRICT  mode,
FILE *_RESTRICT  stream 
)

◆ fscanf()

_PUBLIC int fscanf ( FILE *_RESTRICT  stream,
const char *_RESTRICT  format,
  ... 
)

Definition at line 4 of file fscanf.c.

References va_end, va_start, and vfscanf().

Referenced by mem_stat_read().

◆ fseek()

_PUBLIC int fseek ( FILE stream,
long int  offset,
int  whence 
)

◆ fsetpos()

_PUBLIC int fsetpos ( FILE stream,
const fpos_t pos 
)

◆ ftell()

_PUBLIC long int ftell ( FILE stream)

◆ fwrite()

_PUBLIC size_t fwrite ( const void *_RESTRICT  ptr,
size_t  size,
size_t  nmemb,
FILE *_RESTRICT  stream 
)

◆ getc()

_PUBLIC int getc ( FILE stream)

Definition at line 7 of file getc.c.

References fgetc().

Referenced by vfscanf().

◆ getchar()

_PUBLIC int getchar ( void  )

Definition at line 7 of file getchar.c.

References fgetc(), and stdin.

◆ perror()

_PUBLIC void perror ( const char *  s)

Definition at line 5 of file perror.c.

References errno, fprintf(), NULL, stderr, and strerror().

Referenced by benchmark_mmap(), client_receive_cmds(), and client_send_all().

◆ printf()

◆ putc()

_PUBLIC int putc ( int  c,
FILE stream 
)

Definition at line 7 of file putc.c.

References fputc().

◆ putchar()

_PUBLIC int putchar ( int  c)

Definition at line 7 of file putchar.c.

References fputc(), and stdout.

◆ puts()

_PUBLIC int puts ( const char *  s)

◆ remove()

_PUBLIC int remove ( const char *  filename)

Definition at line 6 of file remove.c.

References _syscall_errno(), _syscall_remove(), EOF, ERR, and errno.

Referenced by main().

◆ rename()

_PUBLIC int rename ( const char *  oldpath,
const char *  newpath 
)

Definition at line 5 of file rename.c.

References _syscall_errno(), _syscall_link(), _syscall_remove(), EOF, ERR, and errno.

Referenced by main().

◆ rewind()

_PUBLIC void rewind ( FILE stream)

◆ scanf()

_PUBLIC int scanf ( const char *_RESTRICT  format,
  ... 
)

◆ setbuf()

_PUBLIC void setbuf ( FILE *_RESTRICT  stream,
char *_RESTRICT  buf 
)

◆ setvbuf()

_PUBLIC int setvbuf ( FILE *_RESTRICT  stream,
char *_RESTRICT  buf,
int  mode,
size_t  size 
)

◆ snprintf()

◆ sprintf()

_PUBLIC int sprintf ( char *_RESTRICT  s,
const char *_RESTRICT  format,
  ... 
)

◆ sscanf()

_PUBLIC int sscanf ( const char *_RESTRICT  s,
const char *_RESTRICT  format,
  ... 
)

Definition at line 4 of file sscanf.c.

References va_end, va_start, and vsscanf().

Referenced by cpu_stat_read(), and terminal_columns_get().

◆ tmpfile()

_PUBLIC FILE * tmpfile ( void  )

◆ tmpnam()

_PUBLIC char * tmpnam ( char *  s)

◆ ungetc()

_PUBLIC int ungetc ( int  c,
FILE stream 
)

Definition at line 5 of file ungetc.c.

References _UNGETC_MAX, EOF, FILE::mtx, mtx_lock(), mtx_unlock(), FILE::ungetBuf, and FILE::ungetIndex.

Referenced by _scan_unget(), and vfscanf().

◆ vfprintf()

◆ vfscanf()

◆ vprintf()

_PUBLIC int vprintf ( const char *_RESTRICT  format,
va_list  arg 
)

Definition at line 5 of file vprintf.c.

References stdout, and vfprintf().

◆ vscanf()

_PUBLIC int vscanf ( const char *_RESTRICT  format,
va_list  arg 
)

◆ vsnprintf()

◆ vsprintf()

_PUBLIC int vsprintf ( char *_RESTRICT  s,
const char *_RESTRICT  format,
va_list  arg 
)

Definition at line 5 of file vsprintf.c.

References SIZE_MAX, and vsnprintf().

◆ vsscanf()

Variable Documentation

◆ stderr

◆ stdin

FILE* stdin
extern

Definition at line 16 of file std_streams.c.

Referenced by _file_free(), _std_streams_init(), and getchar().

◆ stdout