Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
8399f1b9
Commit
8399f1b9
authored
Jan 31, 2008
by
Christian Heimes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bug #1983: Return from fork() is pid_t, not int
parent
5100888f
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
429 additions
and
9 deletions
+429
-9
Include/pyport.h
Include/pyport.h
+5
-1
Misc/NEWS
Misc/NEWS
+6
-0
Modules/posixmodule.c
Modules/posixmodule.c
+7
-6
configure
configure
+406
-1
configure.in
configure.in
+2
-1
pyconfig.h.in
pyconfig.h.in
+3
-0
No files found.
Include/pyport.h
View file @
8399f1b9
...
...
@@ -122,6 +122,10 @@ typedef Py_intptr_t Py_ssize_t;
/* Smallest negative value of type Py_ssize_t. */
#define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX-1)
#if SIZEOF_PID_T > SIZEOF_LONG
# error "Python doesn't support sizeof(pid_t) > sizeof(long)"
#endif
/* PY_FORMAT_SIZE_T is a platform-specific modifier for use in a printf
* format to convert an argument with the width of a size_t or Py_ssize_t.
* C99 introduced "z" for this purpose, but not all platforms support that;
...
...
@@ -573,7 +577,7 @@ extern char * _getpty(int *, int, mode_t, int);
functions, even though they are included in libutil. */
#include <termios.h>
extern
int
openpty
(
int
*
,
int
*
,
char
*
,
struct
termios
*
,
struct
winsize
*
);
extern
in
t
forkpty
(
int
*
,
char
*
,
struct
termios
*
,
struct
winsize
*
);
extern
pid_
t
forkpty
(
int
*
,
char
*
,
struct
termios
*
,
struct
winsize
*
);
#endif
/* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */
#endif
/* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */
...
...
Misc/NEWS
View file @
8399f1b9
...
...
@@ -12,6 +12,9 @@ What's New in Python 2.6 alpha 1?
Core and builtins
-----------------
- Bug #1983: Fixed return type of fork(), fork1() and forkpty() calls.
Python expected the return type int but the fork familie returns pi_t.
- Issue #1678380: Fix a bug that identifies 0j and -0j when they appear
in the same code unit.
...
...
@@ -1386,6 +1389,9 @@ Tools/Demos
Build
-----
- Bug #1983: Added a check to pyport to verify that sizeof(pid_t) is
smaller or equal sizeof(long).
- Bug #1234: Fixed semaphore errors on AIX 5.2
- Issue #1726: Remove Python/atof.c from PCBuild/pythoncore.vcproj
...
...
Modules/posixmodule.c
View file @
8399f1b9
...
...
@@ -3575,11 +3575,11 @@ Return 0 to child process and PID of child to parent process.");
static
PyObject
*
posix_fork1
(
PyObject
*
self
,
PyObject
*
noargs
)
{
in
t
pid
=
fork1
();
pid_
t
pid
=
fork1
();
if
(
pid
==
-
1
)
return
posix_error
();
PyOS_AfterFork
();
return
PyInt_FromLong
(
(
long
)
pid
);
return
PyInt_FromLong
(
pid
);
}
#endif
...
...
@@ -3593,12 +3593,12 @@ Return 0 to child process and PID of child to parent process.");
static
PyObject
*
posix_fork
(
PyObject
*
self
,
PyObject
*
noargs
)
{
in
t
pid
=
fork
();
pid_
t
pid
=
fork
();
if
(
pid
==
-
1
)
return
posix_error
();
if
(
pid
==
0
)
PyOS_AfterFork
();
return
PyInt_FromLong
(
(
long
)
pid
);
return
PyInt_FromLong
(
pid
);
}
#endif
...
...
@@ -3700,14 +3700,15 @@ To both, return fd of newly opened pseudo-terminal.\n");
static
PyObject
*
posix_forkpty
(
PyObject
*
self
,
PyObject
*
noargs
)
{
int
master_fd
=
-
1
,
pid
;
int
master_fd
=
-
1
;
pid_t
pid
;
pid
=
forkpty
(
&
master_fd
,
NULL
,
NULL
,
NULL
);
if
(
pid
==
-
1
)
return
posix_error
();
if
(
pid
==
0
)
PyOS_AfterFork
();
return
Py_BuildValue
(
"(
i
i)"
,
pid
,
master_fd
);
return
Py_BuildValue
(
"(
l
i)"
,
pid
,
master_fd
);
}
#endif
...
...
configure
View file @
8399f1b9
This diff is collapsed.
Click to expand it.
configure.in
View file @
8399f1b9
...
...
@@ -1202,7 +1202,7 @@ AC_TYPE_PID_T
AC_TYPE_SIGNAL
AC_TYPE_SIZE_T
AC_TYPE_UID_T
AC_CHECK_TYPE(ssize_t,
AC_CHECK_TYPE(ssize_t,
AC_DEFINE(HAVE_SSIZE_T, 1, Define if your compiler provides ssize_t),,)
# Sizes of various common basic types
...
...
@@ -1215,6 +1215,7 @@ AC_CHECK_SIZEOF(float, 4)
AC_CHECK_SIZEOF(double, 8)
AC_CHECK_SIZEOF(fpos_t, 4)
AC_CHECK_SIZEOF(size_t, 4)
AC_CHECK_SIZEOF(pid_t, 4)
AC_MSG_CHECKING(for long long support)
have_long_long=no
...
...
pyconfig.h.in
View file @
8399f1b9
...
...
@@ -869,6 +869,9 @@
/* The number of bytes in an off_t. */
#undef SIZEOF_OFF_T
/* The size of `pid_t', as computed by sizeof. */
#undef SIZEOF_PID_T
/* The number of bytes in a pthread_t. */
#undef SIZEOF_PTHREAD_T
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment