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
3bd535e995
commit
551d9ccac3
@ -47,10 +47,11 @@ error_t KernLog(const char *fmt, ...)
|
|||||||
//
|
//
|
||||||
void DebugLog(const char *fmt, ...)
|
void DebugLog(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
|
ulong ticks = KeGetTicks();
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
BPrintOnBuf(BStdDbg, "[%d]\t", KeGetTicks());
|
BPrintOnBuf(BStdDbg, "[%d]\t", ticks);
|
||||||
BPrintOnBufV(BStdDbg, fmt, ap);
|
BPrintOnBufV(BStdDbg, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
@ -102,6 +102,30 @@ error_t CmdDate(int argc, char **argv, char *cmdline)
|
|||||||
return EOK;
|
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)
|
error_t CmdHelp(int argc, char **argv, char *cmdline)
|
||||||
{
|
{
|
||||||
uint i, count = 0;
|
uint i, count = 0;
|
||||||
@ -186,15 +210,16 @@ Command_t shcmdtable[] =
|
|||||||
{ "cls", CmdClear, "Clears standard output" },
|
{ "cls", CmdClear, "Clears standard output" },
|
||||||
{ "color", CmdColor, "Change shell text color" },
|
{ "color", CmdColor, "Change shell text color" },
|
||||||
{ "date", CmdDate, "Print date" },
|
{ "date", CmdDate, "Print date" },
|
||||||
|
{ "dmesg", CmdDmesg, "Print N lines of debug log" },
|
||||||
{ "exit", CmdQuit, "Initiate shutdown" },
|
{ "exit", CmdQuit, "Initiate shutdown" },
|
||||||
{ "help", CmdHelp, "Show this message" },
|
{ "help", CmdHelp, "Show this message" },
|
||||||
{ "march", CmdStarWars, "Play the Imperial March" },
|
{ "march", CmdStarWars, "Play the Imperial March" },
|
||||||
{ "mmap", CmdMemMap, "Show memory map" },
|
{ "mmap", CmdMemMap, "Show memory map" },
|
||||||
{ "musage", CmdMemUsage, "Show memory statistics" },
|
{ "musage", CmdMemUsage, "Show memory statistics" },
|
||||||
{ "quit", CmdQuit, "Alias for 'exit'" },
|
{ "quit", CmdQuit, "Alias for 'exit'" },
|
||||||
{ "sleep", CmdSleep, "Sleep x ms" },
|
{ "sleep", CmdSleep, "Sleep N ms" },
|
||||||
{ "time", CmdTime, "Print time" },
|
{ "time", CmdTime, "Print time" },
|
||||||
{ "test", CmdTest, "Launch the x test" },
|
{ "test", CmdTest, "Launch a test" },
|
||||||
{ "ver", CmdVersion, "Version and legal infos" },
|
{ "ver", CmdVersion, "Version and legal infos" },
|
||||||
{ NULL, NULL, NULL }
|
{ NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user