MCPcopy Create free account
hub / github.com/F-Stack/f-stack / linux_rt_sendsig

Function linux_rt_sendsig

freebsd/i386/linux/linux_sysvec.c:394–489  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

392}
393
394static void
395linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask)
396{
397 struct thread *td = curthread;
398 struct proc *p = td->td_proc;
399 struct sigacts *psp;
400 struct trapframe *regs;
401 struct l_rt_sigframe *fp, frame;
402 int sig, code;
403 int oonstack;
404
405 sig = ksi->ksi_signo;
406 code = ksi->ksi_code;
407 PROC_LOCK_ASSERT(p, MA_OWNED);
408 psp = p->p_sigacts;
409 mtx_assert(&psp->ps_mtx, MA_OWNED);
410 regs = td->td_frame;
411 oonstack = sigonstack(regs->tf_esp);
412
413 /* Allocate space for the signal handler context. */
414 if ((td->td_pflags & TDP_ALTSTACK) && !oonstack &&
415 SIGISMEMBER(psp->ps_sigonstack, sig)) {
416 fp = (struct l_rt_sigframe *)((uintptr_t)td->td_sigstk.ss_sp +
417 td->td_sigstk.ss_size - sizeof(struct l_rt_sigframe));
418 } else
419 fp = (struct l_rt_sigframe *)regs->tf_esp - 1;
420 mtx_unlock(&psp->ps_mtx);
421
422 /* Build the argument list for the signal handler. */
423 sig = bsd_to_linux_signal(sig);
424
425 bzero(&frame, sizeof(frame));
426
427 frame.sf_handler = catcher;
428 frame.sf_sig = sig;
429 frame.sf_siginfo = &fp->sf_si;
430 frame.sf_ucontext = &fp->sf_sc;
431
432 /* Fill in POSIX parts. */
433 ksiginfo_to_lsiginfo(ksi, &frame.sf_si, sig);
434
435 /* Build the signal context to be used by sigreturn. */
436 frame.sf_sc.uc_flags = 0; /* XXX ??? */
437 frame.sf_sc.uc_link = NULL; /* XXX ??? */
438
439 frame.sf_sc.uc_stack.ss_sp = td->td_sigstk.ss_sp;
440 frame.sf_sc.uc_stack.ss_size = td->td_sigstk.ss_size;
441 frame.sf_sc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK)
442 ? ((oonstack) ? LINUX_SS_ONSTACK : 0) : LINUX_SS_DISABLE;
443 PROC_UNLOCK(p);
444
445 bsd_to_linux_sigset(mask, &frame.sf_sc.uc_sigmask);
446
447 frame.sf_sc.uc_mcontext.sc_mask = frame.sf_sc.uc_sigmask.__mask;
448 frame.sf_sc.uc_mcontext.sc_gs = rgs();
449 frame.sf_sc.uc_mcontext.sc_fs = regs->tf_fs;
450 frame.sf_sc.uc_mcontext.sc_es = regs->tf_es;
451 frame.sf_sc.uc_mcontext.sc_ds = regs->tf_ds;

Callers 1

linux_sendsigFunction · 0.70

Calls 8

mtx_assertFunction · 0.85
sigonstackFunction · 0.85
bzeroFunction · 0.85
sigexitFunction · 0.85
mtx_unlockFunction · 0.50
rgsFunction · 0.50
copyoutFunction · 0.50
mtx_lockFunction · 0.50

Tested by

no test coverage detected