|more useful options|
Re^4: forkManager PID 1 less than topby vsespb (Hermit)
|on Oct 02, 2013 at 17:43 UTC||Need Help??|
Where did you find the code example you posted?I edited first example (in SYNOPSIS) here.
I should have expected this since system probably starts it's own child process.Exactly!
or if the actual offset is subject to system timing?yep.
having said all that I am really not sure how to properly work around this.Why do you need exactly the PID which do the work?
in general this problem is hard to solve..
You can use something like this:
i.e. use "exec", "fork" and "wait/waitpid" calls.
Note that I don't recommend putting it into production until you fully understand how those functions works.
Also this example won't work if you replace
those calls are equivalent, but former calls PERL, and later one calls SHELL, which will call PERL.
so with later one you'll get wrong pid again (PID of shell)
Also, you really cannot control if scripts, that you call are calling other scripts or other processes or no
Thus this task is hardly solvable.
I propose explain you business requirements (exactly why you need that PID who do works) and someone might suggest something.