Commit 490e5749 authored by Antoine Pitrou's avatar Antoine Pitrou

Merged revisions 72855 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r72855 | antoine.pitrou | 2009-05-23 18:06:49 +0200 (sam., 23 mai 2009) | 3 lines

  Some pid_t-expecting or producing functions were forgotten in r72852.
........
parent 0dec35e0
...@@ -4018,7 +4018,7 @@ Return the current process id"); ...@@ -4018,7 +4018,7 @@ Return the current process id");
static PyObject * static PyObject *
posix_getpid(PyObject *self, PyObject *noargs) posix_getpid(PyObject *self, PyObject *noargs)
{ {
return PyLong_FromLong((long)getpid()); return PyLong_FromPid(getpid());
} }
...@@ -4072,13 +4072,13 @@ Call the system call getpgid()."); ...@@ -4072,13 +4072,13 @@ Call the system call getpgid().");
static PyObject * static PyObject *
posix_getpgid(PyObject *self, PyObject *args) posix_getpgid(PyObject *self, PyObject *args)
{ {
int pid, pgid; pid_t pid, pgid;
if (!PyArg_ParseTuple(args, "i:getpgid", &pid)) if (!PyArg_ParseTuple(args, PARSE_PID ":getpgid", &pid))
return NULL; return NULL;
pgid = getpgid(pid); pgid = getpgid(pid);
if (pgid < 0) if (pgid < 0)
return posix_error(); return posix_error();
return PyLong_FromLong((long)pgid); return PyLong_FromPid(pgid);
} }
#endif /* HAVE_GETPGID */ #endif /* HAVE_GETPGID */
...@@ -4092,9 +4092,9 @@ static PyObject * ...@@ -4092,9 +4092,9 @@ static PyObject *
posix_getpgrp(PyObject *self, PyObject *noargs) posix_getpgrp(PyObject *self, PyObject *noargs)
{ {
#ifdef GETPGRP_HAVE_ARG #ifdef GETPGRP_HAVE_ARG
return PyLong_FromLong((long)getpgrp(0)); return PyLong_FromPid(getpgrp(0));
#else /* GETPGRP_HAVE_ARG */ #else /* GETPGRP_HAVE_ARG */
return PyLong_FromLong((long)getpgrp()); return PyLong_FromPid(getpgrp());
#endif /* GETPGRP_HAVE_ARG */ #endif /* GETPGRP_HAVE_ARG */
} }
#endif /* HAVE_GETPGRP */ #endif /* HAVE_GETPGRP */
...@@ -4128,7 +4128,7 @@ Return the parent's process id."); ...@@ -4128,7 +4128,7 @@ Return the parent's process id.");
static PyObject * static PyObject *
posix_getppid(PyObject *self, PyObject *noargs) posix_getppid(PyObject *self, PyObject *noargs)
{ {
return PyLong_FromLong((long)getppid()); return PyLong_FromPid(getppid());
} }
#endif #endif
...@@ -4217,8 +4217,13 @@ Kill a process group with a signal."); ...@@ -4217,8 +4217,13 @@ Kill a process group with a signal.");
static PyObject * static PyObject *
posix_killpg(PyObject *self, PyObject *args) posix_killpg(PyObject *self, PyObject *args)
{ {
int pgid, sig; int sig;
if (!PyArg_ParseTuple(args, "ii:killpg", &pgid, &sig)) pid_t pgid;
/* XXX some man pages make the `pgid` parameter an int, others
a pid_t. Since getpgrp() returns a pid_t, we assume killpg should
take the same type. Moreover, pid_t is always at least as wide as
int (else compilation of this module fails), which is safe. */
if (!PyArg_ParseTuple(args, PARSE_PID "i:killpg", &pgid, &sig))
return NULL; return NULL;
if (killpg(pgid, sig) == -1) if (killpg(pgid, sig) == -1)
return posix_error(); return posix_error();
...@@ -4898,8 +4903,9 @@ Set the process group associated with the terminal given by a fd."); ...@@ -4898,8 +4903,9 @@ Set the process group associated with the terminal given by a fd.");
static PyObject * static PyObject *
posix_tcsetpgrp(PyObject *self, PyObject *args) posix_tcsetpgrp(PyObject *self, PyObject *args)
{ {
int fd, pgid; int fd;
if (!PyArg_ParseTuple(args, "ii:tcsetpgrp", &fd, &pgid)) pid_t pgid;
if (!PyArg_ParseTuple(args, "i" PARSE_PID ":tcsetpgrp", &fd, &pgid))
return NULL; return NULL;
if (tcsetpgrp(fd, pgid) < 0) if (tcsetpgrp(fd, pgid) < 0)
return posix_error(); return posix_error();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment