1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-04 20:26:33 +00:00

new option max-children that limits the number of concurrent child processes

This commit is contained in:
Gerhard Rieger 2011-11-26 14:24:09 +01:00
parent 6cefd1941e
commit 02f3b29ab6
10 changed files with 99 additions and 2 deletions

View file

@ -15,7 +15,7 @@ static int xioinitialized;
xiofile_t *sock[XIO_MAXSOCK];
int (*xiohook_newchild)(void); /* xio calls this function from a new child
process */
int num_child = 0;
/* returns 0 on success or != if an error occurred */
int xioinitialize(void) {
@ -181,6 +181,7 @@ int xio_forked_inchild(void) {
for (i=0; i<NUMUNKNOWN; ++i) {
diedunknown[i] = 0;
}
num_child = 0;
xiodroplocks();
#if WITH_FIPS
if (xio_reset_fips_mode() != 0) {
@ -237,6 +238,7 @@ pid_t xio_fork(bool subchild, int level) {
return 0;
}
num_child++;
/* parent process */
Notice1("forked off child process "F_pid, pid);
/* gdb recommends to have env controlled sleep after fork */