|
Home > Archive > Unix Programming > August 2005 > Get SID in child handler?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Get SID in child handler?
|
|
|
|
Is it possible to get the SID (or PGID) of the child process I received the signal from?
If I call getsid(pid) in the child-handler it seems to be to late, because the process
does not exists anymore.
I need this, because I want to distinguish the processes by their SID.
Please send me a copy of the answer via E-Mail, thanks!
Best regards
Sven Anders
--
Sven Anders <anders <<.at.>> anduras.de>
ANDURAS service solutions AG
Innstraße 71 - 94036 Passau - Germany
Web: www.anduras.de - Tel: +49 (0)851-4 90 50-0 - Fax: +49 (0)851-4 90 50-55
Rechtsform: Aktiengesellschaft - Sitz: Passau - Amtsgericht Passau HRB 6032
Mitglieder des Vorstands: Sven Anders, Marcus Junker, Michael Schön
Vorsitzender des Aufsichtsrats: Thomas Träger
| |
| Maxim Yegorushkin 2005-08-01, 8:30 am |
| S.A. wrote:
> Is it possible to get the SID (or PGID) of the child process I received the signal from?
> If I call getsid(pid) in the child-handler it seems to be to late, because the process
> does not exists anymore.
How do you figure out that it's late?
Session id is stored in a process descriptor. The process descriptor
gets released only after a wait-family function call. So, you can get a
session id of a died process you haven't called wait() for.
| |
|
| Maxim Yegorushkin wrote:
> S.A. wrote:
>
>
>
> How do you figure out that it's late?
>
> Session id is stored in a process descriptor. The process descriptor
> gets released only after a wait-family function call. So, you can get a
> session id of a died process you haven't called wait() for.
Ok, my fault!
Thanks for the quick answer.
I called a wait() somewhere outside...
It works perfectly!
Best regards
Sven Anders
--
Sven Anders <anders <<.at.>> anduras.de>
ANDURAS service solutions AG
Innstraße 71 - 94036 Passau - Germany
Web: www.anduras.de - Tel: +49 (0)851-4 90 50-0 - Fax: +49 (0)851-4 90 50-55
Rechtsform: Aktiengesellschaft - Sitz: Passau - Amtsgericht Passau HRB 6032
Mitglieder des Vorstands: Sven Anders, Marcus Junker, Michael Schön
Vorsitzender des Aufsichtsrats: Dipl. Kfm. Karlheinz Antesberger
|
|
|
|
|