mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 21:07:34 +00:00
ProcFS: Expose the current kernel keymap as /proc/keymap
Programs can now ask the kernel which keymap is in use by reading from /proc/keymap
This commit is contained in:
parent
00a0e525e6
commit
471083ca3d
1 changed files with 12 additions and 0 deletions
|
@ -33,6 +33,7 @@
|
||||||
#include <Kernel/CommandLine.h>
|
#include <Kernel/CommandLine.h>
|
||||||
#include <Kernel/Console.h>
|
#include <Kernel/Console.h>
|
||||||
#include <Kernel/Devices/BlockDevice.h>
|
#include <Kernel/Devices/BlockDevice.h>
|
||||||
|
#include <Kernel/Devices/KeyboardDevice.h>
|
||||||
#include <Kernel/FileSystem/Custody.h>
|
#include <Kernel/FileSystem/Custody.h>
|
||||||
#include <Kernel/FileSystem/FileBackedFileSystem.h>
|
#include <Kernel/FileSystem/FileBackedFileSystem.h>
|
||||||
#include <Kernel/FileSystem/FileDescription.h>
|
#include <Kernel/FileSystem/FileDescription.h>
|
||||||
|
@ -85,6 +86,7 @@ enum ProcFileType {
|
||||||
FI_Root_inodes,
|
FI_Root_inodes,
|
||||||
FI_Root_dmesg,
|
FI_Root_dmesg,
|
||||||
FI_Root_interrupts,
|
FI_Root_interrupts,
|
||||||
|
FI_Root_keymap,
|
||||||
FI_Root_pci,
|
FI_Root_pci,
|
||||||
FI_Root_devices,
|
FI_Root_devices,
|
||||||
FI_Root_uptime,
|
FI_Root_uptime,
|
||||||
|
@ -372,6 +374,15 @@ Optional<KBuffer> procfs$interrupts(InodeIdentifier)
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Optional<KBuffer> procfs$keymap(InodeIdentifier)
|
||||||
|
{
|
||||||
|
KBufferBuilder builder;
|
||||||
|
JsonObjectSerializer<KBufferBuilder> json { builder };
|
||||||
|
json.add("keymap", KeyboardDevice::the().keymap_name());
|
||||||
|
json.finish();
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
Optional<KBuffer> procfs$devices(InodeIdentifier)
|
Optional<KBuffer> procfs$devices(InodeIdentifier)
|
||||||
{
|
{
|
||||||
KBufferBuilder builder;
|
KBufferBuilder builder;
|
||||||
|
@ -1572,6 +1583,7 @@ ProcFS::ProcFS()
|
||||||
m_entries[FI_Root_self] = { "self", FI_Root_self, false, procfs$self };
|
m_entries[FI_Root_self] = { "self", FI_Root_self, false, procfs$self };
|
||||||
m_entries[FI_Root_pci] = { "pci", FI_Root_pci, false, procfs$pci };
|
m_entries[FI_Root_pci] = { "pci", FI_Root_pci, false, procfs$pci };
|
||||||
m_entries[FI_Root_interrupts] = { "interrupts", FI_Root_interrupts, false, procfs$interrupts };
|
m_entries[FI_Root_interrupts] = { "interrupts", FI_Root_interrupts, false, procfs$interrupts };
|
||||||
|
m_entries[FI_Root_keymap] = { "keymap", FI_Root_keymap, false, procfs$keymap };
|
||||||
m_entries[FI_Root_devices] = { "devices", FI_Root_devices, false, procfs$devices };
|
m_entries[FI_Root_devices] = { "devices", FI_Root_devices, false, procfs$devices };
|
||||||
m_entries[FI_Root_uptime] = { "uptime", FI_Root_uptime, false, procfs$uptime };
|
m_entries[FI_Root_uptime] = { "uptime", FI_Root_uptime, false, procfs$uptime };
|
||||||
m_entries[FI_Root_cmdline] = { "cmdline", FI_Root_cmdline, true, procfs$cmdline };
|
m_entries[FI_Root_cmdline] = { "cmdline", FI_Root_cmdline, true, procfs$cmdline };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue