Modules | |
System utility files | |
Functions | |
int | MagAOX::sys::runCommand (std::vector< std::string > &commandOutput, std::vector< std::string > &commandStderr, std::vector< std::string > &commandList) |
Runs a command (with parameters) passed in using fork/exec. More... | |
int | MagAOX::sys::th_seteuid (uid_t euid) |
Sets the effective user id of the calling thread, rather than the whole process. More... | |
int MagAOX::sys::runCommand | ( | std::vector< std::string > & | commandOutput, |
std::vector< std::string > & | commandStderr, | ||
std::vector< std::string > & | commandList | ||
) |
Runs a command (with parameters) passed in using fork/exec.
New process is made with fork(), and child runs execvp with command provided.
Original code by C. Bohlman for sysMonitor, then promoted to libMagAOX for general use.
[out] | commandOutput | the output, line by line. If an error, first entry contains the message. |
[out] | commandStderr | the output of stderr. |
[in] | commandList | command to be run, with one entry per command line word |
Definition at line 22 of file runCommand.cpp.
Referenced by MagAOX::app::sysMonitor::findChronyStatus(), MagAOX::app::sysMonitor::findCPULoads(), MagAOX::app::sysMonitor::findCPUTemperatures(), MagAOX::app::sysMonitor::findDiskTemperature(), MagAOX::app::sysMonitor::findDiskUsage(), and MagAOX::app::sysMonitor::findRamUsage().
int MagAOX::sys::th_seteuid | ( | uid_t | euid | ) |
Sets the effective user id of the calling thread, rather than the whole process.
Uses the syscall directly so that only the calling thread has modified privileges.
Ref: http://man7.org/linux/man-pages/man2/seteuid.2.html
[in] | euid | the desired new effective user id |
Definition at line 18 of file thSetuid.cpp.
Referenced by thSetuid_test::SCENARIO(), MagAOX::app::MagAOXApp< _useINDI >::setEuidCalled(), and MagAOX::app::MagAOXApp< _useINDI >::setEuidReal().