[Krafton Jungle] PintOS 2.0.0
크래프톤 정글 PintOS
 
Loading...
Searching...
No Matches
console.c File Reference
#include <stdio.h>
#include <string.h>
#include <syscall.h>
#include <syscall-nr.h>
Include dependency graph for console.c:

Classes

struct  vhprintf_aux
 

Functions

int vprintf (const char *format, va_list args)
 
int hprintf (int handle, const char *format,...)
 
int puts (const char *s)
 
int putchar (int c)
 
static void add_char (char, void *)
 
static void flush (struct vhprintf_aux *)
 
int vhprintf (int handle, const char *format, va_list args)
 

Function Documentation

◆ add_char()

static void add_char ( char  c,
void *  aux_ 
)
static
72 {
73 struct vhprintf_aux *aux = aux_;
74 *aux->p++ = c;
75 if (aux->p >= aux->buf + sizeof aux->buf)
76 flush (aux);
77 aux->char_cnt++;
78}
Definition: console.c:45
char buf[64]
Definition: console.c:46
int char_cnt
Definition: console.c:48
char * p
Definition: console.c:47
static void flush(struct vhprintf_aux *)
Definition: console.c:82
Here is the call graph for this function:
Here is the caller graph for this function:

◆ flush()

static void flush ( struct vhprintf_aux aux)
static
82 {
83 if (aux->p > aux->buf)
84 write (aux->handle, aux->buf, aux->p - aux->buf);
85 aux->p = aux->buf;
86}
int write(int fd, const void *buffer, unsigned length)
열린 파일에 데이터를 쓰는 시스템 콜
Definition: syscall.c:336
int handle
Definition: console.c:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ hprintf()

int hprintf ( int  handle,
const char *  format,
  ... 
)
15 {
16 va_list args;
17 int retval;
18
19 va_start (args, format);
20 retval = vhprintf (handle, format, args);
21 va_end (args);
22
23 return retval;
24}
#define va_end(LIST)
Definition: stdarg.h:10
#define va_start(LIST, ARG)
Definition: stdarg.h:9
__builtin_va_list va_list
Definition: stdarg.h:7
int vhprintf(int handle, const char *format, va_list args)
Definition: console.c:59
Here is the call graph for this function:

◆ putchar()

int putchar ( int  c)
38 {
39 char c2 = c;
40 write (STDOUT_FILENO, &c2, 1);
41 return c;
42}
#define STDOUT_FILENO
Definition: stdio.h:16
Here is the call graph for this function:

◆ puts()

int puts ( const char *  s)
29 {
31 putchar ('\n');
32
33 return 0;
34}
int putchar(int c)
Definition: console.c:152
static uint8_t s[256]
Definition: random.c:17
size_t strlen(const char *)
Definition: string.c:271
Here is the call graph for this function:

◆ vhprintf()

int vhprintf ( int  handle,
const char *  format,
va_list  args 
)
59 {
60 struct vhprintf_aux aux;
61 aux.p = aux.buf;
62 aux.char_cnt = 0;
63 aux.handle = handle;
64 __vprintf (format, args, add_char, &aux);
65 flush (&aux);
66 return aux.char_cnt;
67}
void __vprintf(const char *format, va_list args, void(*output)(char, void *), void *aux)
Definition: stdio.c:146
static void add_char(char, void *)
Definition: console.c:72
Here is the call graph for this function:
Here is the caller graph for this function:

◆ vprintf()

int vprintf ( const char *  format,
va_list  args 
)
9 {
10 return vhprintf (STDOUT_FILENO, format, args);
11}
Here is the call graph for this function: