|
Nagios
4.0.6
Dev docs for Nagios core and neb-module hackers
|
runcmd library function declarations More...
#include <signal.h>Go to the source code of this file.
| #define | RUNCMD_HAS_REDIR (1 << 0) |
| Return code bitflags for runcmd_cmd2strv() More... | |
| #define | RUNCMD_HAS_SUBCOMMAND (1 << 1) |
| subcommands present | |
| #define | RUNCMD_HAS_PAREN (1 << 2) |
| parentheses present in command | |
| #define | RUNCMD_HAS_JOBCONTROL (1 << 3) |
| job control stuff present | |
| #define | RUNCMD_HAS_UBSQ (1 << 4) |
| unbalanced single quotes | |
| #define | RUNCMD_HAS_UBDQ (1 << 5) |
| unbalanced double quotes | |
| #define | RUNCMD_HAS_WILDCARD (1 << 6) |
| wildcards present | |
| #define | RUNCMD_HAS_SHVAR (1 << 7) |
| shell variables present | |
| #define | RUNCMD_EFD (-1) |
| Failed to pipe() or open() | |
| #define | RUNCMD_EALLOC (-2) |
| Failed to alloc. | |
| #define | RUNCMD_ECMD (-3) |
| Bad command. | |
| #define | RUNCMD_EFORK (-4) |
| Failed to fork() | |
| #define | RUNCMD_EINVAL (-5) |
| Invalid parameters. | |
| #define | RUNCMD_EWAIT (-6) |
| Failed to wait() | |
| void | runcmd_init (void) |
| Initialize the runcmd library. More... | |
| pid_t | runcmd_pid (int fd) |
| Return pid of a command with a specific file descriptor. More... | |
| const char * | runcmd_strerror (int code) |
| Return explanation of which system call or operation failed. More... | |
| int | runcmd_open (const char *cmd, int *pfd, int *pfderr, char **env, void(*iobreg)(int, int, void *), void *iobregarg) __attribute__((__nonnull__(1 |
| Start a command from a command string. More... | |
| int int | runcmd_close (int fd) |
| Close a command and return its exit status. More... | |
| int | runcmd_cmd2strv (const char *str, int *out_argc, char **out_argv) |
| Convert a string to a vector of arguments like a shell would. More... | |
runcmd library function declarations
| #define RUNCMD_HAS_REDIR (1 << 0) |
Return code bitflags for runcmd_cmd2strv()
I/O redirection
| int int runcmd_close | ( | int | fd | ) |
Close a command and return its exit status.
| [in] | fd | The child's stdout filedescriptor |
| int runcmd_cmd2strv | ( | const char * | str, |
| int * | out_argc, | ||
| char ** | out_argv | ||
| ) |
Convert a string to a vector of arguments like a shell would.
| [in] | str | The string to convert to an argument vector |
| [out] | out_argc | The number of arguments found |
| [out] | out_argv | The argument vector |
| void runcmd_init | ( | void | ) |
Initialize the runcmd library.
Only multi-threaded programs that might launch the first external program from multiple threads simultaneously need to bother with this.
| int runcmd_open | ( | const char * | cmd, |
| int * | pfd, | ||
| int * | pfderr, | ||
| char ** | env, | ||
| void(*)(int, int, void *) | iobreg, | ||
| void * | iobregarg | ||
| ) |
Start a command from a command string.
| [in] | cmdstring | The command to launch |
| [out] | pfd | Child's stdout filedescriptor |
| [out] | pfderr | Child's stderr filedescriptor |
| [in] | env | Currently ignored for portability |
| [in] | iobreg | The callback function to register the iobrokers for the read ends of the pipe |
| [in] | iobregarg | The "arg" value to pass to iobroker_register() |
| pid_t runcmd_pid | ( | int | fd | ) |
Return pid of a command with a specific file descriptor.
| [in] | fd | stdout filedescriptor of the child to get pid from |
| const char* runcmd_strerror | ( | int | code | ) |
Return explanation of which system call or operation failed.
| code | Error code returned by a library function |
1.8.5