コード例 #1
0
/*
 * If there are processes sleeping on this descriptor, wake them up.
 */
static __inline void
bpf_wakeup(struct bpf_d *d)
{
	wakeup((caddr_t)d);
	if (d->bd_async && d->bd_sig)
		csignal(d->bd_pgid, d->bd_sig,
		    d->bd_siguid, d->bd_sigeuid);

	selwakeup(&d->bd_sel);
	KNOTE(&d->bd_sel.si_note, 0);
}
コード例 #2
0
ファイル: bpf.c プロジェクト: sofuture/bitrig
/*
 * If there are processes sleeping on this descriptor, wake them up.
 */
void
bpf_wakeup(struct bpf_d *d)
{
	wakeup((caddr_t)d);
	if (d->bd_async && d->bd_sig)
		csignal(d->bd_pgid, d->bd_sig,
		    d->bd_siguid, d->bd_sigeuid);

	selwakeup(&d->bd_sel);
	/* XXX */
	d->bd_sel.si_selpid = 0;
}
コード例 #3
0
ファイル: uipc_socket2.c プロジェクト: ajinkya93/OpenBSD
/*
 * Wakeup processes waiting on a socket buffer.
 * Do asynchronous notification via SIGIO
 * if the socket has the SS_ASYNC flag set.
 */
void
sowakeup(struct socket *so, struct sockbuf *sb)
{
	int s = splsoftnet();

	selwakeup(&sb->sb_sel);
	sb->sb_flagsintr &= ~SB_SEL;
	if (sb->sb_flagsintr & SB_WAIT) {
		sb->sb_flagsintr &= ~SB_WAIT;
		wakeup(&sb->sb_cc);
	}
	splx(s);
	if (so->so_state & SS_ASYNC)
		csignal(so->so_pgid, SIGIO, so->so_siguid, so->so_sigeuid);
}
コード例 #4
0
ファイル: signal_mgmt.c プロジェクト: rossdrummond/scilab
void base_error_init(void)
{
    struct sigaction act;

    int sig, j;

    struct sigaction ToSuspend;

    struct sigaction ToContinue;

    /* Initialise Suspend Signal (CTRL-Z) */
    ToSuspend.sa_handler = suspendProcess;
    ToSuspend.sa_flags = 0;
    sigemptyset(&ToSuspend.sa_mask);
    sigaction(SIGTSTP, &ToSuspend, NULL);
    /* Initialise Continue Signal (fg) */
    ToContinue.sa_handler = continueProcess;
    ToContinue.sa_flags = 0;
    sigemptyset(&ToContinue.sa_mask);
    sigaction(SIGCONT, &ToContinue, NULL);
    /* Signal handlers */
    csignal();
    memset(&act, 0, sizeof(act));
    act.sa_sigaction = sig_fatal;
    act.sa_flags = SA_SIGINFO;
#ifdef SA_ONESHOT
    act.sa_flags |= SA_ONESHOT;
#else
    act.sa_flags |= SA_RESETHAND;
#endif
    sigemptyset(&act.sa_mask);

    int signals[] =
    {
#ifdef SIGABRT
        SIGABRT,
#endif
#ifdef SIGBUS
        SIGBUS,
#endif
#ifdef SIGFPE
        SIGFPE,
#endif
#ifdef SIGFPE2
        SIGFPE,
#endif
#ifdef SIGILL
        SIGILL,
#endif
#ifdef SIGSEGV
        SIGSEGV,
#endif
#ifdef SIGPOLL
        SIGPOLL,
#endif
        -1
    };
    for (j = 0; signals[j] != -1; ++j)
    {
        if (0 != sigaction(signals[j], &act, NULL))
        {
            fprintf(stderr, "Could not set handler for signal %d\n", signals[j]);
        }
    }
}