mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
print: add nouserprint argument
For some usecases, silencing syscall_print()s is ideal. A good example of that is syzkaller, which uses logs to detect crashes and a badly timed syscall_print() could interfere. Add a nouserprint argument which skips printing on syscall_print().
This commit is contained in:
@@ -4,12 +4,18 @@
|
||||
#include <mutex.h>
|
||||
#include <util.h>
|
||||
#include <arch/cpu.h>
|
||||
#include <kernel/kernel_args.h>
|
||||
|
||||
DEFINE_KERNEL_ARGUMENT(nouserprint, bool);
|
||||
|
||||
syscallret_t syscall_print(context_t *context, char *message) {
|
||||
syscallret_t ret = {
|
||||
.ret = -1
|
||||
};
|
||||
|
||||
if (GET_KERNEL_ARGUMENT(nouserprint, bool))
|
||||
goto leave;
|
||||
|
||||
static MUTEX_DEFINE(mutex);
|
||||
|
||||
size_t len;
|
||||
@@ -35,6 +41,7 @@ syscallret_t syscall_print(context_t *context, char *message) {
|
||||
arch_e9_putc('\n');
|
||||
MUTEX_RELEASE(&mutex);
|
||||
|
||||
leave:
|
||||
ret.errno = 0;
|
||||
ret.ret = 0;
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user