diff options
author | Guido van Rossum <guido@python.org> | 1992-09-17 17:54:56 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1992-09-17 17:54:56 (GMT) |
commit | 7066dd75c5ee8385135541d03fb8edd8939ad740 (patch) | |
tree | e118a32af87a83e295de0985b67da90524203c6a /Modules/posixmodule.c | |
parent | c2670a000bd69fb689a7b05436ff0091052f4f3c (diff) | |
download | cpython-7066dd75c5ee8385135541d03fb8edd8939ad740.zip cpython-7066dd75c5ee8385135541d03fb8edd8939ad740.tar.gz cpython-7066dd75c5ee8385135541d03fb8edd8939ad740.tar.bz2 |
* Makefile: added IMGFILE; moved some stuff around.
* flmodule.c: added some missing functions; changed readonly flags of
some data members based upon FORMS documentation.
* listobject.c: fixed int/long arg lint bug (bites PC compilers).
* several: removed redundant print methods (repr is good enough).
* posixmodule.c: added (still experimental) process group functions.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 0bc0f91..a263f1b 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -819,7 +819,7 @@ posix_times(self, args) errno = 0; c = times(&t); if (c == (clock_t) -1) { - err_errno(IOError); + err_errno(PosixError); return NULL; } tuple = newtupleobject(4); @@ -847,8 +847,10 @@ posix_setsid(self, args) { if (!getnoarg(args)) return NULL; - if (setsid() < 0) + if (setsid() < 0) { err_errno(PosixError); + return NULL; + } INCREF(None); return None; } @@ -861,12 +863,46 @@ posix_setpgid(self, args) int pid, pgrp; if (!getargs(args, "(ii)", &pid, &pgrp)) return NULL; - if (setpgid(pid, pgrp) < 0) + if (setpgid(pid, pgrp) < 0) { err_errno(PosixError); + return NULL; + } INCREF(None); return None; } +static object * +posix_tcgetpgrp(self, args) + object *self; + object *args; +{ + int fd, pgid; + if (!getargs(args, "i", &fd)) + return NULL; + pgid = tcgetpgrp(fd); + if (pgid < 0) { + err_errno(PosixError); + return NULL; + } + return newintobject((long)pgid); +} + +static object * +posix_tcsetpgrp(self, args) + object *self; + object *args; +{ + int fd, pgid; + if (!getargs(args, "(ii)", &fd, &pgid)) + return NULL; + if (tcsetpgrp(fd, pgid) < 0) { + err_errno(PosixError); + return NULL; + } + INCREF(None); + return None; +} + #endif /* DO_PG */ @@ -919,6 +955,8 @@ static struct methodlist posix_methods[] = { #ifdef DO_PG {"setsid", posix_setsid}, {"setpgid", posix_setpgid}, + {"tcgetpgrp", posix_tcgetpgrp}, + {"tcsetpgrp", posix_tcsetpgrp}, #endif {NULL, NULL} /* Sentinel */ |