akaros/kern/include/stdio.h
<<
>>
Prefs
   1#pragma once
   2
   3#include <ros/common.h>
   4#include <stdarg.h>
   5#include <kdebug.h>
   6
   7#ifndef NULL
   8#define NULL    ((void *) 0)
   9#endif /* !NULL */
  10
  11//#define DEBUG
  12#ifdef DEBUG
  13#define printd(args...) cprintf(args)
  14#else
  15#define printd(args...) {}
  16#endif
  17
  18#define printk(args...) cprintf(args)
  19#define __I_AM_HERE_GUTS "Core %d is in %s() at %s:%d\n", core_id(), \
  20                         __func__, __FILE__, __LINE__
  21
  22#define I_AM_HERE printk(__I_AM_HERE_GUTS)
  23#define I_AM_HERE_x printx(__I_AM_HERE_GUTS)
  24#define I_AM_HERE_t trace_printk(__I_AM_HERE_GUTS)
  25#define I_AM_HERE_tx trace_printx(__I_AM_HERE_GUTS)
  26
  27// lib/stdio.c
  28void    cputchar(int c);
  29void    cputbuf(const char *buf, int len);
  30int     getchar(void);
  31int     iscons(int fd);
  32
  33// lib/printfmt.c
  34void    printfmt(void (*putch)(int, void**), void **putdat, const char *fmt, ...);
  35void    vprintfmt(void (*putch)(int, void**), void **putdat, const char *fmt, va_list);
  36
  37// lib/printf.c
  38extern bool panic_skip_print_lock;
  39void print_lock(void);
  40void print_unlock(void);
  41void print_unlock_force(void);
  42int     ( cprintf)(const char *fmt, ...);
  43int     vcprintf(const char *fmt, va_list);
  44
  45// lib/sprintf.c
  46
  47static inline bool snprintf_error(int ret, size_t buf_len)
  48{
  49        return ret < 0 || ret >= buf_len;
  50}
  51
  52int snprintf(char *str, size_t size, const char *fmt, ...);
  53int vsnprintf(char *str, size_t size, const char *fmt, va_list);
  54
  55// lib/fprintf.c
  56int     printf(const char *fmt, ...);
  57int     fprintf(int fd, const char *fmt, ...);
  58int     vfprintf(int fd, const char *fmt, va_list);
  59
  60// lib/readline.c
  61int readline(char *buf, size_t buf_l, const char *prompt, ...);
  62
  63char *seprintf(char *buf, char *end, const char *fmt, ...);
  64
  65// kern/src/net/eipconv.c
  66void printemac(void (*putch)(int, void**), void **putdat, uint8_t *mac);
  67void printip(void (*putch)(int, void**), void **putdat, uint8_t *ip);
  68void printipmask(void (*putch)(int, void**), void **putdat, uint8_t *ip);
  69void printipv4(void (*putch)(int, void**), void **putdat, uint8_t *ip);
  70
  71/* #K */
  72void trace_printk(const char *fmt, ...);
  73
  74/* vsprintf.c (linux) */
  75int vsscanf(const char *buf, const char *fmt, va_list args);
  76int sscanf(const char *buf, const char *fmt, ...);
  77