feat: new daemon module with daemon_restart and daemon_stop implementations + daemon_start prototype

This commit is contained in:
Gu://em_ 2025-11-21 20:54:38 +01:00
parent ce61a21dad
commit 1dc653f8f3
2 changed files with 47 additions and 0 deletions

21
httpd/src/daemon/daemon.c Normal file
View file

@ -0,0 +1,21 @@
#include "daemon.h"
#include <signal.h>
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();
}

26
httpd/src/daemon/daemon.h Normal file
View file

@ -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