diff --git a/httpd/src/daemon/daemon.c b/httpd/src/daemon/daemon.c new file mode 100644 index 0000000..3962703 --- /dev/null +++ b/httpd/src/daemon/daemon.c @@ -0,0 +1,21 @@ +#include "daemon.h" + +#include + +void stop_daemon(int pid) +{ + if (pid != -1) + kill(pid, SIGINT); +} + +int start_daemon(void) +{} + +int restart_daemon(int pid) +{ + // Attempt to kill process + stop_daemon(pid); + + // Start again + return start_daemon(); +} diff --git a/httpd/src/daemon/daemon.h b/httpd/src/daemon/daemon.h new file mode 100644 index 0000000..f83ec6a --- /dev/null +++ b/httpd/src/daemon/daemon.h @@ -0,0 +1,26 @@ +#ifndef DAEMON_H +#define DAEMON_H + +#include "../config/config.h" + +/* @brief + * + * @param + */ +void stop_daemon(int pid); + +/* @brief + * + * @param + */ +int start_daemon(void); + +/* @brief + * + * @param + * + * @return + */ +int restart_daemon(int pid); + +#endif // ! DAEMON_H