#include <pipe.h>
|
| FRIEND_TEST (T_Util, ManagedExecRunShell) |
|
| FRIEND_TEST (T_Util, ManagedExecExecuteBinaryDoubleFork) |
|
| FRIEND_TEST (T_Util, ManagedExecExecuteBinaryAsChild) |
|
| Pipe (const int fd_read, const int fd_write) |
|
void | MakePipe (int pipe_fd[2]) |
|
void | WritePipe (int fd, const void *buf, size_t nbyte) |
|
void | ReadPipe (int fd, void *buf, size_t nbyte) |
|
template<PipeType pipeType>
class Pipe< pipeType >
Definition at line 45 of file pipe.h.
template<PipeType pipeType>
A pipe is a simple asynchronous communication mechanism. It establishes a unidirectional communication link between two file descriptors. One of them is used to only write to the pipe, the other one only to read from it.
This class is a simple wrapper around the handling of a "standard" pipe that uses system calls.
- Note
- PipeType as class template parameter should symbolize the functionality of the specific type, independent of what variable name it has
Definition at line 63 of file pipe.h.
template<PipeType pipeType>
Destructor closes all valid file descriptors of the pipe
Definition at line 73 of file pipe.h.
template<PipeType pipeType>
Pipe< pipeType >::Pipe |
( |
const int |
fd_read, |
|
|
const int |
fd_write |
|
) |
| |
|
inlineprivate |
Only used in the unit tests to test pipes using stdin/stdout as read/write.
Definition at line 205 of file pipe.h.
template<PipeType pipeType>
void Pipe< pipeType >::Close |
( |
| ) |
|
|
inline |
Closes all open file descriptors of the pipe and marks them as invalid
Definition at line 80 of file pipe.h.
template<PipeType pipeType>
void Pipe< pipeType >::CloseReadFd |
( |
| ) |
|
|
inline |
Closes file descriptor that reads from the pipe and marks it as invalid.
Definition at line 88 of file pipe.h.
Referenced by Watchdog::Fork().
template<PipeType pipeType>
void Pipe< pipeType >::CloseWriteFd |
( |
| ) |
|
|
inline |
Closes file descriptor that writes to the pipe and marks it as invalid.
Definition at line 98 of file pipe.h.
Referenced by Watchdog::Fork().
template<PipeType pipeType>
Pipe< pipeType >::FRIEND_TEST |
( |
T_Util |
, |
|
|
ManagedExecRunShell |
|
|
) |
| |
|
private |
template<PipeType pipeType>
Pipe< pipeType >::FRIEND_TEST |
( |
T_Util |
, |
|
|
ManagedExecExecuteBinaryDoubleFork |
|
|
) |
| |
|
private |
template<PipeType pipeType>
Pipe< pipeType >::FRIEND_TEST |
( |
T_Util |
, |
|
|
ManagedExecExecuteBinaryAsChild |
|
|
) |
| |
|
private |
template<PipeType pipeType>
int Pipe< pipeType >::GetReadFd |
( |
| ) |
const |
|
inline |
Returns the file descriptor that reads from the pipe
Definition at line 186 of file pipe.h.
template<PipeType pipeType>
int Pipe< pipeType >::GetWriteFd |
( |
| ) |
const |
|
inline |
template<PipeType pipeType>
void Pipe< pipeType >::MakePipe |
( |
int |
pipe_fd[2] | ) |
|
|
inlineprivate |
Creating a pipe should always succeed.
Definition at line 211 of file pipe.h.
template<PipeType pipeType>
template<typename T >
bool Pipe< pipeType >::Read |
( |
T * |
data | ) |
|
|
inline |
template<PipeType pipeType>
bool Pipe< pipeType >::Read |
( |
void * |
buf, |
|
|
size_t |
nbyte |
|
) |
| |
|
inline |
Reads an object from the pipe If possible, it is recommend to use "bool Read(T *data)""
- Returns
- true on success otherwise kills the program with an assert
Definition at line 178 of file pipe.h.
template<PipeType pipeType>
void Pipe< pipeType >::ReadPipe |
( |
int |
fd, |
|
|
void * |
buf, |
|
|
size_t |
nbyte |
|
) |
| |
|
inlineprivate |
Reads from a pipe should always succeed.
Definition at line 239 of file pipe.h.
template<PipeType pipeType>
template<typename T >
bool Pipe< pipeType >::TryRead |
( |
T * |
data | ) |
|
|
inline |
(Re)tries to read from the pipe until it receives data or returned error is NOT a system interrupt
- Returns
- true if sizeof(data) bytes were received false otherwise
Definition at line 151 of file pipe.h.
template<PipeType pipeType>
template<typename T >
bool Pipe< pipeType >::TryWrite |
( |
const T & |
data | ) |
|
|
inline |
Tries to write an object to the pipe
- Returns
- true if the entire object was written false otherwise
Definition at line 112 of file pipe.h.
template<PipeType pipeType>
template<typename T >
bool Pipe< pipeType >::Write |
( |
const T & |
data | ) |
|
|
inline |
Writes an object to the pipe
- Returns
- true on success otherwise kills the program with an assert
Definition at line 125 of file pipe.h.
Referenced by Watchdog::Fork().
template<PipeType pipeType>
bool Pipe< pipeType >::Write |
( |
const void * |
buf, |
|
|
size_t |
nbyte |
|
) |
| |
|
inline |
Writes an object to the pipe If possible, it is recommended to use "bool Write(const T &data)"
- Returns
- true on success otherwise kills the program with an assert
Definition at line 138 of file pipe.h.
template<PipeType pipeType>
void Pipe< pipeType >::WritePipe |
( |
int |
fd, |
|
|
const void * |
buf, |
|
|
size_t |
nbyte |
|
) |
| |
|
inlineprivate |
Writes to a pipe should always succeed.
Definition at line 222 of file pipe.h.
template<PipeType pipeType>
int Pipe< pipeType >::fd_read_ |
|
private |
template<PipeType pipeType>
int Pipe< pipeType >::fd_write_ |
|
private |
The documentation for this class was generated from the following file:
- /home/sftnight/jenkins/workspace/CvmfsDoxygen/label/docker-x86_64/cvmfs/cvmfs/util/pipe.h