OpenVAS Scanner 23.23.1
processes.h File Reference

processes.c header. More...

#include "../misc/ipc.h"
#include <sys/types.h>

Go to the source code of this file.

Macros

#define FORKFAILED   -1
#define NOINIT   -2
#define PROCSFULL   -3
#define NOCHILD   -4

Typedefs

typedef void(* process_func_t) (void *)

Functions

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.
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.
pid_t create_ipc_process (ipc_process_func func, void *args)
 initializes a communication channels and calls a function with a new process
const struct ipc_contextsprocs_get_ipc_contexts (void)
 returns ipc_contexts.
int procs_cleanup_children (void)
 iterates through ipcc and verify if a child is stopped or killed to free the file handler.

Detailed Description

processes.c header.

Macro Definition Documentation

◆ FORKFAILED

#define FORKFAILED   -1

◆ NOCHILD

#define NOCHILD   -4

◆ NOINIT

#define NOINIT   -2

◆ PROCSFULL

#define PROCSFULL   -3

Typedef Documentation

◆ process_func_t

typedef void(* process_func_t) (void *)

Function Documentation

◆ create_ipc_process()

pid_t create_ipc_process ( ipc_process_func func,
void * args )

initializes a communication channels and calls a function with a new process

Parameters
funcFunction to call
argsarguments
Returns
pid of spawned process on success or one of the following errors: FORKFAILED

◆ 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()

const struct ipc_contexts * procs_get_ipc_contexts ( void )

returns ipc_contexts.

Returns
the globally hold array of all ipc_context; do not manipulate them.

◆ 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.

◆ 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
pidid of the child process
Returns
int 0 on success, NOCHILD if child does not exist, NOINIT if not initialized