summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1992-09-13 20:07:29 (GMT)
committerGuido van Rossum <guido@python.org>1992-09-13 20:07:29 (GMT)
commitc2670a000bd69fb689a7b05436ff0091052f4f3c (patch)
tree38619ca84e6a3f591bb0c6e856dfcefe650c7247 /Modules
parent1899c2e0550fa025080e35bb3ec25aeff0118dc7 (diff)
downloadcpython-c2670a000bd69fb689a7b05436ff0091052f4f3c.zip
cpython-c2670a000bd69fb689a7b05436ff0091052f4f3c.tar.gz
cpython-c2670a000bd69fb689a7b05436ff0091052f4f3c.tar.bz2
posix: added setpgrp() and, if sgi, setsid() and setpgid(pid, pgid)
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c60
1 files changed, 59 insertions, 1 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 95e5907..0bc0f91 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -34,6 +34,10 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define NO_UNAME
#endif
+#ifdef __sgi
+#define DO_PG
+#endif
+
#include <signal.h>
#include <string.h>
#include <setjmp.h>
@@ -637,6 +641,23 @@ posix_getpgrp(self, args)
}
static object *
+posix_setpgrp(self, args)
+ object *self;
+ object *args;
+{
+ if (!getnoarg(args))
+ return NULL;
+#ifdef SYSV
+ if (setpgrp() < 0)
+#else
+ if (setpgrp(0, 0) < 0)
+#endif
+ return err_errno(PosixError);
+ INCREF(None);
+ return None;
+}
+
+static object *
posix_getppid(self, args)
object *self;
object *args;
@@ -815,7 +836,38 @@ posix_times(self, args)
return tuple;
}
-#endif
+#endif /* DO_TIMES */
+
+#ifdef DO_PG
+
+static object *
+posix_setsid(self, args)
+ object *self;
+ object *args;
+{
+ if (!getnoarg(args))
+ return NULL;
+ if (setsid() < 0)
+ err_errno(PosixError);
+ INCREF(None);
+ return None;
+}
+
+static object *
+posix_setpgid(self, args)
+ object *self;
+ object *args;
+{
+ int pid, pgrp;
+ if (!getargs(args, "(ii)", &pid, &pgrp))
+ return NULL;
+ if (setpgid(pid, pgrp) < 0)
+ err_errno(PosixError);
+ INCREF(None);
+ return None;
+}
+
+#endif /* DO_PG */
static struct methodlist posix_methods[] = {
@@ -859,10 +911,16 @@ static struct methodlist posix_methods[] = {
{"getuid", posix_getuid},
{"kill", posix_kill},
{"popen", posix_popen},
+ {"setpgrp", posix_setpgrp},
{"wait", posix_wait},
{"waitpid", posix_waitpid},
#endif
+#ifdef DO_PG
+ {"setsid", posix_setsid},
+ {"setpgid", posix_setpgid},
+#endif
+
{NULL, NULL} /* Sentinel */
};