Lines Matching full:process

29 #include "utils/process/operations.hpp"
47 #include "utils/process/exceptions.hpp"
48 #include "utils/process/system.hpp"
49 #include "utils/process/status.hpp"
54 namespace process = utils::process;
61 /// process to construct the arguments list, which would have side-effects in
71 /// \return The PID of the terminated process and its termination status.
73 /// \throw process::system_error If the call to wait(2) fails.
74 static process::status
77 LD("Waiting for any child process"); in safe_wait()
82 throw process::system_error("Failed to wait for any child process", in safe_wait()
85 return process::status(pid, stat_loc); in safe_wait()
91 /// \param pid The identifier of the process to wait for.
93 /// \return The termination status of the process.
95 /// \throw process::system_error If the call to waitpid(2) fails.
96 static process::status
101 if (process::detail::syscall_waitpid(pid, &stat_loc, 0) == -1) { in safe_waitpid()
103 throw process::system_error(F("Failed to wait for PID %s") % pid, in safe_waitpid()
106 return process::status(pid, stat_loc); in safe_waitpid()
113 /// Executes an external binary and replaces the current process.
118 /// This function must also not affect the global state of the current process
125 process::exec(const fs::path& program, const args_vector& args) throw() in exec()
136 /// Executes an external binary and replaces the current process.
138 /// This differs from process::exec() in that this function reports errors
145 /// This function must also not affect the global state of the current process
154 process::exec_unsafe(const fs::path& program, const args_vector& args) in exec_unsafe()
189 /// Forcibly kills a process group started by us.
193 /// Pretty much all of our subprocesses run in their own process group so that
195 /// this, the very first thing our subprocesses do is create a new process group
199 /// process group is racy: if the subprocess has not yet had a chance to prepare
200 /// its own process group, then we will not be killing anything. To solve this,
201 /// we must also kill() the process group leader itself, and we must do so after
202 /// the call to killpg(). Doing this is safe because: 1) the process group must
203 /// have the same ID as the PID of the process that created it; and 2) we have
206 /// The sideffect of doing what we do here is that the process group leader may
208 /// terminating the process group and none of the processes can controlledly
211 /// \param pgid PID or process group ID to terminate.
213 process::terminate_group(const int pgid) in terminate_group()
220 /// Terminates the current process reproducing the given status.
222 /// The caller process is abruptly terminated. In particular, no output streams
225 /// \param status The status to "re-deliver" to the caller process.
227 process::terminate_self_with(const status& status) in terminate_self_with()
242 /// \param pid Identifier of the process to wait for.
244 /// \return The termination status of the child process that terminated.
246 /// \throw process::system_error If the call to wait(2) fails.
247 process::status
248 process::wait(const int pid) in wait()
250 const process::status status = safe_waitpid(pid); in wait()
261 /// \return The termination status of the child process that terminated.
263 /// \throw process::system_error If the call to wait(2) fails.
264 process::status
265 process::wait_any(void) in wait_any()
267 const process::status status = safe_wait(); in wait_any()