xref: /optee_os/lib/libutils/isoc/include/stdio.h (revision 7eaed3a3dfb33730c118d0b4f9155e53ca16af17)
11bb92983SJerome Forissier /* SPDX-License-Identifier: BSD-2-Clause */
2b0104773SPascal Brand /*
3b0104773SPascal Brand  * Copyright (c) 2014, STMicroelectronics International N.V.
4b0104773SPascal Brand  */
5*7eaed3a3SEtienne Carriere #ifndef __STDIO_H
6*7eaed3a3SEtienne Carriere #define __STDIO_H
7b0104773SPascal Brand 
8b0104773SPascal Brand #include <stddef.h>
9b0104773SPascal Brand #include <stdarg.h>
10b0104773SPascal Brand 
11b0104773SPascal Brand typedef struct _FILE FILE;
12b0104773SPascal Brand 
13b0104773SPascal Brand int printf(const char *fmt, ...)
14b0104773SPascal Brand                     __attribute__ ((__format__ (__printf__, 1, 2)));
15f35d131bSJerome Forissier /* sprintf() is unsafe and should not be used. Prefer snprintf(). */
16f35d131bSJerome Forissier int sprintf(char *str, const char *fmt, ...)
17f35d131bSJerome Forissier                     __attribute__ ((__format__ (__printf__, 2, 3)))
18f35d131bSJerome Forissier                     __attribute__ ((deprecated));
19b0104773SPascal Brand int snprintf(char *str, size_t size, const char *fmt, ...)
20b0104773SPascal Brand                     __attribute__ ((__format__ (__printf__, 3, 4)));
21b0104773SPascal Brand int vsnprintf (char *str, size_t size, const char *fmt, va_list ap)
22b0104773SPascal Brand                     __attribute__ ((__format__ (__printf__, 3, 0)));
23b224894fSSumit Garg int __sprintf_chk(char *str, int flag, size_t slen, const char *fmt, ...)
24b224894fSSumit Garg                     __attribute__ ((__format__ (__printf__, 4, 5)));
25b0104773SPascal Brand 
26b0104773SPascal Brand int puts(const char *str);
27dc454609SJerome Forissier int putchar(int c);
28b0104773SPascal Brand 
29405a5072SJerome Forissier #ifndef __KERNEL__
30405a5072SJerome Forissier 
31405a5072SJerome Forissier extern FILE *stdout;
32405a5072SJerome Forissier extern FILE *stderr;
33405a5072SJerome Forissier 
34405a5072SJerome Forissier /*
35405a5072SJerome Forissier  * The functions below send their output synchronously to the secure console.
36405a5072SJerome Forissier  * They treat stdout and stderr the same, and will abort if stream is not one or
37405a5072SJerome Forissier  * the other.
38405a5072SJerome Forissier  */
39405a5072SJerome Forissier 
40405a5072SJerome Forissier int fputc(int c, FILE *stream);
41405a5072SJerome Forissier int fputs(const char *s, FILE *stream);
42405a5072SJerome Forissier size_t fwrite(const void *ptr, size_t size, size_t nmemb, FILE *stream);
43405a5072SJerome Forissier #endif
44405a5072SJerome Forissier 
45*7eaed3a3SEtienne Carriere #endif /*__STDIO_H*/
46