Go to the source code of this file.
◆ plugin_launch()
int plugin_launch |
( |
struct arglist * |
globals, |
|
|
struct scheduler_plugin * |
plugin, |
|
|
struct host_info * |
hostinfo, |
|
|
kb_t |
kb, |
|
|
char * |
name |
|
) |
| |
- Returns
- PID of process that is connected to the plugin as returned by plugin classes pl_launch function (<=0 means there was a problem).
Definition at line 414 of file pluginlaunch.c.
421 while (num_running_processes >= max_running_processes)
423 read_running_processes ();
424 update_running_processes ();
427 p = next_free_process (plugin);
428 processes[p].
plugin = plugin;
429 processes[p].
timeout = prefs_nvt_timeout (plugin->
oid);
430 if (processes[p].timeout == 0)
431 processes[p].
timeout = nvticache_get_timeout (plugin->
oid);
433 if (processes[p].timeout == 0)
435 int category = nvticache_get_category (plugin->
oid);
436 if (category == ACT_SCANNER)
437 processes[p].
timeout = atoi (prefs_get (
"scanner_plugins_timeout")
440 processes[p].
timeout = atoi (prefs_get (
"plugins_timeout") ?:
"-1");
443 if (socketpair (AF_UNIX, SOCK_STREAM, 0, dsoc) < 0)
445 perror (
"pluginlaunch.c:plugin_launch:socketpair(1) ");
447 gettimeofday (&(processes[p].start), NULL);
449 processes[p].
upstream_soc = arg_get_value_int (globals,
"global_socket");
455 processes[p].
alive = 1;
457 if (processes[p].pid > 0)
458 num_running_processes++;
462 return processes[p].
pid;
struct scheduler_plugin * plugin
int nasl_plugin_launch(struct arglist *globals, struct host_info *hostinfo, kb_t kb, char *name, const char *oid, int soc)
Launch a NASL plugin.
#define PLUGIN_STATUS_UNRUN
◆ pluginlaunch_child_cleanup()
void pluginlaunch_child_cleanup |
( |
void |
| ) |
|
Cleanup file descriptors used by the processes array. To be called by the child process running the plugin.
Definition at line 486 of file pluginlaunch.c.
References MAX_PROCESSES.
490 if (processes[i].internal_soc)
491 close (processes[i].internal_soc);
#define MAX_PROCESSES
'Hard' limit of the max. number of concurrent plugins per host.
◆ pluginlaunch_disable_parrallel_checks()
void pluginlaunch_disable_parrallel_checks |
( |
void |
| ) |
|
◆ pluginlaunch_enable_parrallel_checks()
void pluginlaunch_enable_parrallel_checks |
( |
void |
| ) |
|
Definition at line 372 of file pluginlaunch.c.
374 max_running_processes = old_max_running_processes;
◆ pluginlaunch_init()
void pluginlaunch_init |
( |
const char * |
| ) |
|
Definition at line 344 of file pluginlaunch.c.
346 struct arglist *preferences = preferences_get ();
347 non_simult_ports_list = arg_get_value (preferences,
"non_simult_ports_list");
349 old_max_running_processes = max_running_processes;
355 (
"max_checks (%d) > MAX_PROCESSES (%d) - modify openvas-scanner/openvassd/pluginlaunch.c",
361 num_running_processes = 0;
362 bzero (&(processes),
sizeof (processes));
void log_write(const char *str,...)
Write into the logfile / syslog.
#define MAX_PROCESSES
'Hard' limit of the max. number of concurrent plugins per host.
Host information, implemented as doubly linked list.
int get_max_checks_number(void)
◆ pluginlaunch_stop()
void pluginlaunch_stop |
( |
int |
| ) |
|
Definition at line 379 of file pluginlaunch.c.
385 read_running_processes ();
389 if (processes[i].pid > 0)
390 kill (processes[i].pid, SIGTERM);
397 if (processes[i].pid > 0)
399 kill (processes[i].pid, SIGKILL);
400 num_running_processes--;
402 close (processes[i].internal_soc);
403 bzero (&(processes[i]),
sizeof (
struct running));
struct scheduler_plugin * plugin
#define MAX_PROCESSES
'Hard' limit of the max. number of concurrent plugins per host.
#define PLUGIN_STATUS_DONE
Structure to represent a process in the sense of a running NVT.
◆ pluginlaunch_wait()
void pluginlaunch_wait |
( |
void |
| ) |
|
Waits and 'pushes' processes until num_running_processes is 0.
Definition at line 470 of file pluginlaunch.c.
References wait_for_children().
475 read_running_processes ();
476 update_running_processes ();
478 while (num_running_processes != 0);
◆ pluginlaunch_wait_for_free_process()
void pluginlaunch_wait_for_free_process |
( |
void |
| ) |
|
Waits and 'pushes' processes until the number of running processes has changed.
Definition at line 499 of file pluginlaunch.c.
Referenced by plugin_next_unrun_dependency().
501 int num = num_running_processes;
502 while (num && num_running_processes == num)
505 read_running_processes ();
506 update_running_processes ();
◆ wait_for_children()
int wait_for_children |
( |
void |
| ) |
|
Definition at line 126 of file pluginlaunch.c.
References MAX_PROCESSES.
Referenced by pluginlaunch_wait().
131 if (processes[i].pid != 0)
136 ret = waitpid (-1, NULL, WNOHANG);
138 while (ret < 0 && errno == EINTR);
#define MAX_PROCESSES
'Hard' limit of the max. number of concurrent plugins per host.