On Sat, May 1, 2010 at 2:01 PM, Ted Unangst <ted.unan...@gmail.com> wrote:
> On Sat, May 1, 2010 at 9:59 AM, Jesus Sanchez <zexe...@gmail.com> wrote:
>>    As said in "Advanced Programming in the Unix Environment" book, when
>> calling a sigaction function there is a siginfo_t * with data about the
>> process sending the signal. On this struct, the member int si_pid
>> contains the PID of the process sending the signal. I tried in a very
>> simple code to obtain the PID of the child process but si_pid member
>> always contains 0 when I print it, and don't know what's wrong with it.
>
> The si_pid is not generally reliable, so it's a good idea not to use
> it.  What happens if two processes send the same signal before you
> receive it?

Sure, but it can be reliable for the SIGCHLD generated when a process
exits, as the kernel has to keep track of the zombies anyway.

This is on my todo list, but it seems to keep getting pushed down by
other things...


Philip Guenther

Reply via email to