ProcessUtil.h File Reference
#include <chrono>
#include <optional>
#include <string>
#include <vector>
+ Include dependency graph for ProcessUtil.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ProcessInfo
 A live process as seen by ScanProcesses(). More...
 

Namespaces

namespace  ScenarioManager
 
namespace  ScenarioManager::Exec
 
namespace  ScenarioManager::Exec::ProcessUtil
 

Enumerations

enum class  Identity { Matches , Differs , Unverifiable }
 Whether the process behind a pid still is the one we think it is. More...
 

Functions

std::optional< std::string > FindIceConfigArgument (const std::vector< std::string > &arguments)
 
std::vector< std::string > GetProcessArguments (int pid)
 Reads the full argument vector of pid from /proc/<pid>/cmdline.
 
std::string GetProcessName (int pid)
 Reads the name of the executable behind pid (the basename of argv[0]).
 
Identity IdentifyProcess (int pid, const std::string &executableName, const std::string &configPath)
 Checks whether the process with the given pid is still the application it is supposed to be.
 
bool IsAlive (int pid)
 
bool IsZombie (int pid)
 
std::vector< ProcessInfo > ScanProcesses ()
 Walks /proc and returns every process whose argument vector could be read.
 
bool WaitForExit (int pid, std::chrono::milliseconds timeout, std::chrono::milliseconds pollInterval=std::chrono::milliseconds(20))
 Blocks until the process with the given pid has disappeared, at most for timeout.