From 0374398fd14bf587d80d9d31e361e266e69387c8 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Sat, 23 May 2009 12:09:06 +0200 Subject: conntrackd: add child process infrastructure This patch adds a simple infrastructure that allows to account the child processes that have been forked. This also includes a callback handler that can be registered that is called once the child process finishes. We can extended this later to include an alarm to limit the maximum lifetime of a forked child process. This is good to ensure that child processes behave timely. Signed-off-by: Pablo Neira Ayuso --- include/Makefile.am | 3 ++- include/process.h | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 include/process.h (limited to 'include') diff --git a/include/Makefile.am b/include/Makefile.am index f02ce89..0ea056c 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -3,5 +3,6 @@ noinst_HEADERS = alarm.h jhash.h cache.h linux_list.h linux_rbtree.h \ sync.h conntrackd.h local.h udp.h \ debug.h log.h hash.h mcast.h conntrack.h \ network.h filter.h queue.h vector.h cidr.h \ - traffic_stats.h netlink.h fds.h event.h bitops.h channel.h + traffic_stats.h netlink.h fds.h event.h bitops.h channel.h \ + process.h diff --git a/include/process.h b/include/process.h new file mode 100644 index 0000000..a7f07ea --- /dev/null +++ b/include/process.h @@ -0,0 +1,14 @@ +#ifndef _PROCESS_H_ +#define _PROCESS_H_ + +struct child_process { + struct list_head head; + int pid; + void (*cb)(void *data); + void *data; +}; + +int fork_process_new(void (*cb)(void *data), void *data); +int fork_process_delete(int pid); + +#endif -- cgit v1.2.3