in reply to Child PID?
Erh, fork already returns the child's pid (to the parent, if succesful). There is absolutely no need to increment it. If there is, your operating system is seriously broken.
if (my $pid = fork) { # parent } elsif (defined $pid) { # child exit; } else { # error }
Some style issues: Don't use &foo: use foo() instead. &foo has some unpleasant side effects (passes @_ if you don't use parens. Put subs near the top to avoid sharing _all_ file scoped lexicals. This will be useful when you use strict. Third, use strict. Reasonably important: check the return value of kill. Reaping and killing are not the same, by the way. Use waitpid or wait to reap.
- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Child PID?
by Anonymous Monk on Jun 06, 2002 at 23:47 UTC | |
by perigeeV (Hermit) on Jun 07, 2002 at 00:28 UTC | |
by Abigail-II (Bishop) on Jun 07, 2002 at 11:33 UTC |