chiark / gitweb /
Infrastructure: Split the files into subdirectories.
[mLib] / sel / 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 #ifndef MLIB_SEL_H
40 #  include "sel.h"
41 #endif
42
43 /*----- Data structures ---------------------------------------------------*/
44
45 typedef struct sig {
46   struct sig *next;
47   struct sig *prev;
48   int sig;
49   void (*proc)(int /*n*/, void */*p*/);
50   void *p;
51 } sig;
52
53 /*----- Functions provided ------------------------------------------------*/
54
55 /* --- @sig_add@ --- *
56  *
57  * Arguments:   @sig *s@ = pointer to signal handler block
58  *              @int n@ = number of the signal
59  *              @void (*proc)(int n, void *p)@ = signal handler function
60  *              @void *p@ = argument to pass to handler
61  *
62  * Returns:     ---
63  *
64  * Use:         Adds a signal handler.
65  */
66
67 extern void sig_add(sig */*s*/, int /*n*/,
68                     void (*/*proc*/)(int /*n*/, void */*p*/), void */*p*/);
69
70 /* --- @sig_remove@ --- *
71  *
72  * Arguments:   @sig *s@ = pointer to signal handler block
73  *
74  * Returns:     ---
75  *
76  * Use:         Removes the signal handler from the list.
77  */
78
79 extern void sig_remove(sig */*s*/);
80
81 /* --- @sig_init@ --- *
82  *
83  * Arguments:   @sel_state *s@ = pointer to select state
84  *
85  * Returns:     ---
86  *
87  * Use:         Initializes the signal handling system ready for use.
88  */
89
90 extern void sig_init(sel_state */*s*/);
91
92 /*----- That's all, folks -------------------------------------------------*/
93
94 #ifdef __cplusplus
95   }
96 #endif
97
98 #endif