Hello Programmers:
I hope that some one out there has run into this problem and knows how to solve it.
On one of my systems which is an L Class HP server running HP-UX 10.20
I have a C program that does a fork() and execlp() call to start a couple of other
C programs, and then the parent program goes on about its business while the child
processes(programs) are running on their own.
The problem I get is this, the programs start up OK meaning that the fork() and
execlp() calls are working just fine. The two C programs start up OK with no problems
but then what I get is (when a ps -ef is done) I see this type of output
where sh -c has been executed and now a duplicate (or what appears to be) a second
copy of the program is now running.
This is being envoked in a /sbin/sh (posix) environment running as root, via sudo.
Further what is odd is that on most of the other systems that are running 11.0
this programming all works perfectly with no problem at all.
Also when I had called execl instead of execlp then just one copy of the program was
running again with the sh -c command as though the exec call thought for some
reason that the call was a call to a shell script and not a C binary.
The real main problem that this causes is that when the sh -c call is made and
the child program is running, it causes the parent program to wait which is what I
DON'T want it to do. I want the child processes to be spawned off and no waiting
and allow the parent process to continue on.
I do not call wait or waitpid inside the parent process so this should not be happening.
I hope this makes sense, as it is a bit difficult to explain.
Hope someone out there knows what is going on with the program.
I can give code examples if necessary.
Thanks.
I hope that some one out there has run into this problem and knows how to solve it.
On one of my systems which is an L Class HP server running HP-UX 10.20
I have a C program that does a fork() and execlp() call to start a couple of other
C programs, and then the parent program goes on about its business while the child
processes(programs) are running on their own.
The problem I get is this, the programs start up OK meaning that the fork() and
execlp() calls are working just fine. The two C programs start up OK with no problems
but then what I get is (when a ps -ef is done) I see this type of output
where sh -c has been executed and now a duplicate (or what appears to be) a second
copy of the program is now running.
This is being envoked in a /sbin/sh (posix) environment running as root, via sudo.
Further what is odd is that on most of the other systems that are running 11.0
this programming all works perfectly with no problem at all.
Also when I had called execl instead of execlp then just one copy of the program was
running again with the sh -c command as though the exec call thought for some
reason that the call was a call to a shell script and not a C binary.
The real main problem that this causes is that when the sh -c call is made and
the child program is running, it causes the parent program to wait which is what I
DON'T want it to do. I want the child processes to be spawned off and no waiting
and allow the parent process to continue on.
I do not call wait or waitpid inside the parent process so this should not be happening.
I hope this makes sense, as it is a bit difficult to explain.
Hope someone out there knows what is going on with the program.
I can give code examples if necessary.
Thanks.