#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
Go to the source code of this file.
◆ RLIM_INFINITY
#define RLIM_INFINITY (1024*1024*1024) |
◆ openvas_pclose()
int openvas_pclose |
( |
FILE * |
fp, |
|
|
pid_t |
pid |
|
) |
| |
Definition at line 136 of file popen.c.
139 if (waitpid (pid, NULL, WNOHANG) == 0)
140 if (kill (pid, SIGTERM) >= 0)
141 if (waitpid (pid, NULL, WNOHANG) == 0)
144 (void) kill (pid, SIGKILL);
145 (void) waitpid (pid, NULL, WNOHANG);
◆ openvas_popen4()
FILE* openvas_popen4 |
( |
const char * |
cmd, |
|
|
char *const |
args[], |
|
|
pid_t * |
ppid, |
|
|
int |
inice |
|
) |
| |
Definition at line 36 of file popen.c.
45 for (i = 0; args[i] != NULL; i++)
51 if (socketpair (AF_UNIX, SOCK_STREAM, 0, pipes) < 0)
53 perror (
"socketpair");
57 if ((son = fork ()) < 0)
75 if (nice (inice) < 0 && errno)
80 if (setrlimit (RLIMIT_DATA, &rl) < 0)
81 perror (
"RLIMIT_DATA");
82 if (setrlimit (RLIMIT_RSS, &rl) < 0)
83 perror (
"RLIMIT_RSS");
84 if (setrlimit (RLIMIT_STACK, &rl) < 0)
85 perror (
"RLIMIT_STACK");
88 if ((fd = open (
"/dev/null", O_RDONLY)) < 0)
94 if (dup2 (fd, STDIN_FILENO) < 0)
101 close (STDOUT_FILENO);
102 close (STDERR_FILENO);
103 if (dup2 (pipes[1], STDOUT_FILENO) < 0 || dup2 (pipes[1], STDERR_FILENO) < 0)
112 for (i = 3; i < 256; i++)
116 signal (SIGTERM, _exit);
117 signal (SIGPIPE, _exit);
123 if ((fp = fdopen (pipes[0],
"r")) == NULL)
void log_legacy_write(const char *format,...)
Legacy function to write a log message.
References log_legacy_write(), and RLIM_INFINITY.