2 This file is part of GNUnet.
3 Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 GNUnet e.V.
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
22 * @author Christian Grothoff
25 * Functions related to signals
27 * @defgroup signal Signal library
28 * Manage signal handlers.
32 #ifndef GNUNET_SIGNAL_LIB_H
33 #define GNUNET_SIGNAL_LIB_H
38 #if 0 /* keep Emacsens' auto-indent happy */
44 * Context created when a signal handler is installed;
45 * can be used to restore it to the previous state later.
47 struct GNUNET_SIGNAL_Context;
51 * A signal handler. Since different OSes have different signatures
52 * for their handlers, the API only gives the most restrictive
53 * signature -- no arguments, no return value. Note that this will
54 * work even if the OS expects a function with arguments. However,
55 * the implementation must guarantee that this handler is not called
56 * for signals other than the one that it has been registered for.
59 (*GNUNET_SIGNAL_Handler) (void);
63 * Install a signal handler that will be run if the
64 * given signal is received.
66 * @param signal the number of the signal
67 * @param handler the function to call
68 * @return context that can be used to restore, NULL on error
70 struct GNUNET_SIGNAL_Context *
71 GNUNET_SIGNAL_handler_install (int signal,
72 GNUNET_SIGNAL_Handler handler);
76 * Uninstall a previously installed signal hander.
78 * @param ctx context that was returned when the
79 * signal handler was installed
82 GNUNET_SIGNAL_handler_uninstall (struct GNUNET_SIGNAL_Context *ctx);
86 * Raise the given signal by calling the installed signal handlers. This will
87 * not use the @em raise() system call but only calls the handlers registered
88 * through GNUNET_SIGNAL_handler_install().
90 * @param sig the signal to raise
93 GNUNET_SIGNAL_raise (const int sig);
96 #if 0 /* keep Emacsens' auto-indent happy */
103 /* ifndef GNUNET_SIGNAL_LIB_H */
106 /** @} */ /* end of group */
108 /* end of gnunet_signal_lib.h */