c670aeee3d
The sandbox is built with the SDL2 library with invokes the X11 library which in turn calls getc(). But getc() in glibc is defined as int getc(FILE *) This does not match our definition. int getc(void) The sandbox crashes when called with parameter -l. Rename our library symbol getc() to getchar(). Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
60 lines
1.2 KiB
C
60 lines
1.2 KiB
C
#ifndef __STDIO_H
|
|
#define __STDIO_H
|
|
|
|
#include <stdarg.h>
|
|
#include <linux/compiler.h>
|
|
|
|
/* stdin */
|
|
int getchar(void);
|
|
int tstc(void);
|
|
|
|
/* stdout */
|
|
#if !defined(CONFIG_SPL_BUILD) || \
|
|
(defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_SERIAL_SUPPORT)) || \
|
|
(defined(CONFIG_SPL_BUILD) && !defined(CONFIG_TPL_BUILD) && \
|
|
defined(CONFIG_SPL_SERIAL_SUPPORT))
|
|
void putc(const char c);
|
|
void puts(const char *s);
|
|
int __printf(1, 2) printf(const char *fmt, ...);
|
|
int vprintf(const char *fmt, va_list args);
|
|
#else
|
|
static inline void putc(const char c)
|
|
{
|
|
}
|
|
|
|
static inline void puts(const char *s)
|
|
{
|
|
}
|
|
|
|
static inline int __printf(1, 2) printf(const char *fmt, ...)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline int vprintf(const char *fmt, va_list args)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
/*
|
|
* FILE based functions (can only be used AFTER relocation!)
|
|
*/
|
|
#define stdin 0
|
|
#define stdout 1
|
|
#define stderr 2
|
|
#define MAX_FILES 3
|
|
|
|
/* stderr */
|
|
#define eputc(c) fputc(stderr, c)
|
|
#define eputs(s) fputs(stderr, s)
|
|
#define eprintf(fmt, args...) fprintf(stderr, fmt, ##args)
|
|
|
|
int __printf(2, 3) fprintf(int file, const char *fmt, ...);
|
|
void fputs(int file, const char *s);
|
|
void fputc(int file, const char c);
|
|
int ftstc(int file);
|
|
int fgetc(int file);
|
|
|
|
#endif /* __STDIO_H */
|