mirror of
https://github.com/RGBCube/serenity
synced 2025-06-19 17:22:06 +00:00
Kernel: Add /proc/self, a symlink to the /proc/$PID.
This will be useful for implementing things like /dev/stdin.
This commit is contained in:
parent
c2adfd0e2d
commit
e895d6c48e
1 changed files with 8 additions and 0 deletions
|
@ -150,6 +150,13 @@ ByteBuffer procfs$pid_cwd(Process& process)
|
||||||
return VFS::the().absolute_path(*inode).to_byte_buffer();
|
return VFS::the().absolute_path(*inode).to_byte_buffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ByteBuffer procfs$self(SynthFSInode&)
|
||||||
|
{
|
||||||
|
char buffer[16];
|
||||||
|
ksprintf(buffer, "%u", current->pid());
|
||||||
|
return ByteBuffer::copy((const byte*)buffer, strlen(buffer));
|
||||||
|
}
|
||||||
|
|
||||||
void ProcFS::add_process(Process& process)
|
void ProcFS::add_process(Process& process)
|
||||||
{
|
{
|
||||||
InterruptDisabler disabler;
|
InterruptDisabler disabler;
|
||||||
|
@ -400,6 +407,7 @@ bool ProcFS::initialize()
|
||||||
add_file(create_generated_file("cpuinfo", procfs$cpuinfo));
|
add_file(create_generated_file("cpuinfo", procfs$cpuinfo));
|
||||||
add_file(create_generated_file("inodes", procfs$inodes));
|
add_file(create_generated_file("inodes", procfs$inodes));
|
||||||
add_file(create_generated_file("dmesg", procfs$dmesg));
|
add_file(create_generated_file("dmesg", procfs$dmesg));
|
||||||
|
add_file(create_generated_file("self", procfs$self, 00120777));
|
||||||
m_sys_dir = add_file(create_directory("sys"));
|
m_sys_dir = add_file(create_directory("sys"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue