summaryrefslogtreecommitdiffstats
path: root/src/sync-mode.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2009-06-11 19:34:50 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2009-06-11 19:34:50 +0200
commit5e696e022d8383bc7abe6e6ba37c2664679fe81f (patch)
tree34ab3159dda9efbdf352236a60a1b1236eb17525 /src/sync-mode.c
parent0121fd74b805a6490f005c835b3994fa06487395 (diff)
conntrackd: allow to limit the number of simultaneous child processes
This patch allows to limit the number of simultaneous child processes. This is required by the next patch that replaces disposable handlers to commit and flush with permanent handlers. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/sync-mode.c')
-rw-r--r--src/sync-mode.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/sync-mode.c b/src/sync-mode.c
index 699a585..2da3604 100644
--- a/src/sync-mode.c
+++ b/src/sync-mode.c
@@ -229,7 +229,8 @@ static void do_reset_cache_alarm(struct alarm_block *a, void *data)
/* fork a child process that performs the flush operation,
* meanwhile the parent process handles events. */
- if (fork_process_new(flush_done_cb, h) == 0) {
+ if (fork_process_new(CTD_PROC_FLUSH, CTD_PROC_F_EXCL,
+ flush_done_cb, h) == 0) {
nl_flush_conntrack_table(h);
exit(EXIT_SUCCESS);
}
@@ -423,28 +424,28 @@ static int local_handler_sync(int fd, int type, void *data)
switch(type) {
case DUMP_INTERNAL:
- ret = fork_process_new(NULL, NULL);
+ ret = fork_process_new(CTD_PROC_ANY, 0, NULL, NULL);
if (ret == 0) {
cache_dump(STATE_SYNC(internal), fd, NFCT_O_PLAIN);
exit(EXIT_SUCCESS);
}
break;
case DUMP_EXTERNAL:
- ret = fork_process_new(NULL, NULL);
+ ret = fork_process_new(CTD_PROC_ANY, 0, NULL, NULL);
if (ret == 0) {
cache_dump(STATE_SYNC(external), fd, NFCT_O_PLAIN);
exit(EXIT_SUCCESS);
}
break;
case DUMP_INT_XML:
- ret = fork_process_new(NULL, NULL);
+ ret = fork_process_new(CTD_PROC_ANY, 0, NULL, NULL);
if (ret == 0) {
cache_dump(STATE_SYNC(internal), fd, NFCT_O_XML);
exit(EXIT_SUCCESS);
}
break;
case DUMP_EXT_XML:
- ret = fork_process_new(NULL, NULL);
+ ret = fork_process_new(CTD_PROC_ANY, 0, NULL, NULL);
if (ret == 0) {
cache_dump(STATE_SYNC(external), fd, NFCT_O_XML);
exit(EXIT_SUCCESS);
@@ -465,7 +466,8 @@ static int local_handler_sync(int fd, int type, void *data)
origin_register(h, CTD_ORIGIN_COMMIT);
/* fork new process and insert it the process list */
- ret = fork_process_new(commit_done_cb, h);
+ ret = fork_process_new(CTD_PROC_COMMIT, CTD_PROC_F_EXCL,
+ commit_done_cb, h);
if (ret == 0) {
dlog(LOG_NOTICE, "committing external cache");
cache_commit(STATE_SYNC(external), h);