chiark / gitweb /
Various manual fixes.
[mLib] / sig.h
1 /* -*-c-*-
2  *
3  * $Id: sig.h,v 1.3 2004/04/08 01:36:13 mdw Exp $
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 #ifndef MLIB_SIG_H
31 #define MLIB_SIG_H
32
33 #ifdef __cplusplus
34   extern "C" {
35 #endif
36
37 /*----- Header files ------------------------------------------------------*/
38
39 #include <signal.h>
40
41 #include "sel.h"
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