intercept puts() in libsys, for gcc

This commit is contained in:
David van Moolenbroek 2010-04-23 20:23:33 +00:00
parent ee3b5fb5ea
commit aacbfc41cc
2 changed files with 25 additions and 0 deletions

View file

@ -98,6 +98,7 @@ SRCS= \
asynsend.c \
kprintf.c \
kputc.c \
kputs.c \
tickdelay.c \
get_randomness.c \
getidle.c \

24
lib/libsys/kputs.c Normal file
View file

@ -0,0 +1,24 @@
/* system services puts()
*
* This is here because gcc converts printf() calls without actual formatting
* in the format string, to puts() calls. While that "feature" can be disabled
* with the -fno-builtin-printf gcc flag, we still don't want the resulting
* mayhem to occur in system servers even when that flag is forgotten.
*/
#include <stdio.h>
/* puts() uses kputc() to print characters. */
void kputc(int c);
int puts(const char *s)
{
for (; *s; s++)
kputc(*s);
kputc('\n');
kputc('\0');
return 0;
}