mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 01:32:14 -05:00
Kernel: Expose kernel command line to userspace through /proc/cmdline
This commit is contained in:
parent
267672efee
commit
0a3abcc0a8
Notes:
sideshowbarker
2024-07-19 13:34:48 +09:00
Author: https://github.com/rburchell Commit: https://github.com/SerenityOS/serenity/commit/0a3abcc0a84 Pull-request: https://github.com/SerenityOS/serenity/pull/233
2 changed files with 14 additions and 1 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <Kernel/FileSystem/Custody.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/FileSystem/VirtualFileSystem.h>
|
||||
#include <Kernel/KParams.h>
|
||||
#include <Kernel/Net/NetworkAdapter.h>
|
||||
#include <Kernel/PCI.h>
|
||||
#include <Kernel/VM/MemoryManager.h>
|
||||
|
@ -41,6 +42,7 @@ enum ProcFileType {
|
|||
FI_Root_dmesg,
|
||||
FI_Root_pci,
|
||||
FI_Root_uptime,
|
||||
FI_Root_cmdline,
|
||||
FI_Root_netadapters,
|
||||
FI_Root_self, // symlink
|
||||
FI_Root_sys, // directory
|
||||
|
@ -253,6 +255,13 @@ ByteBuffer procfs$uptime(InodeIdentifier)
|
|||
return builder.to_byte_buffer();
|
||||
}
|
||||
|
||||
ByteBuffer procfs$cmdline(InodeIdentifier)
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.appendf("%s\n", KParams::the().cmdline().characters());
|
||||
return builder.to_byte_buffer();
|
||||
}
|
||||
|
||||
ByteBuffer procfs$netadapters(InodeIdentifier)
|
||||
{
|
||||
StringBuilder builder;
|
||||
|
@ -1113,6 +1122,7 @@ ProcFS::ProcFS()
|
|||
m_entries[FI_Root_self] = { "self", FI_Root_self, procfs$self };
|
||||
m_entries[FI_Root_pci] = { "pci", FI_Root_pci, procfs$pci };
|
||||
m_entries[FI_Root_uptime] = { "uptime", FI_Root_uptime, procfs$uptime };
|
||||
m_entries[FI_Root_cmdline] = { "cmdline", FI_Root_cmdline, procfs$cmdline };
|
||||
m_entries[FI_Root_netadapters] = { "netadapters", FI_Root_netadapters, procfs$netadapters };
|
||||
m_entries[FI_Root_sys] = { "sys", FI_Root_sys };
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[ -z "$SERENITY_QEMU_BIN" ] && SERENITY_QEMU_BIN="qemu-system-i386"
|
||||
|
||||
SERENITY_KERNEL_CMDLINE="hello"
|
||||
[ -z "$SERENITY_KERNEL_CMDLINE" ] && SERENITY_KERNEL_CMDLINE="hello"
|
||||
|
||||
export SDL_VIDEO_X11_DGAMOUSE=0
|
||||
|
||||
|
@ -18,6 +18,7 @@ elif [ "$1" = "qn" ]; then
|
|||
-debugcon stdio \
|
||||
-device e1000 \
|
||||
-kernel kernel \
|
||||
-append "${SERENITY_KERNEL_CMDLINE}" \
|
||||
-hda _disk_image \
|
||||
-soundhw pcspk
|
||||
elif [ "$1" = "qtap" ]; then
|
||||
|
@ -31,6 +32,7 @@ elif [ "$1" = "qtap" ]; then
|
|||
-netdev tap,ifname=tap0,id=br0 \
|
||||
-device e1000,netdev=br0 \
|
||||
-kernel kernel \
|
||||
-append "${SERENITY_KERNEL_CMDLINE}" \
|
||||
-hda _disk_image \
|
||||
-soundhw pcspk
|
||||
elif [ "$1" = "qgrub" ]; then
|
||||
|
@ -56,6 +58,7 @@ else
|
|||
-netdev user,id=breh,hostfwd=tcp:127.0.0.1:8888-192.168.5.2:8888 \
|
||||
-device e1000,netdev=breh \
|
||||
-kernel kernel \
|
||||
-append "${SERENITY_KERNEL_CMDLINE}" \
|
||||
-hda _disk_image \
|
||||
-soundhw pcspk
|
||||
fi
|
||||
|
|
Loading…
Reference in a new issue