Secret printing in libraries and shell and silencing randcall.
This commit is contained in:
@@ -31,6 +31,8 @@
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <kern/secret.h>
|
||||
|
||||
/*
|
||||
* printf - C standard I/O function.
|
||||
@@ -76,3 +78,36 @@ vprintf(const char *fmt, va_list ap)
|
||||
}
|
||||
return chars;
|
||||
}
|
||||
|
||||
/* printf variant that is quiet during automated testing */
|
||||
int
|
||||
tprintf(const char *fmt, ...)
|
||||
{
|
||||
int chars;
|
||||
va_list ap;
|
||||
|
||||
if (strcmp(KERNEL_SECRET, "") != 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
va_start(ap, fmt);
|
||||
chars = vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return chars;
|
||||
}
|
||||
|
||||
/* printf variant that prepends the kernel secret */
|
||||
int
|
||||
printsf(const char *fmt, ...)
|
||||
{
|
||||
int chars;
|
||||
va_list ap;
|
||||
|
||||
printf("%s: ", KERNEL_SECRET);
|
||||
va_start(ap, fmt);
|
||||
chars = vprintf(fmt, ap);
|
||||
va_end(ap);
|
||||
|
||||
return chars;
|
||||
}
|
||||
|
Reference in New Issue
Block a user