Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Dec 1998 01:55:14 -0800
From:      Peter Edwards <peter.edwards@isocor.ie>
To:        Archie Cobbs <archie@whistle.com>
Cc:        Matthew Dillon <dillon@apollo.backplane.com>, jwd@unx.sas.com, freebsd-current@FreeBSD.ORG
Subject:   Re: inetd: realloc/free bug
Message-ID:  <3670EC02.D35D99CC@isocor.ie>
References:  <199812110628.WAA23665@bubba.whistle.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,
> 
> It's not trivial if you want to guarantee that no signals are missed.
> There's no way atomically to: unblock signals and call select().

Hmm. I must be twisted. 
What horror results from doing this in a signal handler? On e-paper, it
seems to give the desired effect, but does a return from a signal
handler implicitly call sigreturn(2) when it returns? And if so, is
there anything that requires this to happen?


...
sigusr1handler()
{
  longjmp(jump_buf,1);
}

selecting_func()
{

	if (setjmp(jump_buf) == 0) {
		sigprocmask(SIG_UNBLOCK, {...SIGUSR1...}, 0)		
		/* Signal arriving now returns after the select call. */
		select(...);
		sigprocmask(SIG_BLOCK, {...SIGUSR1...}, 0);
	}
	/* select finished, or signal arrived after the
sigprocmask(SIG_UNBLOCK). */
}

--
Peter.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3670EC02.D35D99CC>