PKUOS - Pintos
Pintos source browser for PKU Operating System course
Macros | Functions
stdio.h File Reference
#include <debug.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for stdio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define STDIN_FILENO   0
 Include lib/user/stdio.h or lib/kernel/stdio.h, as appropriate. More...
 
#define STDOUT_FILENO   1
 
#define sprintf   dont_use_sprintf_use_snprintf
 Try to be helpful. More...
 
#define vsprintf   dont_use_vsprintf_use_vsnprintf
 lib/stdio.h More...
 

Functions

int printf (const char *,...) PRINTF_FORMAT(1
 Standard functions. More...
 
int int snprintf (char *, size_t, const char *,...) PRINTF_FORMAT(3
 
int int int vprintf (const char *, va_list) PRINTF_FORMAT(1
 
int int int int vsnprintf (char *, size_t, const char *, va_list) PRINTF_FORMAT(3
 
int int int int int putchar (int)
 Writes C to the vga display and serial port. More...
 
int puts (const char *)
 Writes string S to the console, followed by a new-line character. More...
 
void hex_dump (uintptr_t ofs, const void *, size_t size, bool ascii)
 Nonstandard functions. More...
 
void print_human_readable_size (uint64_t sz)
 Prints SIZE, which represents a number of bytes, in a human-readable format, e.g. More...
 
void __vprintf (const char *format, va_list args, void(*output)(char, void *), void *aux)
 Internal functions. More...
 
void __printf (const char *format, void(*output)(char, void *), void *aux,...)
 Wrapper for __vprintf() that converts varargs into a va_list. More...
 

Macro Definition Documentation

◆ sprintf

#define sprintf   dont_use_sprintf_use_snprintf

Try to be helpful.

Definition at line 37 of file stdio.h.

◆ STDIN_FILENO

#define STDIN_FILENO   0

Include lib/user/stdio.h or lib/kernel/stdio.h, as appropriate.

Predefined file handles.

Definition at line 15 of file stdio.h.

◆ STDOUT_FILENO

#define STDOUT_FILENO   1

Definition at line 16 of file stdio.h.

◆ vsprintf

#define vsprintf   dont_use_vsprintf_use_vsnprintf

lib/stdio.h

Definition at line 40 of file stdio.h.

Function Documentation

◆ __printf()

void __printf ( const char *  format,
void(*)(char, void *)  output,
void *  aux,
  ... 
)

Wrapper for __vprintf() that converts varargs into a va_list.

Definition at line 577 of file stdio.c.

References __vprintf(), va_end, and va_start.

Referenced by __vprintf().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ __vprintf()

void __vprintf ( const char *  format,
va_list  args,
void(*)(char, void *)  output,
void *  aux 
)

◆ hex_dump()

void hex_dump ( uintptr_t  ofs,
const void *  buf_,
size_t  size,
bool  ascii 
)

Nonstandard functions.

Nonstandard functions.

Numeric offsets are also included, starting at OFS for the first byte in BUF. If ASCII is true then the corresponding ASCII characters are also rendered alongside.

< Maximum bytes per line.

Definition at line 593 of file stdio.c.

References buf, isprint(), printf(), ROUND_DOWN, and start.

Referenced by bitmap_dump(), compare_bytes(), fsutil_cat(), and main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print_human_readable_size()

void print_human_readable_size ( uint64_t  size)

Prints SIZE, which represents a number of bytes, in a human-readable format, e.g.

"256 kB".

Definition at line 642 of file stdio.c.

References NULL, printf(), and PRIu64.

Referenced by block_register(), and identify_ata_device().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printf()

int printf ( const char *  ,
  ... 
)

Standard functions.

◆ putchar()

int int int int int putchar ( int  c)

Writes C to the vga display and serial port.

Writes C to the vga display and serial port.

Definition at line 163 of file console.c.

References acquire_console(), putchar_have_lock(), release_console(), STDOUT_FILENO, and write().

Referenced by fail(), msg(), puts(), and read_line().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ puts()

int puts ( const char *  s)

Writes string S to the console, followed by a new-line character.

Definition at line 140 of file console.c.

References acquire_console(), putchar(), putchar_have_lock(), release_console(), s, STDOUT_FILENO, strlen(), and write().

Here is the call graph for this function:

◆ snprintf()

int int snprintf ( char *  ,
size_t  ,
const char *  ,
  ... 
)

◆ vprintf()

int int int vprintf ( const char *  ,
va_list   
)

◆ vsnprintf()

int int int int vsnprintf ( char *  ,
size_t  ,
const char *  ,
va_list   
)