9f8886c7 |
1 | /* -*-c-*- |
2 | * |
9f8886c7 |
3 | * Signal handling |
4 | * |
5 | * (c) 1999 Straylight/Edgeware |
6 | */ |
7 | |
d4efbcd9 |
8 | /*----- Licensing notice --------------------------------------------------* |
9f8886c7 |
9 | * |
10 | * This file is part of the mLib utilities library. |
11 | * |
12 | * mLib is free software; you can redistribute it and/or modify |
13 | * it under the terms of the GNU Library General Public License as |
14 | * published by the Free Software Foundation; either version 2 of the |
15 | * License, or (at your option) any later version. |
d4efbcd9 |
16 | * |
9f8886c7 |
17 | * mLib is distributed in the hope that it will be useful, |
18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
20 | * GNU Library General Public License for more details. |
d4efbcd9 |
21 | * |
9f8886c7 |
22 | * You should have received a copy of the GNU Library General Public |
23 | * License along with mLib; if not, write to the Free |
24 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, |
25 | * MA 02111-1307, USA. |
26 | */ |
27 | |
c6e0eaf0 |
28 | #ifndef MLIB_SIG_H |
29 | #define MLIB_SIG_H |
9f8886c7 |
30 | |
31 | #ifdef __cplusplus |
32 | extern "C" { |
33 | #endif |
34 | |
35 | /*----- Header files ------------------------------------------------------*/ |
36 | |
37 | #include <signal.h> |
38 | |
39 | #include "sel.h" |
40 | |
41 | /*----- Data structures ---------------------------------------------------*/ |
42 | |
43 | typedef struct sig { |
44 | struct sig *next; |
45 | struct sig *prev; |
46 | int sig; |
47 | void (*proc)(int /*n*/, void */*p*/); |
48 | void *p; |
49 | } sig; |
50 | |
51 | /*----- Functions provided ------------------------------------------------*/ |
52 | |
53 | /* --- @sig_add@ --- * |
54 | * |
55 | * Arguments: @sig *s@ = pointer to signal handler block |
56 | * @int n@ = number of the signal |
57 | * @void (*proc)(int n, void *p)@ = signal handler function |
58 | * @void *p@ = argument to pass to handler |
59 | * |
60 | * Returns: --- |
61 | * |
62 | * Use: Adds a signal handler. |
63 | */ |
64 | |
65 | extern void sig_add(sig */*s*/, int /*n*/, |
66 | void (*/*proc*/)(int /*n*/, void */*p*/), void */*p*/); |
67 | |
68 | /* --- @sig_remove@ --- * |
69 | * |
70 | * Arguments: @sig *s@ = pointer to signal handler block |
71 | * |
72 | * Returns: --- |
73 | * |
74 | * Use: Removes the signal handler from the list. |
75 | */ |
76 | |
77 | extern void sig_remove(sig */*s*/); |
78 | |
79 | /* --- @sig_init@ --- * |
80 | * |
81 | * Arguments: @sel_state *s@ = pointer to select state |
82 | * |
83 | * Returns: --- |
84 | * |
85 | * Use: Initializes the signal handling system ready for use. |
86 | */ |
87 | |
88 | extern void sig_init(sel_state */*s*/); |
89 | |
90 | /*----- That's all, folks -------------------------------------------------*/ |
91 | |
92 | #ifdef __cplusplus |
93 | } |
94 | #endif |
95 | |
96 | #endif |