summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-08-09 12:55:27 (GMT)
committerGuido van Rossum <guido@python.org>1992-08-09 12:55:27 (GMT)
commit21803b8a6f9e78fc220bf95658182f7ca3265173 (patch)
treedd07e5326d5e90da7767e0110a15c106252d5a25 /Modules
parentb7fc4afe1b75a9e68d14b6de36880ef0abe082fd (diff)
downloadcpython-21803b8a6f9e78fc220bf95658182f7ca3265173.zip
cpython-21803b8a6f9e78fc220bf95658182f7ca3265173.tar.gz
cpython-21803b8a6f9e78fc220bf95658182f7ca3265173.tar.bz2
Makefile, Configure.py: ##ask --> ##[el]if[yes|no]
posixmodule.c: waitpid() is separate
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c58
1 files changed, 30 insertions, 28 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 367e21c..50331ef 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -696,42 +696,43 @@ posix_popen(self, args)
}
static object *
-posix_wait(self, args) /* Also waitpid() */
+posix_waitpid(self, args)
object *self;
object *args;
{
- object *v;
- int pid, sts;
- if (args == NULL) {
- BGN_SAVE
- pid = wait(&sts);
- END_SAVE
- }
- else {
#ifdef NO_WAITPID
- err_setstr(PosixError,
- "posix.wait(pid, options) not supported on this system");
+ err_setstr(PosixError,
+ "posix.waitpid() not supported on this system");
+ return NULL;
#else
- int options;
- if (!getintintarg(args, &pid, &options))
- return NULL;
- BGN_SAVE
- pid = waitpid(pid, &sts, options);
- END_SAVE
+ int pid, options, sts;
+ if (!getargs(args, "(ii)", &pid, &options))
+ return NULL;
+ BGN_SAVE
+ pid = waitpid(pid, &sts, options);
+ END_SAVE
+ if (pid == -1)
+ return posix_error();
+ else
+ return mkvalue("ii", pid, sts);
#endif
- }
+}
+
+static object *
+posix_wait(self, args)
+ object *self;
+ object *args;
+{
+ int pid, sts;
+ if (args != NULL)
+ return posix_waitpid(self, args); /* BW compat */
+ BGN_SAVE
+ pid = wait(&sts);
+ END_SAVE
if (pid == -1)
return posix_error();
- v = newtupleobject(2);
- if (v != NULL) {
- settupleitem(v, 0, newintobject((long)pid));
- settupleitem(v, 1, newintobject((long)sts));
- if (err_occurred()) {
- DECREF(v);
- v = NULL;
- }
- }
- return v;
+ else
+ return mkvalue("ii", pid, sts);
}
#endif /* MSDOS */
@@ -863,6 +864,7 @@ static struct methodlist posix_methods[] = {
{"kill", posix_kill},
{"popen", posix_popen},
{"wait", posix_wait},
+ {"waitpid", posix_waitpid},
#endif
{NULL, NULL} /* Sentinel */