mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 01:57:45 +00:00
Expose the kernel log buffer through /proc/dmesg.
Also add a /bin/dmesg program for convenience.
This commit is contained in:
parent
442351a5f8
commit
7455f5ea42
8 changed files with 77 additions and 0 deletions
|
@ -52,6 +52,7 @@ void Console::put_char(char ch)
|
|||
//if (ch != 27)
|
||||
IO::out8(0xe9, ch);
|
||||
#endif
|
||||
m_logbuffer.enqueue(ch);
|
||||
if (m_implementation)
|
||||
m_implementation->on_sysconsole_receive(ch);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/CircularQueue.h>
|
||||
#include <AK/Compiler.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <Kernel/CharacterDevice.h>
|
||||
|
@ -29,7 +30,10 @@ public:
|
|||
|
||||
void put_char(char);
|
||||
|
||||
const CircularQueue<char, 16384>& logbuffer() const { return m_logbuffer; }
|
||||
|
||||
private:
|
||||
ConsoleImplementation* m_implementation { nullptr };
|
||||
CircularQueue<char, 16384> m_logbuffer;
|
||||
};
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "StdLib.h"
|
||||
#include "i386.h"
|
||||
#include "KSyms.h"
|
||||
#include "Console.h"
|
||||
#include <AK/StringBuilder.h>
|
||||
|
||||
static ProcFS* s_the;
|
||||
|
@ -198,6 +199,15 @@ ByteBuffer procfs$mm(SynthFSInode&)
|
|||
return builder.to_byte_buffer();
|
||||
}
|
||||
|
||||
ByteBuffer procfs$dmesg(SynthFSInode&)
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
StringBuilder builder;
|
||||
for (char ch : Console::the().logbuffer())
|
||||
builder.append(ch);
|
||||
return builder.to_byte_buffer();
|
||||
}
|
||||
|
||||
ByteBuffer procfs$mounts(SynthFSInode&)
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
|
@ -386,6 +396,7 @@ bool ProcFS::initialize()
|
|||
add_file(create_generated_file("summary", procfs$summary));
|
||||
add_file(create_generated_file("cpuinfo", procfs$cpuinfo));
|
||||
add_file(create_generated_file("inodes", procfs$inodes));
|
||||
add_file(create_generated_file("dmesg", procfs$dmesg));
|
||||
m_sys_dir = add_file(create_directory("sys"));
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@ cp -v ../Userland/guitest mnt/bin/guitest
|
|||
cp -v ../Userland/guitest2 mnt/bin/guitest2
|
||||
cp -v ../Userland/sysctl mnt/bin/sysctl
|
||||
cp -v ../Terminal/Terminal mnt/bin/Terminal
|
||||
cp -v ../Userland/dmesg mnt/bin/dmesg
|
||||
sh sync-local.sh
|
||||
cp -v kernel.map mnt/
|
||||
ln -s dir_a mnt/dir_cur
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue