#include <functional>
#include <Optional.hpp>
#include <Error.hpp>
Go to the source code of this file.
◆ enableCoreDumps()
Error rstudio::launcher_plugins::system::posix::enableCoreDumps |
( |
| ) |
|
Enables core dumps for this process.
- Returns
- Success if core dumps could be enabled; Error otherwise.
◆ getEnvironmentVariable()
std::string rstudio::launcher_plugins::system::posix::getEnvironmentVariable |
( |
const std::string & |
in_name | ) |
|
Gets an environment variable from the system.
- Parameters
-
in_name | The name of the environment variable. |
- Returns
- The value of the environment variable, if it exists; empty string otherwise.
◆ getIpAddresses()
launcher_plugins::Error rstudio::launcher_plugins::system::posix::getIpAddresses |
( |
std::vector< IpAddress > & |
out_addresses, |
|
|
bool |
in_includeIPv6 = false |
|
) |
| |
Gets the IP addresses of the machine running this process.
- Parameters
-
out_addresses | The IP addresses of the machine running this process. |
in_includeIPv6 | Whether or not to include IPv6 addresses. Default: false. |
- Returns
- Success if the IP addresses could be retrieved; Error otherwise.
◆ ignoreSignal()
Error rstudio::launcher_plugins::system::posix::ignoreSignal |
( |
int |
in_signal | ) |
|
Ignores a particular signal for this process.
- Parameters
-
in_signal | The signal to ignore. |
- Returns
- Success if the specified signal could be ignored; Error otherwise.
◆ posixCall() [1/2]
template<typename T >
T rstudio::launcher_plugins::system::posix::posixCall |
( |
const std::function< T()> & |
in_posixFunction | ) |
|
Makes a posix call and handles EINTR retries.
Only for use with functions that return -1 on error and set errno.
- Template Parameters
-
T | The return type of the function to be called. |
- Parameters
-
in_posixFunction | The function to call. |
- Returns
- The return value of the provided function.
◆ posixCall() [2/2]
template<typename T >
Error rstudio::launcher_plugins::system::posix::posixCall |
( |
const std::function< T()> & |
in_posixFunction, |
|
|
const ErrorLocation & |
in_errorLocation, |
|
|
T * |
out_result = nullptr |
|
) |
| |
Makes a posix call and handles EINTR retries.
Only for use with functions that return -1 on error and set errno.
- Template Parameters
-
T | The return type of the function to be called. |
- Parameters
-
in_posixFunction | The function to call. |
in_errorLocation | The location at which this function was invoked. |
out_result | Optional output parameter on which the result of in_posixFUnction will be set. |
- Returns
- Success if the posix function was invoked and ran successfully; Error otherwise.
◆ realUserIsRoot()
bool rstudio::launcher_plugins::system::posix::realUserIsRoot |
( |
| ) |
|
Checks whether the real user (not the effective user) running this process is root.
- Returns
- True if the real user is root; false otherwise.
◆ restorePrivileges()
Error rstudio::launcher_plugins::system::posix::restorePrivileges |
( |
| ) |
|
Restores privileges of the previous user, whose privileges were dropped by calling temporarilyDropPrivileges.
- Returns
- Success if privileges could be restored; Error otherwise.
◆ restoreRoot()
Error rstudio::launcher_plugins::system::posix::restoreRoot |
( |
| ) |
|
Restores root privileges.
- Returns
- Success if root privileges could be restored; Error otherwise.
◆ temporarilyDropPrivileges()
Error rstudio::launcher_plugins::system::posix::temporarilyDropPrivileges |
( |
const User & |
in_user, |
|
|
const Optional< GidType > & |
in_group |
|
) |
| |
Temporarily drops privileges from root to the requested user and group.
- Parameters
-
in_user | The user to which to drop privileges. |
in_group | The group to which to drop privileges. |
- Returns
- Success if privileges could be dropped to the requested user and group; Error otherwise.