Back to index

nagios-plugins  1.4.16
Classes | Defines | Typedefs | Functions
runcmd.h File Reference
#include "common.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.


struct  output
 types More...


#define NP_RUNCMD_INIT   np_runcmd_init()
#define RUNCMD_NO_ARRAYS   0x01 /* don't populate arrays at all */
#define RUNCMD_NO_ASSOC   0x02 /* output.line won't point to buf */


typedef struct output


int np_runcmd (const char *, output *, output *, int)
void popen_timeout_alarm_handler (int) __attribute__((__noreturn__))
void np_runcmd_init (void)

Class Documentation

struct output


Definition at line 11 of file utils_cmd.h.

Class Members
char * buf
size_t buflen
size_t * lens
char ** line
size_t lines

Define Documentation

Definition at line 47 of file runcmd.h.

#define RUNCMD_NO_ARRAYS   0x01 /* don't populate arrays at all */

Definition at line 50 of file runcmd.h.

#define RUNCMD_NO_ASSOC   0x02 /* output.line won't point to buf */

Definition at line 51 of file runcmd.h.

Typedef Documentation

typedef struct output

Definition at line 38 of file runcmd.h.

Function Documentation

int np_runcmd ( const char *  ,
output ,
output ,


Definition at line 344 of file runcmd.c.

       int fd, pfd_out[2], pfd_err[2];

       /* initialize the structs */
       if(out) memset(out, 0, sizeof(output));
       if(err) memset(err, 0, sizeof(output));

       if((fd = np_runcmd_open(cmd, pfd_out, pfd_err)) == -1)
              die (STATE_UNKNOWN, _("Could not open pipe: %s\n"), cmd);

       if(out) out->lines = np_fetch_output(pfd_out[0], out, flags);
       if(err) err->lines = np_fetch_output(pfd_err[0], err, flags);

       return np_runcmd_close(fd);

Here is the call graph for this function:

Here is the caller graph for this function:

void np_runcmd_init ( void  )

Definition at line 295 of file popen.c.

       int fh;
       if (signo == SIGALRM) {
              if (child_process != NULL) {
                     fh=fileno (child_process);
                     if(fh >= 0){
                            kill (childpid[fh], SIGKILL);
                     printf (_("CRITICAL - Plugin timed out after %d seconds\n"),
              } else {
                     printf ("%s\n", _("CRITICAL - popen timeout received, but no child process"));
              exit (STATE_CRITICAL);

Here is the caller graph for this function: