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