Upgraded GRUB2 to 2.00 release.
[AROS.git] / compiler / clib / signal.c
blob440021a2514821dd6a2dde3ff65fc06715ce768d
1 /*
2 Copyright © 2004-2012, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include "__signal.h"
8 /*****************************************************************************
10 NAME */
12 #include <signal.h>
14 __sighandler_t *signal(
16 /* SYNOPSIS */
17 int signum,
18 __sighandler_t *handler)
20 /* FUNCTION
21 Set signal handler for a signal.
23 INPUTS
24 signum - the signal number to register a handler for
25 handler - the signal handler; can be SIG_IGN, SIG_DFL or a function
26 pointer that will handle the signal
28 RESULT
29 The old handler that was replaced by the new handler.
31 NOTES
32 Implemented but no interrupts will be generated like when pressing
33 Ctrl-C; signal handlers can for now only be called by raise() in the
34 program itself.
36 EXAMPLE
38 BUGS
40 SEE ALSO
42 INTERNALS
44 ******************************************************************************/
46 struct signal_func_data *sigfuncdata = __sig_getfuncdata(signum);
48 if (!sigfuncdata)
49 return SIG_ERR;
51 __sighandler_t *ret = sigfuncdata->sigfunc;
52 sigfuncdata->sigfunc = handler;
54 return ret;