comparison lib/fatal-signal.c @ 40238:3ac749aa0041

fatal-signal: Pass the signal number to the action. * lib/fatal-signal.h (at_fatal_signal): Change the signature. * lib/fatal-signal.c (action_t): Take the signal number as parameter. (fatal_signal_handler): Pass the signal number to the action. * lib/clean-temp.c (cleanup_action): Renamed from cleanup. Take the signal number as parameter. (create_temp_dir): Update. * lib/wait-process.c (cleanup_slaves_action): New function. (register_slave_subprocess): Update at_fatal_signal invocation. * NEWS: Mention the change.
author Bruno Haible <bruno@clisp.org>
date Sat, 16 Mar 2019 22:56:21 +0100
parents b1386ce84ff5
children
comparison
equal deleted inserted replaced
40237:b1386ce84ff5 40238:3ac749aa0041
105 105
106 106
107 /* ========================================================================= */ 107 /* ========================================================================= */
108 108
109 109
110 typedef void (*action_t) (void); 110 typedef void (*action_t) (int sig);
111 111
112 /* Type of an entry in the actions array. 112 /* Type of an entry in the actions array.
113 The 'action' field is accessed from within the fatal_signal_handler(), 113 The 'action' field is accessed from within the fatal_signal_handler(),
114 therefore we mark it as 'volatile'. */ 114 therefore we mark it as 'volatile'. */
115 typedef struct 115 typedef struct
160 break; 160 break;
161 n--; 161 n--;
162 actions_count = n; 162 actions_count = n;
163 action = actions[n].action; 163 action = actions[n].action;
164 /* Execute the action. */ 164 /* Execute the action. */
165 action (); 165 action (sig);
166 } 166 }
167 167
168 /* Now execute the signal's default action. 168 /* Now execute the signal's default action.
169 If the signal being delivered was blocked, the re-raised signal would be 169 If the signal being delivered was blocked, the re-raised signal would be
170 delivered when this handler returns. But the way we install this handler, 170 delivered when this handler returns. But the way we install this handler,