aboutsummaryrefslogtreecommitdiff
blob: 9361382e5d666cd17af3ee2fc303688bd25835ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <signal.h>
#include <string.h>
#include <stdio.h>

#include "server.h"

static volatile char JH_SERVER_IS_RUNNING = (char) 1;

static void request_termination (int const signo)
{
   if ((signo == SIGINT) || (signo == SIGTERM))
   {
      JH_server_request_termination();
   }
}

void JH_server_request_termination (void)
{
   JH_SERVER_IS_RUNNING = (char) 0;
}

int JH_server_is_running (void)
{
   return (int) JH_SERVER_IS_RUNNING;
}

int JH_server_set_signal_handlers (void)
{
   /*
   struct sigaction act;

      act.sa_handler = request_termination;
      act.sa_mask =
      act.sa_flags =
      act.sa_restorer =
   */

   /* TODO */

   return -1;
}