File lib/exec_proc.c

Takes a string, splits up the arguments into an array, and launches the resulting array via exec().


Included Files


Global Variable PROCNAME

char PROCNAME[128]
Included from include/ubs.h

Global Variable CUR_TIME

struct tm* CUR_TIME
Included from include/ubs.h

Global Variable GLOBAL

ubs_table GLOBAL
Included from include/ubs.h

Global Variable LOGLEVEL

int LOGLEVEL
Included from include/ubs.h

Global Function exec_proc()

Frontend to execvp(), which is the preferred exec() variant used by the UBS.

int exec_proc ( char* command, char* subarg )

int exec_proc
Returns NO_MEM on a memory allocation error, or NO_FORK, if something else goes wrong. Since this function calls exec (but never actually forks itself; the caller must take care of that), then it will never return.
char* command
The string to be executed. Each argument must be separated by some whitespace.
char* subarg
Optionally, the *command string may contain an argument which may be substituted in for another string. If this is the case, then the command string must contain '%s' somewhere in it, and the *subarg string will be inserted in place of the '%s'.
Prototyped in: include/ubs.h
Calls: bzero(), execvp(), exit(), log_error_msg(), malloc(), strchr(), strcmp(), strncpy()

Global Function ping_pid()

Sends a unix signal "ping" to a UBS module that will be intercepted.

int ping_pid ( char* target )

int ping_pid
Returns OK if the process is running, NO_SIGNAL if the process is not running, and NO_FILE if the .pid file is not present or malformed.
char* target
The process name to ping
Prototyped in: include/ubs.h
Calls: atoi(), fclose(), fgets(), fopen(), kill(), snprintf(), ubs_table_data()
Called by: check_running()lib/common.c