mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:48:14 +00:00
Kernel: Add /proc/uptime file (number of seconds since boot.)
Also added a simple /bin/uptime to pretty-print this information. :^)
This commit is contained in:
parent
0e30f4e412
commit
c0fe48635b
5 changed files with 47 additions and 0 deletions
|
@ -36,6 +36,7 @@ enum ProcFileType {
|
|||
FI_Root_inodes,
|
||||
FI_Root_dmesg,
|
||||
FI_Root_pci,
|
||||
FI_Root_uptime,
|
||||
FI_Root_self, // symlink
|
||||
FI_Root_sys, // directory
|
||||
__FI_Root_End,
|
||||
|
@ -248,6 +249,13 @@ ByteBuffer procfs$pci(InodeIdentifier)
|
|||
return builder.to_byte_buffer();
|
||||
}
|
||||
|
||||
ByteBuffer procfs$uptime(InodeIdentifier)
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.appendf("%u\n", (dword)(g_uptime / 1000));
|
||||
return builder.to_byte_buffer();
|
||||
}
|
||||
|
||||
ByteBuffer procfs$pid_vmo(InodeIdentifier identifier)
|
||||
{
|
||||
auto handle = ProcessInspectionHandle::from_pid(to_pid(identifier));
|
||||
|
@ -1144,6 +1152,7 @@ ProcFS::ProcFS()
|
|||
m_entries[FI_Root_dmesg] = { "dmesg", FI_Root_dmesg, procfs$dmesg };
|
||||
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_sys] = { "sys", FI_Root_sys };
|
||||
|
||||
m_entries[FI_PID_vm] = { "vm", FI_PID_vm, procfs$pid_vm };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue