process-cpp
3.0.0
A simple convenience library for handling processes in C++11.
|
Go to the documentation of this file.
27 #include <gtest/gtest.h>
31 TEST(LinuxProcess, accessing_proc_stats_works)
38 EXPECT_NO_THROW(child >> stat);
42 TEST(LinuxProcess, accessing_proc_oom_score_works)
48 TEST(LinuxProcess, accessing_proc_oom_score_adj_works)
60 ::testing::AssertionResult is_approximately_equal(
int a,
int b)
62 static const int error_margin = 10;
65 return ::testing::AssertionSuccess() << ::abs(a-b) <<
" <= " << error_margin;
67 return ::testing::AssertionFailure() << ::abs(a-b) <<
" > " << error_margin;
71 TEST(LinuxProcess, adjusting_proc_oom_score_adj_works)
88 TEST(LinuxProcess, adjusting_proc_oom_score_adj_to_privileged_values_only_works_if_root)
104 TEST(LinuxProcess, trying_to_write_an_invalid_oom_score_adj_throws)
114 TEST(LinuxProcess, adjusting_proc_oom_adj_works)
134 TEST(LinuxProcess, adjusting_proc_oom_adj_to_privileged_values_does_not_work)
150 TEST(LinuxProcess, trying_to_write_an_invalid_oom_adj_throws)
usr bin c fPIC g O2 fdebug prefix version build process cpp T9_0Ku process cpp symbols map Bsymbolic functions relro no undefined shared soname
CORE_POSIX_DLL_PUBLIC Process instance() noexcept(true)
Returns a Process instance corresponding to this process.
TEST(LinuxProcess, accessing_proc_stats_works)
usr bin c fPIC g O2 fdebug prefix version build process cpp T9_0Ku process cpp symbols map Wl
static int min_value()
Returns the minimum valid value.
usr bin c fPIC g O2 fdebug prefix version build process cpp T9_0Ku process cpp symbols map Bsymbolic functions z
int value
Current OomScore as calculated by the kernel.
static int max_value()
Returns the maximum valid value.
The Stat struct encapsulates status information about a process.
usr bin c fPIC g O2 fdebug prefix map
usr bin c fPIC g O2 fdebug prefix version script
CORE_POSIX_DLL_PUBLIC ChildProcess exec(const std::string &fn, const std::vector< std::string > &argv, const std::map< std::string, std::string > &env, const StandardStream &flags)
exec execve's the executable with the provided arguments and environment.
CORE_POSIX_DLL_PUBLIC ChildProcess fork(const std::function< posix::exit::Status()> &main, const StandardStream &flags)
fork forks a new process and executes the provided main function in the newly forked process.
EXPECT_ANY_THROW(auto death_observer=core::posix::ChildProcess::DeathObserver::create_once_with_signal_trap(trap))
static int min_value()
Returns the minimum valid value.
CORE_POSIX_DLL_PUBLIC ForkAndRunResult fork_and_run(const std::function< core::posix::exit::Status()> &service, const std::function< core::posix::exit::Status()> &client)
Forks two processes for both the service and the client.
static int max_value()
Returns the maximum valid value.