Re: fcntl questions
Re: fcntl questions
- Subject: Re: fcntl questions
- From: Steve Checkoway <email@hidden>
- Date: Sun, 4 Nov 2007 09:30:15 -0800
On Nov 4, 2007, at 7:32 AM, Thierry Passeron wrote:
The reason why they use SIGRTMIN + x in the linux example is that
they use the possibility to get some si_fd extra member in the
siginfo_t struct passed as argument to the signal handler installed
with sigaction(). And so it is possible to know which descriptor
became ready when the signal was sent (no need to use select() in
the signal handler)
I have not found this si_fd member in the Darwin siginfo_t structure.
So how can I proceed ? I know I could use the default signals SIGIO/
SIGURG and use a select() in the signal handler to check which
descriptor are available for reading now.
I can't answer all of your questions but the only functions you should
call in a signal handler are those listed in the sigaction man page.
select(2) is not among them.
If I were doing this and I really needed to not block in select, I'd
either catch the SIGIO signal and set a flag (which is about all you
should ever do in a signal handler) which I would check each time
through a loop and when it is set, I'd use select with a zero timeout
to get the pipes that need to be read from and then read from them.
Of course, I don't know how often one gets that signal. I would think
it would be easier to either use poll(2) or select(2) each time
through the loop to be sure I was catching all of the data that was
ready to read.
--
Steve Checkoway
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden