diff options
author | ng0 <ng0@n0.is> | 2019-09-09 19:17:18 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-09-09 19:17:18 +0000 |
commit | 483b0139a218a5f8a8311bda3eb23bcd88f57688 (patch) | |
tree | d9e7a0f5053cdaa1a720485b93e9927f08466958 /src/util/signal.c | |
parent | ec472b1aae122481f4f7e760e5242753eba9bf87 (diff) | |
download | gnunet-483b0139a218a5f8a8311bda3eb23bcd88f57688.tar.gz gnunet-483b0139a218a5f8a8311bda3eb23bcd88f57688.zip |
Remove win32 and cygwin support
Diffstat (limited to 'src/util/signal.c')
-rw-r--r-- | src/util/signal.c | 27 |
1 files changed, 2 insertions, 25 deletions
diff --git a/src/util/signal.c b/src/util/signal.c index 96e40ba7f..ada4db5ad 100644 --- a/src/util/signal.c +++ b/src/util/signal.c | |||
@@ -39,33 +39,24 @@ struct GNUNET_SIGNAL_Context { | |||
39 | 39 | ||
40 | GNUNET_SIGNAL_Handler method; | 40 | GNUNET_SIGNAL_Handler method; |
41 | 41 | ||
42 | #ifndef MINGW | ||
43 | struct sigaction oldsig; | 42 | struct sigaction oldsig; |
44 | #endif | ||
45 | }; | 43 | }; |
46 | 44 | ||
47 | static struct GNUNET_SIGNAL_Context *sc_head; | 45 | static struct GNUNET_SIGNAL_Context *sc_head; |
48 | 46 | ||
49 | static struct GNUNET_SIGNAL_Context *sc_tail; | 47 | static struct GNUNET_SIGNAL_Context *sc_tail; |
50 | 48 | ||
51 | |||
52 | #ifdef WINDOWS | ||
53 | GNUNET_SIGNAL_Handler w32_sigchld_handler = NULL; | ||
54 | #endif | ||
55 | |||
56 | struct GNUNET_SIGNAL_Context * | 49 | struct GNUNET_SIGNAL_Context * |
57 | GNUNET_SIGNAL_handler_install(int signum, GNUNET_SIGNAL_Handler handler) | 50 | GNUNET_SIGNAL_handler_install(int signum, GNUNET_SIGNAL_Handler handler) |
58 | { | 51 | { |
59 | struct GNUNET_SIGNAL_Context *ret; | 52 | struct GNUNET_SIGNAL_Context *ret; |
60 | 53 | ||
61 | #ifndef MINGW | ||
62 | struct sigaction sig; | 54 | struct sigaction sig; |
63 | #endif | ||
64 | 55 | ||
65 | ret = GNUNET_new(struct GNUNET_SIGNAL_Context); | 56 | ret = GNUNET_new(struct GNUNET_SIGNAL_Context); |
66 | ret->sig = signum; | 57 | ret->sig = signum; |
67 | ret->method = handler; | 58 | ret->method = handler; |
68 | #ifndef MINGW | 59 | |
69 | memset(&sig, 0, sizeof(sig)); | 60 | memset(&sig, 0, sizeof(sig)); |
70 | sig.sa_handler = (void *)handler; | 61 | sig.sa_handler = (void *)handler; |
71 | sigemptyset(&sig.sa_mask); | 62 | sigemptyset(&sig.sa_mask); |
@@ -75,20 +66,7 @@ GNUNET_SIGNAL_handler_install(int signum, GNUNET_SIGNAL_Handler handler) | |||
75 | sig.sa_flags = SA_RESTART; | 66 | sig.sa_flags = SA_RESTART; |
76 | #endif | 67 | #endif |
77 | sigaction(signum, &sig, &ret->oldsig); | 68 | sigaction(signum, &sig, &ret->oldsig); |
78 | #else | ||
79 | if (signum == GNUNET_SIGCHLD) | ||
80 | w32_sigchld_handler = handler; | ||
81 | else | ||
82 | { | ||
83 | __p_sig_fn_t sigret = signal(signum, (__p_sig_fn_t)handler); | ||
84 | 69 | ||
85 | if (sigret == SIG_ERR) | ||
86 | { | ||
87 | LOG(GNUNET_ERROR_TYPE_WARNING, _("signal (%d, %p) returned %d.\n"), | ||
88 | signum, handler, sigret); | ||
89 | } | ||
90 | } | ||
91 | #endif | ||
92 | GNUNET_CONTAINER_DLL_insert_tail(sc_head, sc_tail, ret); | 70 | GNUNET_CONTAINER_DLL_insert_tail(sc_head, sc_tail, ret); |
93 | return ret; | 71 | return ret; |
94 | } | 72 | } |
@@ -96,12 +74,11 @@ GNUNET_SIGNAL_handler_install(int signum, GNUNET_SIGNAL_Handler handler) | |||
96 | void | 74 | void |
97 | GNUNET_SIGNAL_handler_uninstall(struct GNUNET_SIGNAL_Context *ctx) | 75 | GNUNET_SIGNAL_handler_uninstall(struct GNUNET_SIGNAL_Context *ctx) |
98 | { | 76 | { |
99 | #ifndef MINGW | ||
100 | struct sigaction sig; | 77 | struct sigaction sig; |
101 | 78 | ||
102 | sigemptyset(&sig.sa_mask); | 79 | sigemptyset(&sig.sa_mask); |
103 | sigaction(ctx->sig, &ctx->oldsig, &sig); | 80 | sigaction(ctx->sig, &ctx->oldsig, &sig); |
104 | #endif | 81 | |
105 | GNUNET_CONTAINER_DLL_remove(sc_head, sc_tail, ctx); | 82 | GNUNET_CONTAINER_DLL_remove(sc_head, sc_tail, ctx); |
106 | GNUNET_free(ctx); | 83 | GNUNET_free(ctx); |
107 | } | 84 | } |