[Python-checkins] python/dist/src/Modules posixmodule.c,2.235,2.236

loewis@users.sourceforge.net loewis@users.sourceforge.net
Thu, 13 Jun 2002 14:09:14 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv30598/Modules

Modified Files:
	posixmodule.c 
Log Message:
Patch #568235: Add posix.setpgid.


Index: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.235
retrieving revision 2.236
diff -C2 -d -r2.235 -r2.236
*** posixmodule.c	13 Jun 2002 20:32:50 -0000	2.235
--- posixmodule.c	13 Jun 2002 21:09:08 -0000	2.236
***************
*** 2118,2121 ****
--- 2118,2140 ----
  #endif
  
+ #ifdef HAVE_GETPGID
+ static char posix_getpgid__doc__[] =
+ "getpgid(pid) -> pgid\n\
+ Call the system call getpgid().";
+ 
+ static PyObject *
+ posix_getpgid(PyObject *self, PyObject *args)
+ {
+ 	int pid, pgid;
+ 	if (!PyArg_ParseTuple(args, "i:getpgid", &pid))
+ 		return NULL;
+ 	pgid = getpgid(pid);
+ 	if (pgid < 0)
+ 		return posix_error();
+ 	return PyInt_FromLong((long)pgid);
+ }
+ #endif /* HAVE_GETPGID */
+ 
+ 
  #ifdef HAVE_GETPGRP
  PyDoc_STRVAR(posix_getpgrp__doc__,
***************
*** 6407,6410 ****
--- 6426,6432 ----
  	{"setgroups",	posix_setgroups, METH_VARARGS, posix_setgroups__doc__},
  #endif /* HAVE_SETGROUPS */
+ #ifdef HAVE_GETPGID
+ 	{"getpgid",	posix_getpgid, METH_VARARGS, posix_getpgid__doc__},
+ #endif /* HAVE_GETPGID */
  #ifdef HAVE_SETPGRP
  	{"setpgrp",	posix_setpgrp, METH_VARARGS, posix_setpgrp__doc__},