Lines Matching +full:data +full:- +full:path

24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
54 #include "utils/fs/path.hpp"
88 /// Mapping of active subprocess PIDs to their execution data.
111 /// Prepares a subprocess to run a user-provided hook in a controlled manner.
114 /// \param control_directory Path to the subprocess-specific control directory.
115 /// \param work_directory Path to the subprocess-specific work directory.
119 const fs::path& control_directory, in setup_child()
120 const fs::path& work_directory) in setup_child()
133 /// Path to the subprocess-specific work directory.
134 fs::path control_directory;
136 /// Path to the subprocess's stdout file.
137 const fs::path stdout_file;
139 /// Path to the subprocess's stderr file.
140 const fs::path stderr_file;
151 /// Number of owners of the on-disk state.
157 /// \param control_directory_ Path to the subprocess-specific work
159 /// \param stdout_file_ Path to the subprocess's stdout file.
160 /// \param stderr_file_ Path to the subprocess's stderr file.
165 /// \param [in,out] state_owners_ Number of owners of the on-disk state.
166 /// For first-time processes, this should be a new counter set to 0;
170 const fs::path& control_directory_, in impl()
171 const fs::path& stdout_file_, in impl()
172 const fs::path& stderr_file_, in impl()
213 return _pimpl->pid; in pid()
217 /// Returns the path to the subprocess-specific control directory.
221 /// \return The path to a directory that exists until cleanup() is called.
222 fs::path
225 return _pimpl->control_directory; in control_directory()
229 /// Returns the path to the subprocess-specific work directory.
233 /// \return The path to a directory that exists until cleanup() is called.
234 fs::path
237 return _pimpl->control_directory / detail::work_subdir; in work_directory()
241 /// Returns the path to the subprocess's stdout file.
243 /// \return The path to a file that exists until cleanup() is called.
244 const fs::path&
247 return _pimpl->stdout_file; in stdout_file()
251 /// Returns the path to the subprocess's stderr file.
253 /// \return The path to a file that exists until cleanup() is called.
254 const fs::path&
257 return _pimpl->stderr_file; in stderr_file()
281 /// Path to the subprocess-specific work directory.
282 const fs::path control_directory;
284 /// Path to the subprocess's stdout file.
285 const fs::path stdout_file;
287 /// Path to the subprocess's stderr file.
288 const fs::path stderr_file;
290 /// Number of owners of the on-disk state.
292 /// This will be 1 if this exit_handle is the last holder of the on-disk
319 /// \param control_directory_ Path to the subprocess-specific work
321 /// \param stdout_file_ Path to the subprocess's stdout file.
322 /// \param stderr_file_ Path to the subprocess's stderr file.
323 /// \param [in,out] state_owners_ Number of owners of the on-disk state.
332 const fs::path& control_directory_, in impl()
333 const fs::path& stdout_file_, in impl()
334 const fs::path& stderr_file_, in impl()
361 /// Cleans up the subprocess on-disk state.
374 "%s owners left") % original_pid % (*state_owners - 1)); in cleanup()
381 (*state_owners)--; in cleanup()
418 PRE(!_pimpl->cleaned); in cleanup()
419 _pimpl->cleanup(); in cleanup()
420 POST(_pimpl->cleaned); in cleanup()
424 /// Gets the current number of owners of the on-disk data.
433 return _pimpl->state_owners; in state_owners()
443 return _pimpl->original_pid; in original_pid()
453 return _pimpl->status; in status()
464 return _pimpl->unprivileged_user; in unprivileged_user()
474 return _pimpl->start_time; in start_time()
484 return _pimpl->end_time; in end_time()
488 /// Returns the path to the subprocess-specific control directory.
492 /// \return The path to a directory that exists until cleanup() is called.
493 fs::path
496 return _pimpl->control_directory; in control_directory()
500 /// Returns the path to the subprocess-specific work directory.
504 /// \return The path to a directory that exists until cleanup() is called.
505 fs::path
508 return _pimpl->control_directory / detail::work_subdir; in work_directory()
512 /// Returns the path to the subprocess's stdout file.
514 /// \return The path to a file that exists until cleanup() is called.
515 const fs::path&
518 return _pimpl->stdout_file; in stdout_file()
522 /// Returns the path to the subprocess's stderr file.
524 /// \return The path to a file that exists until cleanup() is called.
525 const fs::path&
528 return _pimpl->stderr_file; in stderr_file()
549 /// Mapping of PIDs to the data required at run time.
595 const exec_handle& data = (*iter).second; in cleanup() local
599 if (::waitpid(pid, &status, 0) == -1) { in cleanup()
605 fs::rm_r(data.control_directory()); in cleanup()
608 data.control_directory() % e.what()); in cleanup()
628 // individually wiped the subdirectories of any still-unclean in cleanup()
630 root_work_directory->cleanup(); in cleanup()
634 root_work_directory->directory() % e.what()); in cleanup()
638 interrupts_handler->unprogram(); in cleanup()
647 /// \return A pointer to an object describing the waited-for subprocess.
658 exec_handle& data = (*iter).second; in post_wait() local
659 data._pimpl->timer.unprogram(); in post_wait()
663 // always the case though: for short-lived processes and with very short in post_wait()
672 if (!fs::exists(data.stdout_file())) { in post_wait()
673 std::ofstream new_stdout(data.stdout_file().c_str()); in post_wait()
675 if (!fs::exists(data.stderr_file())) { in post_wait()
676 std::ofstream new_stderr(data.stderr_file().c_str()); in post_wait()
681 data.pid(), in post_wait()
682 data._pimpl->timer.fired() ? in post_wait()
684 data._pimpl->unprivileged_user, in post_wait()
685 data._pimpl->start_time, datetime::timestamp::now(), in post_wait()
686 data.control_directory(), in post_wait()
687 data.stdout_file(), in post_wait()
688 data.stderr_file(), in post_wait()
689 data._pimpl->state_owners, in post_wait()
698 exec_handle& data = (*iter).second; in reap() local
699 data._pimpl->timer.unprogram(); in reap()
701 if (!fs::exists(data.stdout_file())) { in reap()
702 std::ofstream new_stdout(data.stdout_file().c_str()); in reap()
704 if (!fs::exists(data.stderr_file())) { in reap()
705 std::ofstream new_stderr(data.stderr_file().c_str()); in reap()
710 data.pid(), in reap()
712 data._pimpl->unprivileged_user, in reap()
713 data._pimpl->start_time, datetime::timestamp::now(), in reap()
714 data.control_directory(), in reap()
715 data.stdout_file(), in reap()
716 data.stderr_file(), in reap()
717 data._pimpl->state_owners, in reap()
735 /// Queries the path to the root of the work directory for all subprocesses.
737 /// \return A path.
738 const fs::path&
741 return _pimpl->root_work_directory->directory(); in root_work_directory()
755 PRE(!_pimpl->cleaned); in cleanup()
756 _pimpl->cleanup(); in cleanup()
757 _pimpl->cleaned = true; in cleanup()
774 /// Pre-helper for the spawn() method.
777 fs::path
782 ++_pimpl->last_subprocess; in spawn_pre()
784 const fs::path control_directory = in spawn_pre()
785 _pimpl->root_work_directory->directory() / in spawn_pre()
786 (F("%s") % _pimpl->last_subprocess); in spawn_pre()
793 /// Post-helper for the spawn() method.
796 /// \param stdout_file Path to the subprocess' stdout.
797 /// \param stderr_file Path to the subprocess' stderr.
805 const fs::path& control_directory, in spawn_post()
806 const fs::path& stdout_file, in spawn_post()
807 const fs::path& stderr_file, in spawn_post()
814 child->pid(), in spawn_post()
823 auto insert_pair = _pimpl->all_exec_handles.insert(value); in spawn_post()
826 _pimpl->stale_exec_handles.push_front(insert_pair.first->second); in spawn_post()
827 _pimpl->all_exec_handles.erase(insert_pair.first); in spawn_post()
828 insert_pair = _pimpl->all_exec_handles.insert(value); in spawn_post()
837 /// Pre-helper for the spawn_followup() method.
845 /// Post-helper for the spawn_followup() method.
861 child->pid(), in spawn_followup_post()
870 auto insert_pair = _pimpl->all_exec_handles.insert(value); in spawn_followup_post()
873 _pimpl->stale_exec_handles.push_front(insert_pair.first->second); in spawn_followup_post()
874 _pimpl->all_exec_handles.erase(insert_pair.first); in spawn_followup_post()
875 insert_pair = _pimpl->all_exec_handles.insert(value); in spawn_followup_post()
888 /// \return A pointer to an object describing the waited-for subprocess.
894 return _pimpl->post_wait(exec_handle.pid(), status); in wait()
900 /// \return A pointer to an object describing the waited-for subprocess.
906 return _pimpl->post_wait(status.dead_pid(), status); in wait_any()
920 return _pimpl->reap(pid); in reap()