glibc/sysdeps/unix/bsd/sun/m68k/sigtramp.c
Ulrich Drepper 79937577d1 Update.
2004-09-13  Ulrich Drepper  <drepper@redhat.com>

	* misc/sys/cdefs.h: Restore old definition of __P.
	* csu/munch.awk: Remove uses of __P and __PMT.
	* gmon/gmon.c: Likewise.
	* hesiod/hesiod.h: Likewise.
	* include/stdio.h: Likewise.
	* io/fts.c: Likewise.
	* libio/genops.c: Likewise.
	* libio/libioP.h: Likewise.
	* libio/fileops.c: Likewise.
	* libio/iolibio.h: Likewise.
	* libio/libio.h: Likewise.
	* libio/memstream.c: Likewise.
	* libio/oldfileops.c: Likewise.
	* libio/oldstdfiles.c: Likewise.
	* libio/iopopen.c: Likewise.
	* libio/vsnprintf.c: Likewise.
	* libio/vswprintf.c: Likewise.
	* libio/wgenops.c: Likewise.
	* libio/oldiopopen.c: Likewise.
	* locale/programs/xmalloc.c: Likewise.
	* locale/programs/xstrdup.c: Likewise.
	* malloc/mtrace.c: Likewise.
	* misc/getttyent.c: Likewise.
	* misc/getusershell.c: Likewise.
	* nis/rpcsvc/ypupd.h: Likewise.
	* posix/fnmatch.h: Likewise.
	* posix/glob.h: Likewise.
	* resolv/arpa/nameser.h: Likewise.
	* resolv/gethnamaddr.c: Likewise.
	* resolv/resolv.h: Likewise.
	* resolv/inet_net_ntop.c: Likewise.
	* resolv/inet_net_pton.c: Likewise.
	* resolv/res_init.c: Likewise.
	* resolv/nss_dns/dns-network.c: Likewise.
	* stdio-common/vfprintf.c: Likewise.
	* stdio-common/reg-printf.c: Likewise.
	* sysdeps/generic/chflags.c: Likewise.
	* sysdeps/generic/fchflags.c: Likewise.
	* sysdeps/generic/glob.c: Likewise.
	* sysdeps/generic/printf_fphex.c: Likewise.
	* sysdeps/generic/memcmp.c: Likewise.
	* sysdeps/generic/memcopy.h: Likewise.
	* sysdeps/generic/morecore.c: Likewise.
	* sysdeps/generic/sstk.c: Likewise.
	* sysdeps/posix/sigvec.c: Likewise.
	* sysdeps/posix/ttyname_r.c: Likewise.
	* sysdeps/standalone/arm/bits/errno.h: Likewise.
	* sysdeps/standalone/standalone.h: Likewise.
	* sysdeps/standalone/i386/force_cpu386/brdinit.c: Likewise.
	* sysdeps/standalone/i386/force_cpu386/_exit.c: Likewise.
	* sysdeps/unix/arm/start.c: Likewise.
	* sysdeps/unix/bsd/sigaction.c: Likewise.
	* sysdeps/unix/bsd/sun/m68k/sigtramp.c: Likewise.
	* sysdeps/unix/bsd/sun/sparc/sigtramp.c: Likewise.
	* sysdeps/unix/bsd/sun/sunos4/wait4.c: Likewise.
	* sysdeps/unix/bsd/ultrix4/mips/sigvec.c: Likewise.
	* sysdeps/unix/bsd/ultrix4/sysconf.c: Likewise.
	* sysdeps/unix/sparc/start.c: Likewise.
	* sysdeps/unix/sysv/getdents.c: Likewise.
	* sysdeps/unix/sysv/irix4/fpathconf.c: Likewise.
	* sysdeps/unix/sysv/irix4/getgroups.c: Likewise.
	* sysdeps/unix/sysv/irix4/getpriority.c: Likewise.
	* sysdeps/unix/sysv/irix4/getrusage.c: Likewise.
	* sysdeps/unix/sysv/irix4/pathconf.c: Likewise.
	* sysdeps/unix/sysv/irix4/setgroups.c: Likewise.
	* sysdeps/unix/sysv/irix4/sigtramp.c: Likewise.
	* sysdeps/unix/sysv/irix4/start.c: Likewise.
	* sysdeps/unix/sysv/irix4/sysconf.c: Likewise.
	* sysdeps/unix/sysv/sco3.2.4/__setpgid.c: Likewise.
	* sysdeps/unix/sysv/sco3.2.4/getgroups.c: Likewise.
	* sysdeps/unix/sysv/sysv4/__getpgid.c: Likewise.
	* sysdeps/unix/sysv/sysv4/__setpgid.c: Likewise.
	* sysdeps/unix/sysv/sysv4/getpgid.c: Likewise.
	* sysdeps/unix/sysv/sysv4/setpgid.c: Likewise.
	* sysdeps/unix/sysv/sysv4/sethostname.c: Likewise.
	* sysdeps/unix/sysv/sysv4/setsid.c: Likewise.
	* sysdeps/unix/sysv/sysv4/sysconf.c: Likewise.
	* sysdeps/unix/sysv/sysv4/waitpid.c: Likewise.
	* sysdeps/unix/sysv/sysv4/solaris2/getdents.c: Likewise.
	* time/tzset.c: Likewise.
	* time/strftime_l.c: Likewise.
	* time/strptime_l.c: Likewise.
	* crypt/md5.h: Likewise.
2004-09-14 04:41:35 +00:00

146 lines
3.5 KiB
C

/* Copyright (C) 1993, 1996, 1997, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
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.
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
Lesser General Public License for more details.
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. */
#ifndef __GNUC__
#error This file uses GNU C extensions; you must compile with GCC.
#endif
/* Get the definition of `struct sigcontext'. */
#define KERNEL
#define sigvec sun_sigvec
#define sigstack sun_sigstack
#define sigcontext sun_sigcontext
#include "/usr/include/sys/signal.h"
#undef sigvec
#undef sigstack
#undef sigcontext
#undef NSIG
#undef SIGABRT
#undef SIGCLD
#undef SV_ONSTACK
#undef SV_RESETHAND
#undef SV_INTERRUPT
#undef SA_ONSTACK
#undef SA_NOCLDSTOP
#undef SIG_ERR
#undef SIG_DFL
#undef SIG_IGN
#undef sigmask
#undef SIG_BLOCK
#undef SIG_UNBLOCK
#undef SIG_SETMASK
#include <signal.h>
#include <stddef.h>
#include <errno.h>
/* Defined in __sigvec.S. */
extern int __raw_sigvec (int sig, const struct sigvec *vec,
struct sigvec *ovec);
/* User-specified signal handlers. */
#define mytramp 1
#ifdef mytramp
static __sighandler_t handlers[NSIG];
#else
#define handlers _sigfunc
extern __sighandler_t _sigfunc[];
#endif
#if mytramp
/* Handler for all signals that are handled by a user-specified function.
Saves and restores the general regs %g2-%g7, the %y register, and
all the FPU regs (including %fsr), around calling the user's handler. */
static void
trampoline (sig, code, context, addr)
int sig;
int code;
struct sigcontext *context;
void *addr;
{
int save[4];
/* Save the call-clobbered registers. */
asm volatile ("movem%.l d0-d1/a0-a1, %0" : : "m" (save[0]));
/* XXX should save/restore FP regs */
/* Call the user's handler. */
(*((void (*) (int sig, int code, struct sigcontext *context,
PTR addr)) handlers[sig]))
(sig, code, context, addr);
/* Restore the call-clobbered registers. */
asm volatile ("movem%.l %0, d0-d1/a0-a1" : : "g" (save[0]) :
"d0", "d1", "a0", "a1");
__sigreturn (context);
}
#endif
int
__sigvec (sig, vec, ovec)
int sig;
const struct sigvec *vec;
struct sigvec *ovec;
{
#ifndef mytramp
extern void _sigtramp (int);
#define trampoline _sigtramp
#endif
struct sigvec myvec;
int mask;
__sighandler_t ohandler;
if (sig <= 0 || sig >= NSIG)
{
__set_errno (EINVAL);
return -1;
}
mask = __sigblock(sigmask(sig));
ohandler = handlers[sig];
if (vec != NULL &&
vec->sv_handler != SIG_IGN && vec->sv_handler != SIG_DFL)
{
handlers[sig] = vec->sv_handler;
myvec = *vec;
myvec.sv_handler = trampoline;
vec = &myvec;
}
if (__raw_sigvec(sig, vec, ovec) < 0)
{
int save = errno;
(void) __sigsetmask(mask);
errno = save;
return -1;
}
if (ovec != NULL && ovec->sv_handler == trampoline)
ovec->sv_handler = ohandler;
(void) __sigsetmask(mask);
return 0;
}