]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Makefile, Configure.py: ##ask --> ##[el]if[yes|no]
authorGuido van Rossum <guido@python.org>
Sun, 9 Aug 1992 12:55:27 +0000 (12:55 +0000)
committerGuido van Rossum <guido@python.org>
Sun, 9 Aug 1992 12:55:27 +0000 (12:55 +0000)
posixmodule.c: waitpid() is separate

Modules/posixmodule.c

index 367e21c3ddba00c5e090aca8724d9ab3749f2bfb..50331ef5487a43e2bce20fae5769de344fa8285f 100644 (file)
@@ -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 */