All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Macros | Functions | Variables
clixon_proc.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <signal.h>
#include <grp.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/param.h>
#include <sys/user.h>
#include <sys/sysctl.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "clixon_err.h"
#include "clixon_log.h"
#include "clixon_sig.h"
#include "clixon_string.h"
#include "clixon_queue.h"
#include "clixon_chunk.h"
#include "clixon_proc.h"


#define signal_set_mask(set)   sigprocmask(SIG_SETMASK, (set), NULL)
#define signal_get_mask(set)   sigprocmask (0, NULL, (set))


static void clicon_proc_sigint (int sig)
int clicon_proc_run (char *cmd, void(outcb)(char *), int doerr)
int clicon_proc_daemon (char *cmd)
int group_name2gid (char *name, gid_t *gid)


static int _clicon_proc_child = 0

Macro Definition Documentation

#define signal_get_mask (   set)    sigprocmask (0, NULL, (set))
#define signal_set_mask (   set)    sigprocmask(SIG_SETMASK, (set), NULL)

Function Documentation

int clicon_proc_daemon ( char *  cmd)

Spawn command and report exit status

int clicon_proc_run ( char *  cmd,
void(outcb)(char *)  ,
int  doerr 

Fork a child process, setup a pipe between parent and child. Allowing parent to read the output of the child.

[in]doerrIf non-zero, stderr will be directed to the pipe as well. The pipe for the parent to write to the child is closed and cannot be used.

When child process is done with the pipe setup, execute the specified command, execv(argv[0], argv).

When parent is done with the pipe setup it will read output from the child until eof. The read output will be sent to the specified output callback, 'outcb' function.

Return values
numberMatches (processes affected).
static void clicon_proc_sigint ( int  sig)
int group_name2gid ( char *  name,
gid_t *  gid 

Translate group name to gid. Return -1 if error or not found.

Variable Documentation

int _clicon_proc_child = 0