MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / sig_handler

Function sig_handler

extern/editline/src/sig.c:68–107  ·  view source on GitHub ↗

sig_handler(): * This is the handler called for all signals * XXX: we cannot pass any data so we just store the old editline * state in a private variable */

Source from the content-addressed store, hash-verified

66 * state in a private variable
67 */
68private void
69sig_handler(int signo)
70{
71 int i;
72 sigset_t nset, oset;
73
74 (void) sigemptyset(&nset);
75 (void) sigaddset(&nset, signo);
76 (void) sigprocmask(SIG_BLOCK, &nset, &oset);
77
78 sel->el_signal->sig_no = signo;
79
80 switch (signo) {
81 case SIGCONT:
82 tty_rawmode(sel);
83 if (ed_redisplay(sel, 0) == CC_REFRESH)
84 re_refresh(sel);
85 terminal__flush(sel);
86 break;
87
88 case SIGWINCH:
89 el_resize(sel);
90 break;
91
92 default:
93 tty_cookedmode(sel);
94 break;
95 }
96
97 for (i = 0; sighdl[i] != -1; i++)
98 if (signo == sighdl[i])
99 break;
100
101 (void) sigaction(signo, &sel->el_signal->sig_action[i], NULL);
102 sel->el_signal->sig_action[i].sa_handler = SIG_ERR;
103 sel->el_signal->sig_action[i].sa_flags = 0;
104 sigemptyset(&sel->el_signal->sig_action[i].sa_mask);
105 (void) sigprocmask(SIG_SETMASK, &oset, NULL);
106 (void) kill(0, signo);
107}
108
109
110/* sig_init():

Callers

nothing calls this directly

Calls 7

tty_rawmodeFunction · 0.85
ed_redisplayFunction · 0.85
re_refreshFunction · 0.85
terminal__flushFunction · 0.85
el_resizeFunction · 0.85
tty_cookedmodeFunction · 0.85
sigactionClass · 0.70

Tested by

no test coverage detected