Bitcoin Core 28.99.0
P2P Digital Currency
|
Functions | |
void | quote_argument (const std::wstring &argument, std::wstring &command_line, bool force) |
static std::vector< std::string > | split (const std::string &str, const std::string &delims=" \t") |
static void | set_clo_on_exec (int fd, bool set=true) |
static std::pair< int, int > | pipe_cloexec () noexcept(false) |
static int | write_n (int fd, const char *buf, size_t length) |
static int | read_atmost_n (FILE *fp, char *buf, size_t read_upto) |
static int | read_all (FILE *fp, std::vector< char > &buf) |
static std::pair< int, int > | wait_for_child_exit (int pid) |
|
inlinestaticnoexcept |
Function: pipe_cloexec Creates a pipe and sets FD_CLOEXEC flag on both read and write descriptors of the pipe. Parameters: [out] : A pair of file descriptors. First element of pair is the read descriptor of pipe. Second element is the write descriptor of pipe.
Definition at line 354 of file subprocess.h.
|
inline |
|
inlinestatic |
Function: read_all Reads all the available data from fp
into buf
. Internally calls read_atmost_n. Parameters: [in] fp : The file object from which to read from. [in] buf : The buffer of type class Buffer
into which the read data is written to. [out] int: Number of bytes read OR -1 in case of failure.
NOTE: class Buffer
is a exposed public class. See below.
Definition at line 450 of file subprocess.h.
|
inlinestatic |
Function: read_atmost_n Reads at the most read_upto
bytes from the file object fp
before returning. Parameters: [in] fp : The file object from which it needs to read. [in] buf : The buffer into which it needs to write the data. [in] read_upto: Max number of bytes which must be read from fd
. [out] int : Number of bytes written to buf
or read from fd
OR -1 in case of error. NOTE: In case of EINTR while reading from socket, this API will retry to read from fd
, but only till the EINTR counter reaches 50 after which it will return with whatever data it read.
Definition at line 409 of file subprocess.h.
|
inlinestatic |
Function: set_clo_on_exec Sets/Resets the FD_CLOEXEC flag on the provided file descriptor based upon the set
parameter. Parameters: [in] fd : The descriptor on which FD_CLOEXEC needs to be set/reset. [in] set : If 'true', set FD_CLOEXEC. If 'false' unset FD_CLOEXEC.
Definition at line 334 of file subprocess.h.
|
inlinestatic |
Function: split Parameters: [in] str : Input string which needs to be split based upon the delimiters provided. [in] deleims : Delimiter characters based upon which the string needs to be split. Default constructed to ' '(space) and '\t'(tab) [out] vector<string> : Vector of strings split at deleimiter.
Definition at line 303 of file subprocess.h.
|
inlinestatic |
Function: wait_for_child_exit Waits for the process with pid pid
to exit and returns its status. Parameters: [in] pid : The pid of the process. [out] pair<int, int>: pair.first : Return code of the waitpid call. pair.second : Exit status of the process.
NOTE: This is a blocking call as in, it will loop till the child is exited.
Definition at line 499 of file subprocess.h.
|
inlinestatic |
Function: write_n Writes length
bytes to the file descriptor fd
from the buffer buf
. Parameters: [in] fd : The file descriptotr to write to. [in] buf: Buffer from which data needs to be written to fd. [in] length: The number of bytes that needs to be written from buf
to fd
. [out] int : Number of bytes written or -1 in case of failure.
Definition at line 382 of file subprocess.h.