37 class FatPipeReceiver ;
81 G_EXCEPTION( Error ,
"fat pipe error" ) ;
90 void doParent(
bool auto_cleanup =
true ) ;
96 void send(
const char * data ,
size_t size ,
const char * type =
nullptr ) ;
100 void send(
const std::vector<char> & data ,
const char * type =
nullptr ) ;
104 void send(
const std::vector<std::pair<const char *,size_t> > & data ,
const char * type =
nullptr ) ;
108 void send(
const std::vector<std::vector<char> > & data ,
const char * type =
nullptr ) ;
119 const char *
pipefd()
const ;
125 enum { MAGIC = 0xbeef } ;
135 enum { MAGIC = 0xdead } ;
148 void operator=(
const FatPipe & ) ;
149 static size_t sensible(
size_t ) ;
150 static std::string name() ;
151 static std::string name(
size_t ) ;
152 static std::string tostring(
int ) ;
153 static void close_(
int ) ;
155 void send(
size_t ,
size_t ,
const char ** ,
size_t * ,
const char * type ) ;
161 unique_ptr<G::SharedMemory> m_shmem_data ;
164 std::string m_arg_shmemfd ;
165 std::string m_arg_pipefd ;
167 std::vector<const char*> m_data_p ;
168 std::vector<size_t> m_data_n ;
180 bool receive( std::vector<char> & buffer , std::string * type_p =
nullptr ,
G::EpochTime * =
nullptr ) ;
194 static void wait(
int pipe_fd ) ;
199 typedef FatPipe::Error Error ;
206 struct Info {
bool got_data ;
bool got_eof ;
int data_fd ; } ;
207 static Info flush(
int pipe_fd ) ;
212 unique_ptr<SharedMemory> m_shmem_data ;
A subsecond-resolution timestamp based on a time_t.
int pipefd() const
Returns the pipe fd.
An empty structure that is used to indicate a signal-safe, reentrant implementation.
void send(const char *data, size_t size, const char *type=nullptr)
Sends a chunk of data to the child process.
Shared memory structure for G::FatPipe.
void doChild()
To be called from the child process after fork().
const char * pipefd() const
Returns the pipe file descriptor as a string pointer (suitable for exec()).
RAII class to lock the G::FatPipe control segment.
A semaphore class with a posix or sysv implementation chosen at build-time.
const char * shmemfd() const
Returns the shared memory file descriptor as a string pointer (suitable for exec()).
void doParent(bool auto_cleanup=true)
To be called from the parent process after fork().
A POSIX shared memory class.
Shared memory structure for G::FatPipe.
static void wait(int pipe_fd)
A convenience function that sets the pipe fd to be non-blocking and does a non-multiplexed wait for a...
A class to read a fat pipe in the child process.
FatPipeReceiver(int shmem_fd, int pipe_fd)
Constructor.
bool receive(std::vector< char > &buffer, std::string *type_p=nullptr, G::EpochTime *=nullptr)
Reads a message from the fat pipe's shared memory into the supplied buffer.
bool ping()
Returns true if the receiver seems to be there.
A one-way, unreliable-datagram communication channel from a parent process to a child process...