13 #ifndef __STOUT_OS_HPP__
14 #define __STOUT_OS_HPP__
23 #include <glog/logging.h>
24 #include <sys/types.h>
106 #elif defined(__WINDOWS__)
119 #elif defined(__WINDOWS__)
129 inline std::string
expandName(
const std::string& libraryName)
139 return path.
isSome() ? path.
get() : std::string();
156 if (
paths().empty()) {
179 #endif // __WINDOWS__
189 std::list<Process> result;
195 result.push_back(process.
get());
207 if (process.
pid == pid) {
218 bool recursive =
true)
221 std::set<pid_t> descendants;
222 std::queue<pid_t> parents;
226 pid_t parent = parents.front();
231 if (process.
parent == parent) {
233 if (descendants.insert(process.
pid).second) {
234 parents.push(process.
pid);
238 }
while (recursive && !parents.empty());
257 #endif // __STOUT_OS_HPP__
Try< std::string > sysname()
Definition: os.hpp:170
Definition: errorbase.hpp:35
constexpr const char * extension
Definition: os.hpp:103
Try< std::list< Process > > processes()
Definition: os.hpp:182
constexpr const char * prefix
Definition: os.hpp:94
std::string paths()
Definition: os.hpp:136
void setenv(const std::string &key, const std::string &value, bool overwrite=true)
Definition: os.hpp:157
Definition: result.hpp:40
bool isSome() const
Definition: option.hpp:115
void setPaths(const std::string &newPaths)
Definition: os.hpp:146
DWORD pid_t
Definition: windows.hpp:187
Definition: process.hpp:32
void appendPaths(const std::string &newPaths)
Definition: os.hpp:154
const pid_t pid
Definition: process.hpp:53
const T & get() const &
Definition: option.hpp:118
Option< std::string > getenv(const std::string &key)
Definition: getenv.hpp:29
const T & get() const
Definition: result.hpp:115
std::string sysname
Definition: os.hpp:46
constexpr const char * ldPathEnvironmentVariable
Definition: os.hpp:116
Try< UTSInfo > uname()
Definition: os.hpp:312
static Try error(const E &e)
Definition: try.hpp:42
const pid_t parent
Definition: process.hpp:54
Result< Process > process(pid_t pid)
Definition: freebsd.hpp:30
bool isError() const
Definition: try.hpp:71
std::set< pid_t > children(pid_t, const std::list< Process > &, bool)
Definition: os.hpp:215
bool isSome() const
Definition: result.hpp:111
std::string expandName(const std::string &libraryName)
Definition: os.hpp:129
Try< std::set< pid_t > > pids()
Definition: freebsd.hpp:62
const T & get() const
Definition: try.hpp:73