process: associate open connections with clients
This commit is contained in:
17
process.h
17
process.h
@ -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__
|
||||
|
Reference in New Issue
Block a user