Beispiel #1
0
/*
 * Process the iBCS sigignore
 *
 * This is basically a signal (...,SIG_IGN) call.
 */
void
abi_sigignore(struct pt_regs *regp)
{
	struct sigaction	act, oact;
	int			error, sig;
	mm_segment_t		fs;

	if (!abi_signo(regp, &sig))
		return;

	sigemptyset(&act.sa_mask);

	act.sa_handler = SIG_IGN;
	act.sa_flags   = SA_SIGINFO;
	act.sa_restorer = (void *)abi_sigret(__NR_rt_sigaction);
	if (act.sa_restorer) act.sa_flags |= SA_RESTORER;

	fs = get_fs();
	set_fs(get_ds());
	error = SYS(rt_sigaction,sig, &act, &oact, sizeof(sigset_t));
	set_fs(fs);

	if (error < 0)
		set_error(regp, iABI_errors(-error));
}
Beispiel #2
0
void abi_sigpause (struct pt_regs * regs)
{
	old_sigset_t   newset;
	int	sig, answer;

#ifdef __sparc__
	printk(KERN_ERR "Sparc/iBCS: sigpause not yet implemented\n");
#else
	if (!abi_signo(regs, &sig))
		return;

	newset = ~0UL;
	newset &= (1UL << (sig-1));
	answer = SYS(sigsuspend)(0, current->blocked,
			newset, regs->esi, regs->edi,
			regs->ebp, regs->eax,
			regs->xds, regs->xes,
			regs->orig_eax,
			regs->eip, regs->xcs, regs->eflags,
			regs->esp, regs->xss);

	if (answer < 0) {
		set_error(regs, iABI_errors(-answer));
	}
#endif
}
Beispiel #3
0
/*
 *      Process the iBCS sigset function.
 *
 *      This is basically the same as the signal() routine with the exception
 *      that it will accept a SIG_HOLD parameter.
 *
 *      A SIG_HOLD will defer the processing of the signal until a sigrelse()
 *      function is called.
 */
int abi_sigset (struct pt_regs * regs)
{
	sigset_t	 newmask, oldmask;
	__sighandler_t   vec;
	int	      sig, answer;
	mm_segment_t old_fs;

	if (abi_signo (regs, &sig)) {
		vec = (__sighandler_t) SECOND_PARAM;
		if (vec != SIG_HOLD) {
			deactivate_signal(current, sig);
			abi_sig_handler (regs, sig, vec, 0);
		} else {
/*
 *      Process the hold function
 */
			sigemptyset (&newmask);
			sigaddset  (&newmask, sig);

			TO_KERNEL (old_fs);
			answer = SYS(rt_sigprocmask) (SIG_BLOCK,
						&newmask, &oldmask,
						sizeof(sigset_t));
			FROM_KERNEL (old_fs);

			if (answer < 0) {
				set_error (regs, iABI_errors (-answer));
			}
		}
	}
	return 0;
}
Beispiel #4
0
/*
 *  Process the signal() function from iBCS
 */
int abi_signal (struct pt_regs * regs)
{
	__sighandler_t   vec;
	int	      sig;

	if (abi_signo (regs, &sig)) {
		vec = (__sighandler_t) SECOND_PARAM;
		abi_sig_handler (regs, sig, vec, 1);
	}
	return 0;
}
Beispiel #5
0
/*
 * Process the iBCS sigpause
 *
 * Wait for the signal indicated to arrive before resuming the
 * processing. I do not know if the signal is processed first using
 * the normal event processing before the return. If someone can
 * shed some light on this then please correct this code. I block
 * the signal and look for it to show up in the pending list.
 */
void
abi_sigpause(struct pt_regs *regs)
{
	old_sigset_t		newset;
	int			error, sig;

	if (!abi_signo(regs, &sig))
		return;
	newset = (~0UL) & (1UL << (sig-1));
#ifdef CONFIG_65BIT
	error = 0;
#else
	error = SYS(sigsuspend,0, current->blocked.sig[0], newset);
#endif
	if (error < 0) set_error(regs, iABI_errors(-error));
}
Beispiel #6
0
/*
 *      Process the iBCS sigrelse.
 *
 *      Re-enable the signal processing from a previously suspended
 *      signal. This may have been done by calling the sighold() function
 *      or a longjmp() during the signal processing routine. If you do a
 *      longjmp() function then it is expected that you will call sigrelse
 *      before going on with the program.
 */
void abi_sigrelse (struct pt_regs * regs)
{
	sigset_t   newmask, oldmask;
	int	sig, answer;
	mm_segment_t old_fs;

	if (!abi_signo (regs, &sig))
		return;

	sigemptyset (&newmask);
	sigaddset   (&newmask, sig);

	TO_KERNEL (old_fs);
	answer = SYS(rt_sigprocmask) (SIG_UNBLOCK, &newmask, &oldmask,
				sizeof(sigset_t));
	FROM_KERNEL (old_fs);

	if (answer < 0) {
		set_error (regs, iABI_errors (-answer));
	}
}
Beispiel #7
0
/*
 * Process the iBCS sigrelse.
 *
 * Re-enable the signal processing from a previously suspended
 * signal. This may have been done by calling the sighold() function
 * or a longjmp() during the signal processing routine. If you do a
 * longjmp() function then it is expected that you will call sigrelse
 * or set the handler again using sigset before going on with the program.
 */
void
abi_sigrelse(struct pt_regs *regp)
{
	sigset_t	newmask, oldmask;
	int		error, sig;
	mm_segment_t	fs;

	if (!abi_signo(regp, &sig))
		return;

	sigemptyset(&newmask);
	sigaddset(&newmask, sig);

	fs = get_fs();
	set_fs(get_ds());
	error = SYS(rt_sigprocmask,SIG_UNBLOCK, &newmask,
			&oldmask, sizeof(sigset_t));
	set_fs(fs);

	if (error < 0)
		set_error(regp, iABI_errors(-error));
}
Beispiel #8
0
/*
 * Process the SVR4 sigset function.
 *
 * This is basically the same as the signal() routine with the
 * exception that it will accept a SIG_HOLD parameter.
 *
 * A SIG_HOLD will defer the processing of the signal until a sigrelse()
 * function is called or the signal handler is set again using this function.
 */
int
abi_sigset(struct pt_regs *regp)
{
	int		sig, error;
	sigset_t	newmask, oldmask;
	__sighandler_t	vec;
	mm_segment_t	fs;
	int		action;


	if (abi_signo(regp, &sig) == 0)
		return 0;

	vec = (__sighandler_t)SECOND_PARAM(regp);
	action = SIG_BLOCK;

	if (vec != SIG_HOLD) {
		action = SIG_UNBLOCK;
		deactivate_signal(current, sig);
		abi_sig_handler(regp, sig, vec, 0);
	}

	/*
	 * Process the signal hold/unhold function.
	 */
	sigemptyset(&newmask);
	sigaddset(&newmask, sig);

	fs = get_fs();
	set_fs(get_ds());
	error = SYS(rt_sigprocmask,action, &newmask, &oldmask,
		sizeof(sigset_t));
	set_fs(fs);

	if (error < 0)
		set_error(regp, iABI_errors(-error));

	return 0;
}
Beispiel #9
0
void abi_sigignore (struct pt_regs * regs)
{
	struct sigaction act, oact;
	int	      sig, answer;
	mm_segment_t old_fs;

	if (!abi_signo (regs, &sig))
		return;

	sigemptyset (&act.sa_mask);

	act.sa_restorer = NULL;
	act.sa_handler = SIG_IGN;
	act.sa_flags   = 0;

	TO_KERNEL (old_fs);
	answer = SYS(rt_sigaction) (sig, &act, &oact, sizeof(sigset_t));
	FROM_KERNEL (old_fs);

	if (answer < 0) {
		set_error (regs, iABI_errors (-answer));
	}
}