Style cleanup:

- Sort local variable declarations.
- Protect a hand-formatted comment from indent(1).
- Use portable casts, even though this is machine-dependant code.
- Remove extraneous blank lines.
- Remove trailing newline.
- Use sigdelset(3), not SIGDELSET(9).

Requested by:	bde
This commit is contained in:
Jonathan Mini 2002-09-21 23:54:32 +00:00
parent ad6c348105
commit dcf0aad852
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=103769

View File

@ -30,11 +30,10 @@
__FBSDID("$FreeBSD");
#include <sys/param.h>
#include <sys/signal.h>
#include <sys/signalvar.h>
#include <sys/ucontext.h>
#include <machine/psl.h>
#include <machine/sigframe.h>
#include <signal.h>
__weak_reference(__signalcontext, signalcontext);
@ -43,10 +42,10 @@ extern void _ctx_start(ucontext_t *, int argc, ...);
int
__signalcontext(ucontext_t *ucp, int sig, __sighandler_t *func)
{
register_t *p;
struct sigframe *sfp;
int *p;
/*
/*-
* Set up stack.
* (n = sizeof(int))
* 2n+sizeof(struct sigframe) ucp
@ -54,29 +53,27 @@ __signalcontext(ucontext_t *ucp, int sig, __sighandler_t *func)
* 1n &func
* 0n &_ctx_start
*/
p = (int *)ucp->uc_mcontext.mc_esp;
*--p = (int)ucp;
p = (register_t *)(void *)(intptr_t)ucp->uc_mcontext.mc_esp;
*--p = (register_t)(intptr_t)ucp;
p -= sizeof(struct sigframe);
sfp = (struct sigframe *)p;
bzero(sfp, sizeof(struct sigframe));
sfp->sf_signum = sig;
sfp->sf_siginfo = (int)&sfp->sf_si;
sfp->sf_ucontext = (int)&sfp->sf_uc;
sfp->sf_siginfo = (register_t)(intptr_t)&sfp->sf_si;
sfp->sf_ucontext = (register_t)(intptr_t)&sfp->sf_uc;
sfp->sf_ahu.sf_action = (__siginfohandler_t *)func;
bcopy(ucp, &sfp->sf_uc, sizeof(ucontext_t));
sfp->sf_si.si_signo = sig;
*--p = (int)func;
*--p = (register_t)(intptr_t)func;
/*
* Set up ucontext_t.
*/
ucp->uc_mcontext.mc_ebp = ucp->uc_mcontext.mc_esp - sizeof(int);
ucp->uc_mcontext.mc_esp = (int)p;
ucp->uc_mcontext.mc_eip = (int)_ctx_start;
ucp->uc_mcontext.mc_esp = (register_t)(intptr_t)p;
ucp->uc_mcontext.mc_eip = (register_t)(intptr_t)_ctx_start;
ucp->uc_mcontext.mc_eflags &= ~PSL_T;
ucp->uc_link = &sfp->sf_uc;
SIGDELSET(ucp->uc_sigmask, sig);
sigdelset(&ucp->uc_sigmask, sig);
return (0);
}