mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:47:45 +00:00
Kernel: Rewrite ProcFS.
Now the filesystem is generated on-the-fly instead of manually adding and removing inodes as processes spawn and die. The code is convoluted and bloated as I wrote it while sleepless. However, it's still vastly better than the old ProcFS, so I'm committing it. I also added /proc/PID/fd/N symlinks for each of a process's open fd's.
This commit is contained in:
parent
ab56f36bfb
commit
5e9ba2ac84
13 changed files with 1133 additions and 468 deletions
|
@ -55,6 +55,7 @@ public:
|
|||
static Process* create_user_process(const String& path, uid_t, gid_t, pid_t ppid, int& error, Vector<String>&& arguments = Vector<String>(), Vector<String>&& environment = Vector<String>(), TTY* = nullptr);
|
||||
~Process();
|
||||
|
||||
static Vector<pid_t> all_pids();
|
||||
static Vector<Process*> all_processes();
|
||||
|
||||
enum State {
|
||||
|
@ -406,6 +407,17 @@ public:
|
|||
m_process.set_state(m_original_state);
|
||||
}
|
||||
|
||||
Process& process() { return m_process; }
|
||||
|
||||
static OwnPtr<ProcessInspectionHandle> from_pid(pid_t pid)
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
auto* process = Process::from_pid(pid);
|
||||
if (process)
|
||||
return make<ProcessInspectionHandle>(*process);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Process* operator->() { return &m_process; }
|
||||
Process& operator*() { return m_process; }
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue