fcntl questions
fcntl questions
- Subject: fcntl questions
- From: Thierry Passeron <email@hidden>
- Date: Sun, 4 Nov 2007 16:32:17 +0100
Hello people,
I'm writting a little program in C for educational and personal use in
which I need to read from 2 descriptors piped from the stdout and
stderr of an other forked process. I already figured out how to do
all the pipings and the descriptors closing in both father and son
processes. Also I have already done the reading of ready descriptors
returned by select().
But now I'd like to do the same with fcntl() so that the process is
not blocked on select() and can do anything else when the descriptors
are not ready to be read.
I have read some documentation about fcntl and some linux examples, so
I tried to adapt them to Darwin (on OSX 10.5) and could not compile
because of some errors. The example uses:
* (SIGRTMIN + x) signals as callback functions for fcntl()
Is it possible to set a different (other than SIGIO or SIGURG) signal
for fcntl callbacks ?
If yes, I have not found in the fcntl man page any reference to the
F_SETSIG function ...
Does Darwin allow you to have SIGRTMIN, SIGRTMAX ? I have not seen it
in the output of /bin/kill -l. Forgive my ignorance but is it possible
to send a non existant signal like (SIGUSR2 + x) ?
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.
Any advise is welcome.
Regards,
Thierry
_______________________________________________
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