diff options
author | Richard Braun <rbraun@sceen.net> | 2017-06-11 11:27:32 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-06-11 11:27:32 +0200 |
commit | b135fef80cf8f9addf5725881a2fe81cda404dfe (patch) | |
tree | 57571a9e968b277090eba9873a0ad733fea7ed06 /kern | |
parent | cd56e2cf82938061b101cf752ce0db195c4009ed (diff) |
Make the diagnostics shell optional
Diffstat (limited to 'kern')
-rw-r--r-- | kern/log.c | 20 | ||||
-rw-r--r-- | kern/shell.h | 8 | ||||
-rw-r--r-- | kern/task.c | 4 | ||||
-rw-r--r-- | kern/thread.c | 4 |
4 files changed, 28 insertions, 8 deletions
@@ -267,6 +267,8 @@ log_run(void *arg) } } +#ifdef X15_SHELL + static void log_dump(unsigned int level) { @@ -315,14 +317,6 @@ log_shell_dump(int argc, char **argv) log_dump(level); } -void __init -log_setup(void) -{ - cbuf_init(&log_cbuf, log_buffer, sizeof(log_buffer)); - spinlock_init(&log_lock); - log_print_level = LOG_INFO; -} - static struct shell_cmd log_shell_cmds[] = { SHELL_CMD_INITIALIZER2("log_dump", log_shell_dump, "log_dump [<level>]", @@ -339,6 +333,16 @@ static struct shell_cmd log_shell_cmds[] = { " 7: debug"), }; +#endif /* X15_SHELL */ + +void __init +log_setup(void) +{ + cbuf_init(&log_cbuf, log_buffer, sizeof(log_buffer)); + spinlock_init(&log_lock); + log_print_level = LOG_INFO; +} + void __init log_start(void) { diff --git a/kern/shell.h b/kern/shell.h index 10bc8a38..81be314b 100644 --- a/kern/shell.h +++ b/kern/shell.h @@ -24,6 +24,8 @@ #include <kern/error.h> #include <kern/macros.h> +#ifdef X15_SHELL + #define SHELL_REGISTER_CMDS(cmds) \ MACRO_BEGIN \ size_t ___i; \ @@ -85,4 +87,10 @@ void shell_start(void); */ int shell_cmd_register(struct shell_cmd *cmd); +#else /* X15_SHELL */ +#define SHELL_REGISTER_CMDS(cmds) +#define shell_setup() +#define shell_start() +#endif /* X15_SHELL */ + #endif /* _KERN_SHELL_H */ diff --git a/kern/task.c b/kern/task.c index d9c9f115..a5281994 100644 --- a/kern/task.c +++ b/kern/task.c @@ -64,6 +64,8 @@ task_init(struct task *task, const char *name, struct vm_map *map) strlcpy(task->name, name, sizeof(task->name)); } +#ifdef X15_SHELL + static void task_shell_info(int argc, char *argv[]) { @@ -97,6 +99,8 @@ static struct shell_cmd task_shell_cmds[] = { "print tasks and threads"), }; +#endif /* X15_SHELL */ + void __init task_setup(void) { diff --git a/kern/thread.c b/kern/thread.c index a753eb59..dd0d709f 100644 --- a/kern/thread.c +++ b/kern/thread.c @@ -2229,6 +2229,8 @@ thread_setup_runq(struct thread_runq *runq) thread_setup_idler(runq); } +#ifdef X15_SHELL + /* * This function is meant for debugging only. As a result, it uses a weak * locking policy which allows tracing threads which state may mutate during @@ -2279,6 +2281,8 @@ static struct shell_cmd thread_shell_cmds[] = { "print the stack trace of a given thread"), }; +#endif /* X15_SHELL */ + void __init thread_setup(void) { |