chiark / gitweb /
Infrastructure: Strip away crufty CVS $Id$ tags.
[mLib] / sig.h
1 /* -*-c-*-
2  *
3  * Signal handling
4  *
5  * (c) 1999 Straylight/Edgeware
6  */
7
8 /*----- Licensing notice --------------------------------------------------*
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.
16  *
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.
21  *
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
28 #ifndef MLIB_SIG_H
29 #define MLIB_SIG_H
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