process: associate open connections with clients

This commit is contained in:
Justin Maggard
2014-06-09 18:48:49 -07:00
parent e9a653d6e8
commit a46a8e5e89
5 changed files with 102 additions and 16 deletions

View File

@ -30,6 +30,16 @@
#define __PROCESS_H__
#include <unistd.h>
#include "clients.h"
struct child {
pid_t pid;
time_t age;
struct client_cache_s *client;
};
extern struct child *children;
extern int number_of_children;
/**
* Fork a new child (just like fork()) but keep track of how many childs are
@ -37,7 +47,7 @@
* @return -1 if it couldn't fork, 0 in the child process, the pid of the
* child process in the parent process.
*/
pid_t process_fork(void);
pid_t process_fork(struct client_cache_s *client);
/**
* Handler to be called upon receiving SIGCHLD. This signal is received by the
@ -63,4 +73,9 @@ int process_daemonize(void);
*/
int process_check_if_running(const char *fname);
/**
* Kill all child processes
*/
void process_reap_children(void);
#endif // __PROCESS_H__