sbuild
1.6.10
|
Chroot personality. More...
#include <sbuild-personality.h>
Public Types | |
enum | error_code { BAD, SET } |
Error codes. More... | |
typedef unsigned long | type |
Personality type. | |
typedef custom_error< error_code > | error |
Exception type. | |
Public Member Functions | |
personality () | |
The constructor. More... | |
personality (std::string const &persona) | |
The constructor. More... | |
~personality () | |
std::string const & | get_name () const |
Get the name of the personality. More... | |
void | set_name (std::string const &persona) |
Set the name of the personality. More... | |
type | get () const |
Get the personality. More... | |
void | set () const |
Set the process personality. More... | |
Static Public Member Functions | |
static std::string | get_personalities () |
Print a list of the available personalities. More... | |
Static Private Member Functions | |
static type | find_personality (std::string const &persona) |
Find a personality by name. More... | |
static std::string const & | find_personality (type persona) |
Find a personality by number. More... | |
Private Attributes | |
std::string | persona_name |
The name of the current personality. | |
type | persona |
The personality type. | |
Static Private Attributes | |
static std::map< std::string, type > | personalities |
Mapping between personality name and type. | |
Friends | |
template<class charT , class traits > | |
std::basic_istream< charT, traits > & | operator>> (std::basic_istream< charT, traits > &stream, personality &rhs) |
Get the personality name from a stream. More... | |
template<class charT , class traits > | |
std::basic_ostream< charT, traits > & | operator<< (std::basic_ostream< charT, traits > &stream, personality const &rhs) |
Print the personality name to a stream. More... | |
Chroot personality.
A chroot may have a personality (also knows as a process execution domain) which is used to run non-native binaries. For example, running 32-bit Linux binaries on a 64-bit Linux system, or an SVR4 binary on a 32-bit Linux system. This is currently a Linux only feature; it does nothing on non-Linux systems. This is a wrapper around the personality(2) system call.
sbuild::personality::personality | ( | ) |
The constructor.
On Linux systems, this is initialised with the current process' personality. On non-Linux systems, it is initialised as "undefined".
References set_name().
sbuild::personality::personality | ( | std::string const & | persona | ) |
sbuild::personality::~personality | ( | ) |
|
staticprivate |
Find a personality by name.
persona | the personality to find. |
References personalities.
Referenced by set(), and set_name().
|
staticprivate |
Find a personality by number.
persona | the personality to find. |
References personalities.
sbuild::personality::type sbuild::personality::get | ( | ) | const |
std::string const & sbuild::personality::get_name | ( | ) | const |
Get the name of the personality.
References persona_name.
Referenced by set().
|
static |
Print a list of the available personalities.
References sbuild::_(), and personalities.
Referenced by set_name().
void sbuild::personality::set | ( | ) | const |
Set the process personality.
This sets the personality (if valid) using the personality(2) system call. If setting the personality fails, an error is thown.
References find_personality(), get_name(), persona, and SET.
Referenced by sbuild::session::run_child().
void sbuild::personality::set_name | ( | std::string const & | persona | ) |
Set the name of the personality.
persona | the persona to set. |
References BAD, find_personality(), get_personalities(), persona, persona_name, and sbuild::error_base::set_reason().
Referenced by personality().
|
friend |
Print the personality name to a stream.
stream | the stream to output to. |
rhs | the personality to output. |
|
friend |
Get the personality name from a stream.
stream | the stream to get input from. |
rhs | the personality to set. |