Apache Mesos
Public Member Functions | Static Public Member Functions | List of all members
process::Subprocess::ChildHook Class Reference

A ChildHook can be passed to a subprocess call. More...

#include <subprocess.hpp>

Public Member Functions

Try< Nothingoperator() () const
 

Static Public Member Functions

static ChildHook CHDIR (const std::string &working_directory)
 ChildHook for changing the working directory. More...
 
static ChildHook SETSID ()
 ChildHook for generating a new session id. More...
 
static ChildHook DUP2 (int oldFd, int newFd)
 ChildHook for duplicating a file descriptor. More...
 
static ChildHook UNSET_CLOEXEC (int fd)
 ChildHook to unset CLOEXEC on a file descriptor. More...
 
static ChildHook SUPERVISOR ()
 ChildHook for starting a Supervisor process monitoring and killing the child process if the parent process terminates. More...
 

Detailed Description

A ChildHook can be passed to a subprocess call.

It provides a way to inject predefined behavior between the clone and exec calls in the child process. As such ChildHooks have to fulfill certain criteria (especially being async safe) the class does not offer a public constructor. Instead instances can be created via factory methods. NOTE: Returning an error from a childHook causes the child process to abort.

Member Function Documentation

static ChildHook process::Subprocess::ChildHook::CHDIR ( const std::string &  working_directory)
static

ChildHook for changing the working directory.

static ChildHook process::Subprocess::ChildHook::DUP2 ( int  oldFd,
int  newFd 
)
static

ChildHook for duplicating a file descriptor.

Try<Nothing> process::Subprocess::ChildHook::operator() ( ) const
inline
static ChildHook process::Subprocess::ChildHook::SETSID ( )
static

ChildHook for generating a new session id.

static ChildHook process::Subprocess::ChildHook::SUPERVISOR ( )
static

ChildHook for starting a Supervisor process monitoring and killing the child process if the parent process terminates.

NOTE: The supervisor process sets the process group id in order for it and its child processes to be killed together. We should not (re)set the sid after this.

static ChildHook process::Subprocess::ChildHook::UNSET_CLOEXEC ( int  fd)
static

ChildHook to unset CLOEXEC on a file descriptor.

This is useful to explicitly pass an FD to a subprocess.


The documentation for this class was generated from the following file: