wait()/waitpid() implementation in Linux doesn't conform to POSIX?

wait()/waitpid() implementation in Linux doesn't conform to POSIX?

Post by linx » Tue, 02 Apr 2002 17:53:47



POSIX said:
The wait( ) function shall suspend execution of the calling thread
until status information for one of the terminated child processes of
the calling process is available, or until delivery of a signal whose
action is either to execute a signal-catching function or to terminate
the process.

But I found that in Linux if there raises a signal in the child
process where a corresponding signal handler is installed,
wait()/waitpid() in the parent will not return. Anybody has idea about
it? Thanks.

 
 
 

wait()/waitpid() implementation in Linux doesn't conform to POSIX?

Post by Kasper Dupon » Tue, 02 Apr 2002 18:53:12



> POSIX said:
> The wait( ) function shall suspend execution of the calling thread
> until status information for one of the terminated child processes of
> the calling process is available, or until delivery of a signal whose
> action is either to execute a signal-catching function or to terminate
> the process.

> But I found that in Linux if there raises a signal in the child
> process where a corresponding signal handler is installed,
> wait()/waitpid() in the parent will not return. Anybody has idea about
> it? Thanks.

I guess POSIX talks about a signal being delivered to the *parent*.
You talk about a singal being delivered to the *child*. Waking up
the *parent* whenever the *child* receives a signal would not make
any sense.

--
Kasper Dupont -- der bruger for meget tid p? usenet.


 
 
 

wait()/waitpid() implementation in Linux doesn't conform to POSIX?

Post by linx » Wed, 03 Apr 2002 23:26:50




> > POSIX said:
> > The wait( ) function shall suspend execution of the calling thread
> > until status information for one of the terminated child processes of
> > the calling process is available, or until delivery of a signal whose
> > action is either to execute a signal-catching function or to terminate
> > the process.

> > But I found that in Linux if there raises a signal in the child
> > process where a corresponding signal handler is installed,
> > wait()/waitpid() in the parent will not return. Anybody has idea about
> > it? Thanks.

> I guess POSIX talks about a signal being delivered to the *parent*.
> You talk about a singal being delivered to the *child*. Waking up
> the *parent* whenever the *child* receives a signal would not make
> any sense.

I don't think so. If you are right, the parent's sigaction will affect
the behavior of wait(), it's not the case.
 
 
 

1. waitpid in parent process doesn't wait when parent receives a sigterm.

My application forks a process then does a waitpid on the child
process, in a seperate thread.

When the parent process receives a sigterm, it sends some message to
the child process to shutdown, however, I noticed that the waitpid
comes out with a errno of EINTR. and the child process hence becomes
zombie. And also since the parent process monitors the child process
and the pid exists hence it doesn't shutdown.

so both the parent process and the child process run for ever.

I am on a HP-UX 11.00 platform.

Any help would be appreciated.

Irfan.

2. Status of the md (multiple disk) / raid 0 driver?

3. ``A Library Implementation of POSIX Threads under SunOS/Solaris'', Version 2.

4. PAM BIG SEARCH

5. ANNOUNCE: cksum (A Posix conformed utility) available.

6. Linux for Unix programmers book?

7. SPEC1170 and / or POSIX.4 - does RedHat conform ?

8. Hard disk size problem for Solaris 7 (x86)

9. K&R 2ed readdir() implementation doesn't work on linux...?!?

10. waitpid(clone) doesn't work?

11. fork,exec and wait and wait and wait and wait

12. POSIX threads & Linux, priorities doesn't seem to work.

13. IP Accounting doesn't work for PPP dial-ins :-(( ??