- 论坛徽章:
- 0
|
本帖最后由 huhuegg 于 2013-02-05 17:18 编辑
- sub child_process {
- ......
- my $guard;
- $guard = tcp_server $sip,$sport,
- sub {
- my ($fh,$host,$port)=@_;
- &access_cb($fh,$host,$port);
- },
- sub {
- .........
- };
- $cv->wait;
- }
- exit if fork;
- &setsid();
- chdir '/';
- umask 022;
- close STDIN;
- close STDOUT;
- close STDERR;
- open STDIN,'/dev/null';
- open STDOUT,'>/dev/null';
- open STDERR,'>/dev/null';
- my $pid=fork;
- if ($pid == 0) {
- &child_process();
- exit;
- } else {
- exit 254;
- }
复制代码 如果去掉最初的fork,pp后也可以正常使用
[code]sub child_process {
......
my $guard;
$guard = tcp_server $sip,$sport,
sub {
my ($fh,$host,$port)=@_;
&access_cb($fh,$host,$port);
},
sub {
.........
};
$cv->wait;
}
&child_process();
|
|