[SOLVED] Signal Blocking by the exec() command

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Ray Glynn
Forum Newbie
Posts: 4
Joined: Thu Aug 18, 2005 10:33 am
Location: Galway, Ireland

[SOLVED] Signal Blocking by the exec() command

Post by Ray Glynn »

Howdy Folks,

First time post so go easy!

Has anyone experienced signal blocking problems with the exec() command?

I'm testing exec() with the vmstat command on HP-UX unix. The same problem is occuring on Linux flavors (Red-hat and Suse) but I'm testing now on HP-UX.

If i run vmstat from the command line and follow it with a trace all works Ok. I pass it a SIGUSR1, it doesn't recognise it and bombs out.

Now if i call vmstat using the exec() function (i'm implementing a WebUI) and then pass it the SIGUSR1 from the command line, the signal never reaches the command, as outputted by the trace.

Why is this signal getting blocked? I've tried the same with the SIGALRM and that gets through.

Any ideas?

Many Thanks,

Ray
Ray Glynn
Forum Newbie
Posts: 4
Joined: Thu Aug 18, 2005 10:33 am
Location: Galway, Ireland

Post by Ray Glynn »

bump!
User avatar
AnarKy
Forum Contributor
Posts: 119
Joined: Tue Nov 02, 2004 1:49 am
Location: South Africa

Post by AnarKy »

Ray Glynn wrote:bump!

:?: :?: :?: :?:

Did you sort the issue out?
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

exec(2) wrote: Signals set to the default action (SIG_DFL) in the calling
process image are set to the default action in the new pro-
cess image (see signal(3C)). Signals set to be ignored
(SIG_IGN) by the calling process image are set to be ignored
by the new process image.
Signals set to be caught by the
calling process image are set to the default action in the
new process image (see signal(3HEAD)). After a successful
call to any of the exec functions, alternate signal stacks
are not preserved and the SA_ONSTACK flag is cleared for all
signals.
perhaps php simply ignores SIGUSR1. I'm not quite sure, maybe setting SIGUSR1 to SIG_DFL in the new process may solve your issue.
Ray Glynn
Forum Newbie
Posts: 4
Joined: Thu Aug 18, 2005 10:33 am
Location: Galway, Ireland

Post by Ray Glynn »

Thanks Weirdan,

I'll take a look into that. The problem is still with me!

PHP seems to be blocking SIG_USR1 and letting SIG_ALRM through.

I'll post the solution if we sort it.

Ray.
Ray Glynn
Forum Newbie
Posts: 4
Joined: Thu Aug 18, 2005 10:33 am
Location: Galway, Ireland

SOLVED!

Post by Ray Glynn »

Thanks Weirdan,

I explicitly unblocked the SIG_USR1 in my called process and this has resolved the problem.

Ray.
Post Reply