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
951cc0f4
Commit
951cc0f4
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
105be772
Changes
6
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 @
951cc0f4
...
...
@@ -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 @
951cc0f4
...
...
@@ -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 @
951cc0f4
...
...
@@ -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 @
951cc0f4
#! /bin/sh
# From configure.in Revision: 60
141
.
# From configure.in Revision: 60
464
.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.61 for python 2.6.
#
...
...
@@ -10160,6 +10160,411 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
{
echo
"
$as_me
:
$LINENO
: checking for pid_t"
>
&5
echo
$ECHO_N
"checking for pid_t...
$ECHO_C
"
>
&6
;
}
if
test
"
${
ac_cv_type_pid_t
+set
}
"
=
set
;
then
echo
$ECHO_N
"(cached)
$ECHO_C
"
>
&6
else
cat
>
conftest.
$ac_ext
<<
_ACEOF
/* confdefs.h. */
_ACEOF
cat
confdefs.h
>>
conftest.
$ac_ext
cat
>>
conftest.
$ac_ext
<<
_ACEOF
/* end confdefs.h. */
$ac_includes_default
typedef pid_t ac__type_new_;
int
main ()
{
if ((ac__type_new_ *) 0)
return 0;
if (sizeof (ac__type_new_))
return 0;
;
return 0;
}
_ACEOF
rm
-f
conftest.
$ac_objext
if
{
(
ac_try
=
"
$ac_compile
"
case
"((
$ac_try
"
in
*
\"
*
|
*
\`
*
|
*
\\
*
)
ac_try_echo
=
\$
ac_try
;;
*
)
ac_try_echo
=
$ac_try
;;
esac
eval
"echo
\"\$
as_me:
$LINENO
:
$ac_try_echo
\"
"
)
>
&5
(
eval
"
$ac_compile
"
)
2>conftest.er1
ac_status
=
$?
grep
-v
'^ *+'
conftest.er1
>
conftest.err
rm
-f
conftest.er1
cat
conftest.err
>
&5
echo
"
$as_me
:
$LINENO
:
\$
? =
$ac_status
"
>
&5
(
exit
$ac_status
)
;
}
&&
{
test
-z
"
$ac_c_werror_flag
"
||
test
!
-s
conftest.err
}
&&
test
-s
conftest.
$ac_objext
;
then
ac_cv_type_pid_t
=
yes
else
echo
"
$as_me
: failed program was:"
>
&5
sed
's/^/| /'
conftest.
$ac_ext
>
&5
ac_cv_type_pid_t
=
no
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
fi
{
echo
"
$as_me
:
$LINENO
: result:
$ac_cv_type_pid_t
"
>
&5
echo
"
${
ECHO_T
}
$ac_cv_type_pid_t
"
>
&6
;
}
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
{
echo
"
$as_me
:
$LINENO
: checking size of pid_t"
>
&5
echo
$ECHO_N
"checking size of pid_t...
$ECHO_C
"
>
&6
;
}
if
test
"
${
ac_cv_sizeof_pid_t
+set
}
"
=
set
;
then
echo
$ECHO_N
"(cached)
$ECHO_C
"
>
&6
else
if
test
"
$cross_compiling
"
=
yes
;
then
# Depending upon the size, compute the lo and hi bounds.
cat
>
conftest.
$ac_ext
<<
_ACEOF
/* confdefs.h. */
_ACEOF
cat
confdefs.h
>>
conftest.
$ac_ext
cat
>>
conftest.
$ac_ext
<<
_ACEOF
/* end confdefs.h. */
$ac_includes_default
typedef pid_t ac__type_sizeof_;
int
main ()
{
static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm
-f
conftest.
$ac_objext
if
{
(
ac_try
=
"
$ac_compile
"
case
"((
$ac_try
"
in
*
\"
*
|
*
\`
*
|
*
\\
*
)
ac_try_echo
=
\$
ac_try
;;
*
)
ac_try_echo
=
$ac_try
;;
esac
eval
"echo
\"\$
as_me:
$LINENO
:
$ac_try_echo
\"
"
)
>
&5
(
eval
"
$ac_compile
"
)
2>conftest.er1
ac_status
=
$?
grep
-v
'^ *+'
conftest.er1
>
conftest.err
rm
-f
conftest.er1
cat
conftest.err
>
&5
echo
"
$as_me
:
$LINENO
:
\$
? =
$ac_status
"
>
&5
(
exit
$ac_status
)
;
}
&&
{
test
-z
"
$ac_c_werror_flag
"
||
test
!
-s
conftest.err
}
&&
test
-s
conftest.
$ac_objext
;
then
ac_lo
=
0
ac_mid
=
0
while
:
;
do
cat
>
conftest.
$ac_ext
<<
_ACEOF
/* confdefs.h. */
_ACEOF
cat
confdefs.h
>>
conftest.
$ac_ext
cat
>>
conftest.
$ac_ext
<<
_ACEOF
/* end confdefs.h. */
$ac_includes_default
typedef pid_t ac__type_sizeof_;
int
main ()
{
static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <=
$ac_mid
)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm
-f
conftest.
$ac_objext
if
{
(
ac_try
=
"
$ac_compile
"
case
"((
$ac_try
"
in
*
\"
*
|
*
\`
*
|
*
\\
*
)
ac_try_echo
=
\$
ac_try
;;
*
)
ac_try_echo
=
$ac_try
;;
esac
eval
"echo
\"\$
as_me:
$LINENO
:
$ac_try_echo
\"
"
)
>
&5
(
eval
"
$ac_compile
"
)
2>conftest.er1
ac_status
=
$?
grep
-v
'^ *+'
conftest.er1
>
conftest.err
rm
-f
conftest.er1
cat
conftest.err
>
&5
echo
"
$as_me
:
$LINENO
:
\$
? =
$ac_status
"
>
&5
(
exit
$ac_status
)
;
}
&&
{
test
-z
"
$ac_c_werror_flag
"
||
test
!
-s
conftest.err
}
&&
test
-s
conftest.
$ac_objext
;
then
ac_hi
=
$ac_mid
;
break
else
echo
"
$as_me
: failed program was:"
>
&5
sed
's/^/| /'
conftest.
$ac_ext
>
&5
ac_lo
=
`
expr
$ac_mid
+ 1
`
if
test
$ac_lo
-le
$ac_mid
;
then
ac_lo
=
ac_hi
=
break
fi
ac_mid
=
`
expr
2
'*'
$ac_mid
+ 1
`
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
done
else
echo
"
$as_me
: failed program was:"
>
&5
sed
's/^/| /'
conftest.
$ac_ext
>
&5
cat
>
conftest.
$ac_ext
<<
_ACEOF
/* confdefs.h. */
_ACEOF
cat
confdefs.h
>>
conftest.
$ac_ext
cat
>>
conftest.
$ac_ext
<<
_ACEOF
/* end confdefs.h. */
$ac_includes_default
typedef pid_t ac__type_sizeof_;
int
main ()
{
static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm
-f
conftest.
$ac_objext
if
{
(
ac_try
=
"
$ac_compile
"
case
"((
$ac_try
"
in
*
\"
*
|
*
\`
*
|
*
\\
*
)
ac_try_echo
=
\$
ac_try
;;
*
)
ac_try_echo
=
$ac_try
;;
esac
eval
"echo
\"\$
as_me:
$LINENO
:
$ac_try_echo
\"
"
)
>
&5
(
eval
"
$ac_compile
"
)
2>conftest.er1
ac_status
=
$?
grep
-v
'^ *+'
conftest.er1
>
conftest.err
rm
-f
conftest.er1
cat
conftest.err
>
&5
echo
"
$as_me
:
$LINENO
:
\$
? =
$ac_status
"
>
&5
(
exit
$ac_status
)
;
}
&&
{
test
-z
"
$ac_c_werror_flag
"
||
test
!
-s
conftest.err
}
&&
test
-s
conftest.
$ac_objext
;
then
ac_hi
=
-1
ac_mid
=
-1
while
:
;
do
cat
>
conftest.
$ac_ext
<<
_ACEOF
/* confdefs.h. */
_ACEOF
cat
confdefs.h
>>
conftest.
$ac_ext
cat
>>
conftest.
$ac_ext
<<
_ACEOF
/* end confdefs.h. */
$ac_includes_default
typedef pid_t ac__type_sizeof_;
int
main ()
{
static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >=
$ac_mid
)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm
-f
conftest.
$ac_objext
if
{
(
ac_try
=
"
$ac_compile
"
case
"((
$ac_try
"
in
*
\"
*
|
*
\`
*
|
*
\\
*
)
ac_try_echo
=
\$
ac_try
;;
*
)
ac_try_echo
=
$ac_try
;;
esac
eval
"echo
\"\$
as_me:
$LINENO
:
$ac_try_echo
\"
"
)
>
&5
(
eval
"
$ac_compile
"
)
2>conftest.er1
ac_status
=
$?
grep
-v
'^ *+'
conftest.er1
>
conftest.err
rm
-f
conftest.er1
cat
conftest.err
>
&5
echo
"
$as_me
:
$LINENO
:
\$
? =
$ac_status
"
>
&5
(
exit
$ac_status
)
;
}
&&
{
test
-z
"
$ac_c_werror_flag
"
||
test
!
-s
conftest.err
}
&&
test
-s
conftest.
$ac_objext
;
then
ac_lo
=
$ac_mid
;
break
else
echo
"
$as_me
: failed program was:"
>
&5
sed
's/^/| /'
conftest.
$ac_ext
>
&5
ac_hi
=
`
expr
'('
$ac_mid
')'
- 1
`
if
test
$ac_mid
-le
$ac_hi
;
then
ac_lo
=
ac_hi
=
break
fi
ac_mid
=
`
expr
2
'*'
$ac_mid
`
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
done
else
echo
"
$as_me
: failed program was:"
>
&5
sed
's/^/| /'
conftest.
$ac_ext
>
&5
ac_lo
=
ac_hi
=
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
# Binary search between lo and hi bounds.
while
test
"x
$ac_lo
"
!=
"x
$ac_hi
"
;
do
ac_mid
=
`
expr
'('
$ac_hi
-
$ac_lo
')'
/ 2 +
$ac_lo
`
cat
>
conftest.
$ac_ext
<<
_ACEOF
/* confdefs.h. */
_ACEOF
cat
confdefs.h
>>
conftest.
$ac_ext
cat
>>
conftest.
$ac_ext
<<
_ACEOF
/* end confdefs.h. */
$ac_includes_default
typedef pid_t ac__type_sizeof_;
int
main ()
{
static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <=
$ac_mid
)];
test_array [0] = 0
;
return 0;
}
_ACEOF
rm
-f
conftest.
$ac_objext
if
{
(
ac_try
=
"
$ac_compile
"
case
"((
$ac_try
"
in
*
\"
*
|
*
\`
*
|
*
\\
*
)
ac_try_echo
=
\$
ac_try
;;
*
)
ac_try_echo
=
$ac_try
;;
esac
eval
"echo
\"\$
as_me:
$LINENO
:
$ac_try_echo
\"
"
)
>
&5
(
eval
"
$ac_compile
"
)
2>conftest.er1
ac_status
=
$?
grep
-v
'^ *+'
conftest.er1
>
conftest.err
rm
-f
conftest.er1
cat
conftest.err
>
&5
echo
"
$as_me
:
$LINENO
:
\$
? =
$ac_status
"
>
&5
(
exit
$ac_status
)
;
}
&&
{
test
-z
"
$ac_c_werror_flag
"
||
test
!
-s
conftest.err
}
&&
test
-s
conftest.
$ac_objext
;
then
ac_hi
=
$ac_mid
else
echo
"
$as_me
: failed program was:"
>
&5
sed
's/^/| /'
conftest.
$ac_ext
>
&5
ac_lo
=
`
expr
'('
$ac_mid
')'
+ 1
`
fi
rm
-f
core conftest.err conftest.
$ac_objext
conftest.
$ac_ext
done
case
$ac_lo
in
?
*
)
ac_cv_sizeof_pid_t
=
$ac_lo
;;
''
)
if
test
"
$ac_cv_type_pid_t
"
=
yes
;
then
{
{
echo
"
$as_me
:
$LINENO
: error: cannot compute sizeof (pid_t)
See
\`
config.log' for more details."
>
&5
echo
"
$as_me
: error: cannot compute sizeof (pid_t)
See
\`
config.log' for more details."
>
&2
;
}
{
(
exit
77
)
;
exit
77
;
}
;
}
else
ac_cv_sizeof_pid_t
=
0
fi
;;
esac
else
cat
>
conftest.
$ac_ext
<<
_ACEOF
/* confdefs.h. */
_ACEOF
cat
confdefs.h
>>
conftest.
$ac_ext
cat
>>
conftest.
$ac_ext
<<
_ACEOF
/* end confdefs.h. */
$ac_includes_default
typedef pid_t ac__type_sizeof_;
static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
#include <stdio.h>
#include <stdlib.h>
int
main ()
{
FILE *f = fopen ("conftest.val", "w");
if (! f)
return 1;
if (((long int) (sizeof (ac__type_sizeof_))) < 0)
{
long int i = longval ();
if (i != ((long int) (sizeof (ac__type_sizeof_))))
return 1;
fprintf (f, "%ld
\n
", i);
}
else
{
unsigned long int i = ulongval ();
if (i != ((long int) (sizeof (ac__type_sizeof_))))
return 1;
fprintf (f, "%lu
\n
", i);
}
return ferror (f) || fclose (f) != 0;
;
return 0;
}
_ACEOF
rm
-f
conftest
$ac_exeext
if
{
(
ac_try
=
"
$ac_link
"
case
"((
$ac_try
"
in
*
\"
*
|
*
\`
*
|
*
\\
*
)
ac_try_echo
=
\$
ac_try
;;
*
)
ac_try_echo
=
$ac_try
;;
esac
eval
"echo
\"\$
as_me:
$LINENO
:
$ac_try_echo
\"
"
)
>
&5
(
eval
"
$ac_link
"
)
2>&5
ac_status
=
$?
echo
"
$as_me
:
$LINENO
:
\$
? =
$ac_status
"
>
&5
(
exit
$ac_status
)
;
}
&&
{
ac_try
=
'./conftest$ac_exeext'
{
(
case
"((
$ac_try
"
in
*
\"
*
|
*
\`
*
|
*
\\
*
)
ac_try_echo
=
\$
ac_try
;;
*
)
ac_try_echo
=
$ac_try
;;
esac
eval
"echo
\"\$
as_me:
$LINENO
:
$ac_try_echo
\"
"
)
>
&5
(
eval
"
$ac_try
"
)
2>&5
ac_status
=
$?
echo
"
$as_me
:
$LINENO
:
\$
? =
$ac_status
"
>
&5
(
exit
$ac_status
)
;
}
;
}
;
then
ac_cv_sizeof_pid_t
=
`
cat
conftest.val
`
else
echo
"
$as_me
: program exited with status
$ac_status
"
>
&5
echo
"
$as_me
: failed program was:"
>
&5
sed
's/^/| /'
conftest.
$ac_ext
>
&5
(
exit
$ac_status
)
if
test
"
$ac_cv_type_pid_t
"
=
yes
;
then
{
{
echo
"
$as_me
:
$LINENO
: error: cannot compute sizeof (pid_t)
See
\`
config.log' for more details."
>
&5
echo
"
$as_me
: error: cannot compute sizeof (pid_t)
See
\`
config.log' for more details."
>
&2
;
}
{
(
exit
77
)
;
exit
77
;
}
;
}
else
ac_cv_sizeof_pid_t
=
0
fi
fi
rm
-f
core
*
.core core.conftest.
*
gmon.out bb.out conftest
$ac_exeext
conftest.
$ac_objext
conftest.
$ac_ext
fi
rm
-f
conftest.val
fi
{
echo
"
$as_me
:
$LINENO
: result:
$ac_cv_sizeof_pid_t
"
>
&5
echo
"
${
ECHO_T
}
$ac_cv_sizeof_pid_t
"
>
&6
;
}
cat
>>
confdefs.h
<<
_ACEOF
#define SIZEOF_PID_T
$ac_cv_sizeof_pid_t
_ACEOF
{
echo
"
$as_me
:
$LINENO
: checking for long long support"
>
&5
echo
$ECHO_N
"checking for long long support...
$ECHO_C
"
>
&6
;
}
...
...
configure.in
View file @
951cc0f4
...
...
@@ -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 @
951cc0f4
...
...
@@ -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