2004-09-14 04:24:52 +00:00
|
|
|
/* Copyright (C) 1992, 1997, 2004 Free Software Foundation, Inc.
|
1997-05-26 22:28:25 +00:00
|
|
|
This file is part of the GNU C Library.
|
1993-10-23 00:50:20 +00:00
|
|
|
|
1997-05-26 22:28:25 +00:00
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
2001-07-06 04:56:23 +00:00
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) any later version.
|
1993-10-23 00:50:20 +00:00
|
|
|
|
1997-05-26 22:28:25 +00:00
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2001-07-06 04:56:23 +00:00
|
|
|
Lesser General Public License for more details.
|
1993-10-23 00:50:20 +00:00
|
|
|
|
2001-07-06 04:56:23 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with the GNU C Library; if not, write to the Free
|
|
|
|
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
|
|
|
02111-1307 USA. */
|
1993-10-23 00:50:20 +00:00
|
|
|
|
|
|
|
/* The sigvec system call on MIPS Ultrix takes an additional
|
|
|
|
parameter, which is the address that is actually called when the
|
|
|
|
signal occurs.
|
|
|
|
|
|
|
|
When a signal occurs, we arrange for the kernel to call __handler.
|
|
|
|
That will save the frame and stack pointers into the context, and
|
|
|
|
then jump to this routine. See __handler.S.
|
|
|
|
|
|
|
|
This code is based on sysdeps/unix/bsd/sun4/sigtramp.c, but it's
|
|
|
|
different because since we get passed the user signal handler we
|
|
|
|
don't actually need a trampoline. */
|
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <errno.h>
|
|
|
|
|
|
|
|
/* The user's signal handler is called with three arguments. */
|
|
|
|
typedef void (*handler_type) (int sig, int code, struct sigcontext *);
|
|
|
|
|
|
|
|
/* Defined in signal.S. */
|
2004-09-14 04:24:52 +00:00
|
|
|
extern __sighandler_t __raw_signal (int sig, __sighandler_t func,
|
|
|
|
void (*)(int sig, int code,
|
|
|
|
struct sigcontext *,
|
|
|
|
handler_type));
|
|
|
|
|
|
|
|
extern void __handler (int sig, int code, struct sigcontext *,
|
|
|
|
handler_type);
|
1993-10-23 00:50:20 +00:00
|
|
|
|
|
|
|
__sighandler_t
|
1997-05-26 22:28:25 +00:00
|
|
|
signal (sig, func)
|
|
|
|
int sig;
|
|
|
|
__sighandler_t func;
|
1993-10-23 00:50:20 +00:00
|
|
|
{
|
|
|
|
return __raw_signal (sig, func, __handler);
|
|
|
|
}
|