mirror of
https://github.com/python/cpython.git
synced 2025-11-02 03:01:58 +00:00
Patch #568235: Add posix.setpgid.
This commit is contained in:
parent
14f8b4cfcb
commit
606edc1d97
8 changed files with 41 additions and 3 deletions
|
|
@ -2117,6 +2117,25 @@ posix_getgroups(PyObject *self, PyObject *args)
|
|||
}
|
||||
#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__,
|
||||
"getpgrp() -> pgrp\n\
|
||||
|
|
@ -6406,6 +6425,9 @@ static PyMethodDef posix_methods[] = {
|
|||
#ifdef HAVE_SETGROUPS
|
||||
{"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__},
|
||||
#endif /* HAVE_SETPGRP */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue