hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/*
 * Copyright (C) 2006 Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>.
 * Copyright (C) 2007 Jan Kiszka <jan.kiszka@web.de>.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.
 */
#pragma GCC system_header
#include_next <stdio.h>
 
#ifndef _COBALT_STDIO_H
#define _COBALT_STDIO_H
 
#include <stddef.h>
#include <stdarg.h>
#include <xeno_config.h>
#include <cobalt/wrappers.h>
 
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
 
COBALT_DECL(int, vfprintf(FILE *stream, const char *fmt, va_list args));
 
#ifdef CONFIG_XENO_FORTIFY
 
COBALT_DECL(int, __vfprintf_chk(FILE *stream, int level,
               const char *fmt, va_list ap));
 
COBALT_DECL(int, __vprintf_chk(int flag,
                  const char *fmt, va_list ap));
 
COBALT_DECL(int, __printf_chk(int flag, const char *fmt, ...));
 
COBALT_DECL(int, __fprintf_chk(FILE *fp, int flag, const char *fmt, ...));
 
int __rt_vfprintf_chk(FILE *stream, int level,
             const char *fmt, va_list args);
 
void __rt_vsyslog_chk(int priority, int level,
             const char *fmt, va_list args);
 
#endif    /* CONFIG_XENO_FORTIFY */
 
COBALT_DECL(int, vprintf(const char *fmt, va_list args));
 
COBALT_DECL(int, fprintf(FILE *stream, const char *fmt, ...));
 
COBALT_DECL(int, printf(const char *fmt, ...));
 
COBALT_DECL(int, puts(const char *s));
 
COBALT_DECL(int, fputs(const char *s, FILE *stream));
 
#ifndef putchar
COBALT_DECL(int, putchar(int c));
#else
static inline int __real_putchar(int c)
{
   return putchar(c);
}
int __wrap_putchar(int c);
int __cobalt_putchar(int c);
#undef putchar
#define putchar putchar
#endif
 
#ifndef fputc
COBALT_DECL(int, fputc(int c, FILE *stream));
#else
static inline int __real_fputc(int c, FILE *stream)
{
   return fputc(c, stream);
}
int __wrap_fputc(int c, FILE *stream);
int __cobalt_fputc(int c, FILE *stream);
#undef fputc
#define fputc fputc
#endif
 
COBALT_DECL(size_t,
       fwrite(const void *ptr, size_t sz, size_t nmemb, FILE *stream));
 
COBALT_DECL(int, fclose(FILE *stream));
 
int rt_vfprintf(FILE *stream, const char *format, va_list args);
 
int rt_vprintf(const char *format, va_list args);
 
int rt_fprintf(FILE *stream, const char *format, ...);
 
int rt_printf(const char *format, ...);
 
int rt_puts(const char *s);
 
int rt_fputs(const char *s, FILE *stream);
 
int rt_fputc(int c, FILE *stream);
 
int rt_putchar(int c);
 
size_t rt_fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
 
void rt_syslog(int priority, const char *format, ...);
 
void rt_vsyslog(int priority, const char *format, va_list args);
 
int rt_print_init(size_t buffer_size, const char *name);
 
const char *rt_print_buffer_name(void);
 
void rt_print_flush_buffers(void);
 
#ifdef __cplusplus
}
#endif /* __cplusplus */
 
#endif /* !_COBALT_STDIO_H */