mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
dmesg
This commit is contained in:
parent
502d0afba1
commit
efbefb823c
@ -47,10 +47,11 @@ error_t KernLog(const char *fmt, ...)
|
||||
//
|
||||
void DebugLog(const char *fmt, ...)
|
||||
{
|
||||
ulong ticks = KeGetTicks();
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, fmt);
|
||||
BPrintOnBuf(BStdDbg, "[%d]\t", KeGetTicks());
|
||||
BPrintOnBuf(BStdDbg, "[%d]\t", ticks);
|
||||
BPrintOnBufV(BStdDbg, fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
@ -102,6 +102,30 @@ error_t CmdDate(int argc, char **argv, char *cmdline)
|
||||
return EOK;
|
||||
}
|
||||
|
||||
error_t CmdDmesg(int argc, char **argv, char *cmdline)
|
||||
{
|
||||
char *ptr;
|
||||
size_t N = 0;
|
||||
|
||||
if (argc == 1) N = 999;
|
||||
else if (argc == 2) N = atoi(argv[1]);
|
||||
else {
|
||||
KernLog("dmesg: no more than one argument\n");
|
||||
return EINVAL;
|
||||
}
|
||||
|
||||
BLockBuf(BStdDbg);
|
||||
|
||||
ptr = (char *)lmax((ulong)BStdDbg->buf,
|
||||
(ulong)(BStdDbg->wp - BStdDbg->lastLF - (BStdDbg->lineLen * N)));
|
||||
|
||||
KernLog(ptr);
|
||||
|
||||
BUnlockBuf(BStdDbg);
|
||||
|
||||
return EOK;
|
||||
}
|
||||
|
||||
error_t CmdHelp(int argc, char **argv, char *cmdline)
|
||||
{
|
||||
uint i, count = 0;
|
||||
@ -182,19 +206,20 @@ error_t CmdVersion(int argc, char **argv, char *cmdline)
|
||||
|
||||
Command_t shcmdtable[] =
|
||||
{
|
||||
{ "beep", CmdBeep, "Make a beep" },
|
||||
{ "cls", CmdClear, "Clears standard output" },
|
||||
{ "color", CmdColor, "Change shell text color" },
|
||||
{ "date", CmdDate, "Print date" },
|
||||
{ "exit", CmdQuit, "Initiate shutdown" },
|
||||
{ "help", CmdHelp, "Show this message" },
|
||||
{ "march", CmdStarWars, "Play the Imperial March" },
|
||||
{ "mmap", CmdMemMap, "Show memory map" },
|
||||
{ "musage", CmdMemUsage, "Show memory statistics" },
|
||||
{ "quit", CmdQuit, "Alias for 'exit'" },
|
||||
{ "sleep", CmdSleep, "Sleep x ms" },
|
||||
{ "time", CmdTime, "Print time" },
|
||||
{ "test", CmdTest, "Launch the x test" },
|
||||
{ "ver", CmdVersion, "Version and legal infos" },
|
||||
{ "beep", CmdBeep, "Make a beep" },
|
||||
{ "cls", CmdClear, "Clears standard output" },
|
||||
{ "color", CmdColor, "Change shell text color" },
|
||||
{ "date", CmdDate, "Print date" },
|
||||
{ "dmesg", CmdDmesg, "Print N lines of debug log" },
|
||||
{ "exit", CmdQuit, "Initiate shutdown" },
|
||||
{ "help", CmdHelp, "Show this message" },
|
||||
{ "march", CmdStarWars, "Play the Imperial March" },
|
||||
{ "mmap", CmdMemMap, "Show memory map" },
|
||||
{ "musage", CmdMemUsage, "Show memory statistics" },
|
||||
{ "quit", CmdQuit, "Alias for 'exit'" },
|
||||
{ "sleep", CmdSleep, "Sleep N ms" },
|
||||
{ "time", CmdTime, "Print time" },
|
||||
{ "test", CmdTest, "Launch a test" },
|
||||
{ "ver", CmdVersion, "Version and legal infos" },
|
||||
{ NULL, NULL, NULL }
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user