PKUOS - Pintos
Pintos source browser for PKU Operating System course
stdio.h
Go to the documentation of this file.
1#ifndef __LIB_STDIO_H
2#define __LIB_STDIO_H
3
4#include <debug.h>
5#include <stdarg.h>
6#include <stdbool.h>
7#include <stddef.h>
8#include <stdint.h>
9
10/** Include lib/user/stdio.h or lib/kernel/stdio.h, as
11 appropriate. */
12#include_next <stdio.h>
13
14/** Predefined file handles. */
15#define STDIN_FILENO 0
16#define STDOUT_FILENO 1
17
18/** Standard functions. */
19int printf (const char *, ...) PRINTF_FORMAT (1, 2);
20int snprintf (char *, size_t, const char *, ...) PRINTF_FORMAT (3, 4);
21int vprintf (const char *, va_list) PRINTF_FORMAT (1, 0);
22int vsnprintf (char *, size_t, const char *, va_list) PRINTF_FORMAT (3, 0);
23int putchar (int);
24int puts (const char *);
25
26/** Nonstandard functions. */
27void hex_dump (uintptr_t ofs, const void *, size_t size, bool ascii);
29
30/** Internal functions. */
31void __vprintf (const char *format, va_list args,
32 void (*output) (char, void *), void *aux);
33void __printf (const char *format,
34 void (*output) (char, void *), void *aux, ...);
35
36/** Try to be helpful. */
37#define sprintf dont_use_sprintf_use_snprintf
38#define vsprintf dont_use_vsprintf_use_vsnprintf
39
40#endif /**< lib/stdio.h */
#define PRINTF_FORMAT(FMT, FIRST)
Definition: debug.h:10
__builtin_va_list va_list
GCC has <stdarg.h> functionality as built-ins, so all we need is to use it.
Definition: stdarg.h:7
uint32_t uintptr_t
Definition: stdint.h:36
unsigned long long int uint64_t
Definition: stdint.h:29
void __printf(const char *format, void(*output)(char, void *), void *aux,...)
Wrapper for __vprintf() that converts varargs into a va_list.
Definition: stdio.c:577
int int int int int putchar(int)
Writes C to the vga display and serial port.
Definition: console.c:163
int int snprintf(char *, size_t, const char *,...) PRINTF_FORMAT(3
int int int vprintf(const char *, va_list) PRINTF_FORMAT(1
void __vprintf(const char *format, va_list args, void(*output)(char, void *), void *aux)
Internal functions.
Definition: stdio.c:157
void hex_dump(uintptr_t ofs, const void *, size_t size, bool ascii)
Nonstandard functions.
Definition: stdio.c:593
void print_human_readable_size(uint64_t sz)
Prints SIZE, which represents a number of bytes, in a human-readable format, e.g.
Definition: stdio.c:642
int printf(const char *,...) PRINTF_FORMAT(1
Standard functions.
int int int int vsnprintf(char *, size_t, const char *, va_list) PRINTF_FORMAT(3
int puts(const char *)
Writes string S to the console, followed by a new-line character.
Definition: console.c:140