29G::Root * G::Root::m_this = nullptr ;
30bool G::Root::m_initialised = false ;
31bool G::Root::m_fixed_group = false ;
36 m_change_group(!m_fixed_group)
39 if( m_this ==
nullptr && m_initialised )
47 m_change_group(m_fixed_group?false:change_group)
50 if( m_this ==
nullptr && m_initialised )
59 if( m_this ==
this && m_initialised )
84 m_fixed_group = fixed_group ;
85 m_initialised = true ;
96 G_WARNING(
"G::Root::check: root control object exists at outer scope" ) ;
A combination of user-id and group-id, with a very low-level interface to the get/set/e/uid/gid funct...
static Identity invalid() noexcept
Returns an invalid identity.
static void beSpecialForExit(SignalSafe, Identity special_id) noexcept
A signal-safe version of beSpecial() that should only be used just before process exit.
static void beSpecial(Identity special_id, bool change_group=true)
Re-acquires special privileges (either root or suid).
static void beOrdinary(Identity ordinary_id, bool change_group)
Releases special privileges.
static int errno_(const SignalSafe &=G::SignalSafe()) noexcept
Returns the process's current 'errno' value.
static Identity beOrdinaryAtStartup(Identity ordinary_id, bool change_group)
Revokes special privileges (root or suid), possibly including extra group membership.
A class which acquires the process's special privileges on construction and releases them on destruct...
static Identity nobody()
Returns the 'nobody' identity corresponding to the init() user name.
Root()
Default constructor.
static void init(const std::string &nobody, bool fixed_group=false)
< Desctructor.
static void atExit() noexcept
Re-acquires special privileges just before process exit.
An empty structure that is used to indicate a signal-safe, reentrant implementation.
static bool enabled() noexcept
Returns true if test features are enabled.