[Patches] [ python-Patches-1000267 ] A BSD-style wait4 implementation

SourceForge.net noreply at sourceforge.net
Sun Aug 22 18:23:00 CEST 2004


Patches item #1000267, was opened at 2004-07-29 20:52
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1000267&group_id=5470

Category: Modules
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: chads (cjschr)
Assigned to: Nobody/Anonymous (nobody)
Summary: A BSD-style wait4 implementation

Initial Comment:
A BSD-style wait4 implementation.

Using existing code from the posixmodule.c and
resource.c files,
I threw together a patch that implements the wait4
function.

This function is similar to waitpid, but it also
returns usage information
about the child process.

wait4(pid, options) -> (pid, status, rusage)

It works for me on RedHat Linux 9 and FreeBSD 4.5 boxes
using
Python-2.3.4.

The patch may need some fine tuning.

Thanks
Chad

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2004-08-22 18:23

Message:
Logged In: YES 
user_id=21627

struct rusage is already defined in
Modules/resourcemodule.c. It would be good if there was only
a single definition of the type object.

To achieve this, resourcemodule.c should expose a C API (e.g. 

  PyObject *PyResource_FromResource(struct rusage*)

). This should be put into a CObject, which should be
published through the module; then posixmodule should import
resource when wait4 is called for the first time.

Alternative, wait4 could be added to resourcemodule.c entirely.

Yet another alternative, on top of this approach,
posixmodule and/or os.py could provide their own definition
of wait4 which delegates to resource.wait4 on first usage.


----------------------------------------------------------------------

Comment By: chads (cjschr)
Date: 2004-08-13 21:00

Message:
Logged In: YES 
user_id=1093928

Added a test suite and an example of using wait4.  Feedback
is welcome.
Thanks.

----------------------------------------------------------------------

Comment By: Jeff Epler (jepler)
Date: 2004-08-04 23:53

Message:
Logged In: YES 
user_id=2772

You should also add code to the test suite to test wait4
when it is available.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1000267&group_id=5470


More information about the Patches mailing list