| 76 | |
| 77 | static void with_process(pid_t pid, const BAN::Function<void(Process&)>& callback) |
| 78 | { |
| 79 | SpinLockGuard _(s_process_lock); |
| 80 | |
| 81 | for (auto* process : s_processes) |
| 82 | { |
| 83 | if (process->pid() != pid) |
| 84 | continue; |
| 85 | callback(*process); |
| 86 | break; |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | Process* Process::create_process(const Credentials& credentials, pid_t parent, pid_t sid, pid_t pgrp) |
| 91 | { |
| 92 | static BAN::Atomic<pid_t> s_next_id = 1; |
| 93 | |
| 94 | pid_t pid = s_next_id++; |
| 95 | if (sid == 0 && pgrp == 0) |
| 96 | { |
| 97 | sid = pid; |
| 98 | pgrp = pid; |
| 99 | } |
| 100 | |
| 101 | ASSERT(sid > 0); |
nothing calls this directly
no test coverage detected