Creates new threads.
More...
#include "processes.h"
#include "../misc/kb_cache.h"
#include "debug_utils.h"
#include "sighand.h"
#include <errno.h>
#include <glib.h>
#include <gvm/base/logging.h>
#include <gvm/util/mqtt.h>
#include <setjmp.h>
#include <signal.h>
#include <stdlib.h>
#include <string.h>
#include <sys/wait.h>
#include <time.h>
#include <unistd.h>
◆ G_LOG_DOMAIN
| #define G_LOG_DOMAIN "sd main" |
◆ clean_procs()
| void clean_procs |
( |
void | | ) |
|
|
static |
Cleans the process list and frees memory. This will not terminate child processes. Is primarily used after fork.
◆ create_ipc_process()
initializes a communication channels and calls a function with a new process
- Parameters
-
| func | Function to call |
| args | arguments |
- Returns
- pid of spawned process on success or one of the following errors: FORKFAILED
◆ init_child_signal_handlers()
| void init_child_signal_handlers |
( |
void | | ) |
|
|
static |
◆ post_fn_call()
| void post_fn_call |
( |
struct ipc_context * | ctx, |
|
|
void * | args ) |
|
static |
◆ pre_fn_call()
| void pre_fn_call |
( |
struct ipc_context * | ctx, |
|
|
void * | args ) |
|
static |
◆ procs_cleanup_children()
| int procs_cleanup_children |
( |
void | | ) |
|
iterates through ipcc and verify if a child is stopped or killed to free the file handler.
- Returns
- the amount of freed file handler or -1 on ipcc not initialized
◆ procs_get_ipc_contexts()
◆ procs_terminate_childs()
| void procs_terminate_childs |
( |
void | | ) |
|
This function terminates all processes spawned with create_process. Calls terminate_child for each process active. In case init_procs was not called this function does nothing.
◆ reuse_or_add_context()
◆ terminate_process()
| int terminate_process |
( |
pid_t | pid | ) |
|
Terminates a given process. If termination does not work, the process will get killed. Terminate process can be called with the (-1 * pid) to send the signal to the process group.
- Parameters
-
| pid | id of the child process |
- Returns
- int 0 on success, NOCHILD if child does not exist, NOINIT if not initialized
◆ ipcc