chiark / gitweb /
New array adjustment macros for unsigned arguments.
[mLib] / sig.h
CommitLineData
9f8886c7 1/* -*-c-*-
2 *
3 * $Id: sig.h,v 1.1 1999/07/26 23:16:26 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/*----- Revision history --------------------------------------------------*
31 *
32 * $Log: sig.h,v $
33 * Revision 1.1 1999/07/26 23:16:26 mdw
34 * Signal handling integrated into I/O system.
35 *
36 */
37
38#ifndef SIG_H
39#define SIG_H
40
41#ifdef __cplusplus
42 extern "C" {
43#endif
44
45/*----- Header files ------------------------------------------------------*/
46
47#include <signal.h>
48
49#include "sel.h"
50
51/*----- Data structures ---------------------------------------------------*/
52
53typedef struct sig {
54 struct sig *next;
55 struct sig *prev;
56 int sig;
57 void (*proc)(int /*n*/, void */*p*/);
58 void *p;
59} sig;
60
61/*----- Functions provided ------------------------------------------------*/
62
63/* --- @sig_add@ --- *
64 *
65 * Arguments: @sig *s@ = pointer to signal handler block
66 * @int n@ = number of the signal
67 * @void (*proc)(int n, void *p)@ = signal handler function
68 * @void *p@ = argument to pass to handler
69 *
70 * Returns: ---
71 *
72 * Use: Adds a signal handler.
73 */
74
75extern void sig_add(sig */*s*/, int /*n*/,
76 void (*/*proc*/)(int /*n*/, void */*p*/), void */*p*/);
77
78/* --- @sig_remove@ --- *
79 *
80 * Arguments: @sig *s@ = pointer to signal handler block
81 *
82 * Returns: ---
83 *
84 * Use: Removes the signal handler from the list.
85 */
86
87extern void sig_remove(sig */*s*/);
88
89/* --- @sig_init@ --- *
90 *
91 * Arguments: @sel_state *s@ = pointer to select state
92 *
93 * Returns: ---
94 *
95 * Use: Initializes the signal handling system ready for use.
96 */
97
98extern void sig_init(sel_state */*s*/);
99
100/*----- That's all, folks -------------------------------------------------*/
101
102#ifdef __cplusplus
103 }
104#endif
105
106#endif