----- Original Message ----- 
From: "Daniel Beckham" <[EMAIL PROTECTED]>
To: "Jason Greene" <[EMAIL PROTECTED]>
Sent: Thursday, September 13, 2001 11:38 PM
Subject: Re: PHP pcntl function documentation (and other stuff)


> ----- Original Message -----
> From: "Jason Greene" <[EMAIL PROTECTED]>
> To: "Daniel Beckham" <[EMAIL PROTECTED]>
> Sent: Thursday, September 13, 2001 6:00 PM
> Subject: Re: PHP pcntl function documentation (and other stuff)
> 
> 
> > Are you sure you are setting up your signal handlers properly before
> generating
> > the signal? Every signal has a default action (called SIG_DFL) that
> differs between
> > signal type(most of the time it aborts the process however). as soon as
> you call
> > pcntl_signal( SIGKILL, "my_signal_catch");
> 
> Wow.. I'm an idiot.  I setup a SIGTERM handler when I first started writing
> the daemon and totally forgot about it. For whatever reason, in my mind I
> assumed that the signal handler function that I wrote would just
> automatically handle all signals.  hehe, thanks for the help there. =)
> 
> > I am confused how you would use exec during a SIGHUP. Are you tring to
> > call another php program? Is there any functionality that execve buys you
> over
> > the standard backticks, system, or exec php function calls? If there are
> reasons
> > then it would most likely belong in ext/standard
> 
> I'm actually wanting to execute the currently running program again.  It's
> mostly so I can actually restart my daemon in place without jumping through
> hoops.  (execv will replace the currently runing process with the new
> process but keep the same pid and any file descriptors that were not set to
> close on exit.)

Right

>  The system and exec (IMHO) are written very badly in PHP
> and don't even come close to doing what execv will do.  They are pretty much
> the same as using backticks but with a few variations. (Getting the exit
> code and the last line of output sent by the program.)  They just aren't
> suited to the stuff that's done with fork and execv.

Well they are very good at their purpose, which is to take care of 
all the intricacies of spawning another process.

> Anyway, it's quite useful when writing daemons that handle the SIGHUP
> signal.
>
Ah I see. I was assuming you were wanting to execute another program
(v)fork() + exec(). Including a  plain exec would make sense in pcntl
I would suggest:

 pcntl_exec(string var, array args, array env);

The function would then just call execve  since all the other execs wrap execve
anyways.

> > To tell you the truth I have done absolutely no docs for pcntl, but was
> planning
> > on it. I just haven't gotten around to it yet. If you would like to help
> and have time,
> > that would  be awesome. I really could use another perspective on them.
> (the developer
> > is not always the best at explanation)
> 
> Ok, how about I put together a draft of pcntl_fork, pcntl_wait and
> pcntl_signal and then we can go from there?  I'd like to have something
> available to the public by the time 4.0.7 is released.

Sounds great. I will try and focus as much time as I can on getting docs before 
the release.

-Jason


> Daniel
> 
>
 


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to