1 #ifndef SUBORDINATION_PPL_APPLICATION_HH     2 #define SUBORDINATION_PPL_APPLICATION_HH     7 #include <unistdx/fs/canonical_path>     8 #include <unistdx/io/two_way_pipe>     9 #include <unistdx/ipc/execute>    10 #include <unistdx/ipc/identity>    11 #include <unistdx/net/pstream>    15     typedef uint64_t application_type;
    17     enum class process_role_type {
    29         typedef application_type id_type;
    34         sys::uid_type _uid = -1;
    35         sys::gid_type _gid = -1;
    37         sys::canonical_path _workdir;
    38         mutable bool _allowroot = 
false;
    39         mutable process_role_type _processrole = process_role_type::master;
    41         static_assert(
sizeof(_uid) <= 
sizeof(uint32_t), 
"bad uid_type");
    42         static_assert(
sizeof(_gid) <= 
sizeof(uint32_t), 
"bad gid_type");
    54         workdir(
const sys::canonical_path& rhs) {
    59         set_credentials(sys::uid_type uid, sys::gid_type gid) noexcept {
    65         allow_root(
bool rhs) 
const noexcept {
    66             this->_allowroot = rhs;
    75         uid() 
const noexcept {
    80         gid() 
const noexcept {
    85         filename() 
const noexcept {
    86             return this->_args.
front();
    90         make_master() 
const noexcept {
    91             this->_processrole = process_role_type::master;
    95         make_slave() 
const noexcept {
    96             this->_processrole = process_role_type::slave;
   100         is_master() 
const noexcept {
   101             return this->_processrole == process_role_type::master;
   105         is_slave() 
const noexcept {
   106             return this->_processrole == process_role_type::slave;
   109         inline process_role_type
   110         role() 
const noexcept {
   111             return this->_processrole;
   115         execute(
const sys::two_way_pipe& pipe) 
const;
   118         write(sys::pstream& out) 
const;
   121         read(sys::pstream& in);
   135     operator<<(sys::pstream& out, 
const application& rhs) {
   141     operator>>(sys::pstream& in, application& rhs) {
   147     swap(application& lhs, application& rhs);
   149     namespace this_application {
   156         get_input_fd() noexcept;
   159         get_output_fd() noexcept;
   162         is_master() noexcept;
   171 #endif // vim:filetype=cpp 
Definition: application.hh:25