30 #include <sys/types.h>
47 G_EXCEPTION( CannotChangeDirectory ,
"cannot cd()" ) ;
48 G_EXCEPTION( InvalidId ,
"invalid process-id string" ) ;
55 public:
explicit Id( std::istream & ) ;
57 public: std::string
str()
const ;
59 private: pid_t m_pid ;
69 public:
static void set(
Mode ) ;
71 private:
void operator=(
const Umask & ) ;
72 private:
class UmaskImp ;
73 private: UmaskImp * m_imp ;
79 static void closeFiles(
bool keep_stderr =
false ) ;
88 static void cd(
const Path & dir ) ;
154 return stream <<
id.str() ;
An empty structure that is used to indicate a signal-safe, reentrant implementation.
static void closeStderr()
Closes stderr.
A very low-level interface to getpwnam() and the get/set/e/uid/gid functions.
Used to temporarily modify the process umask.
static int errno_()
Returns the process's current 'errno' value.
static Identity beOrdinary(Identity nobody, bool change_group=true)
Revokes special privileges (root or suid).
static Identity beSpecial(Identity special, bool change_group=true)
Re-acquires special privileges (either root or suid).
bool operator==(const Id &) const
An overload discriminator for Process.
static void revokeExtraGroups()
Revokes secondary group memberships if really root or if suid.
A convenience class which, when used as a private base, can improve readability when calling Identity...
#define G_EXCEPTION(class_name, description)
define as a function rather than a type if optimising for size
static void cd(const Path &dir)
Changes directory.
std::ostream & operator<<(std::ostream &stream, const G::Identity &identity)
static void closeFiles(bool keep_stderr=false)
Closes all open file descriptors.
static void beNobody(Identity)
If currently running with a real identity of root then the real identity is set to the nobody identit...
A private implementation class used by G::Process.
A static interface for doing things with processes.
std::istream & operator>>(std::istream &stream, G::Process::Id &id)
A Path object represents a file system path.
static std::string strerror(int errno_)
Translates an 'errno' value into a meaningful diagnostic string.
A static interface for creating new processes.