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
24a880b4
Commit
24a880b4
authored
Dec 31, 2002
by
Martin v. Löwis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Patch #656590: /dev/ptmx support for ptys.
parent
b70557f1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
76 additions
and
10 deletions
+76
-10
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+2
-0
Modules/posixmodule.c
Modules/posixmodule.c
+39
-7
configure
configure
+20
-3
configure.in
configure.in
+11
-0
pyconfig.h.in
pyconfig.h.in
+3
-0
No files found.
Misc/ACKS
View file @
24a880b4
...
@@ -512,6 +512,7 @@ Casper Stoel
...
@@ -512,6 +512,7 @@ Casper Stoel
Peter Stoehr
Peter Stoehr
Ken Stox
Ken Stox
Daniel Stutzbach
Daniel Stutzbach
Paul Swartz
William Tanksley
William Tanksley
Christian Tanzer
Christian Tanzer
Amy Taylor
Amy Taylor
...
...
Misc/NEWS
View file @
24a880b4
...
@@ -359,6 +359,8 @@ Core and builtins
...
@@ -359,6 +359,8 @@ Core and builtins
Extension
modules
Extension
modules
-----------------
-----------------
-
posix
.
openpty
now
works
on
all
systems
that
have
/
dev
/
ptmx
.
-
A
module
zipimport
exists
to
support
importing
code
from
zip
-
A
module
zipimport
exists
to
support
importing
code
from
zip
archives
.
archives
.
...
...
Modules/posixmodule.c
View file @
24a880b4
...
@@ -2718,7 +2718,7 @@ posix_fork(PyObject *self, PyObject *args)
...
@@ -2718,7 +2718,7 @@ posix_fork(PyObject *self, PyObject *args)
}
}
#endif
#endif
#if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY)
#if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY)
|| defined(HAVE_DEV_PTMX)
#ifdef HAVE_PTY_H
#ifdef HAVE_PTY_H
#include <pty.h>
#include <pty.h>
#else
#else
...
@@ -2726,9 +2726,12 @@ posix_fork(PyObject *self, PyObject *args)
...
@@ -2726,9 +2726,12 @@ posix_fork(PyObject *self, PyObject *args)
#include <libutil.h>
#include <libutil.h>
#endif
/* HAVE_LIBUTIL_H */
#endif
/* HAVE_LIBUTIL_H */
#endif
/* HAVE_PTY_H */
#endif
/* HAVE_PTY_H */
#endif
/* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */
#ifdef sun
#include <sys/stropts.h>
#endif
#endif
/* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) || defined(HAVE_DEV_PTMX */
#if defined(HAVE_OPENPTY) || defined(HAVE__GETPTY)
#if defined(HAVE_OPENPTY) || defined(HAVE__GETPTY)
|| defined(HAVE_DEV_PTMX)
PyDoc_STRVAR
(
posix_openpty__doc__
,
PyDoc_STRVAR
(
posix_openpty__doc__
,
"openpty() -> (master_fd, slave_fd)
\n\n
\
"openpty() -> (master_fd, slave_fd)
\n\n
\
Open a pseudo-terminal, returning open fd's for both master and slave end.
\n
"
);
Open a pseudo-terminal, returning open fd's for both master and slave end.
\n
"
);
...
@@ -2739,6 +2742,12 @@ posix_openpty(PyObject *self, PyObject *args)
...
@@ -2739,6 +2742,12 @@ posix_openpty(PyObject *self, PyObject *args)
int
master_fd
,
slave_fd
;
int
master_fd
,
slave_fd
;
#ifndef HAVE_OPENPTY
#ifndef HAVE_OPENPTY
char
*
slave_name
;
char
*
slave_name
;
#endif
#if defined(HAVE_DEV_PTMX) && !defined(HAVE_OPENPTY) && !defined(HAVE__GETPTY)
void
*
sig_saved
;
#ifdef sun
extern
char
*
ptsname
();
#endif
#endif
#endif
if
(
!
PyArg_ParseTuple
(
args
,
":openpty"
))
if
(
!
PyArg_ParseTuple
(
args
,
":openpty"
))
...
@@ -2747,7 +2756,7 @@ posix_openpty(PyObject *self, PyObject *args)
...
@@ -2747,7 +2756,7 @@ posix_openpty(PyObject *self, PyObject *args)
#ifdef HAVE_OPENPTY
#ifdef HAVE_OPENPTY
if
(
openpty
(
&
master_fd
,
&
slave_fd
,
NULL
,
NULL
,
NULL
)
!=
0
)
if
(
openpty
(
&
master_fd
,
&
slave_fd
,
NULL
,
NULL
,
NULL
)
!=
0
)
return
posix_error
();
return
posix_error
();
#el
se
#el
if HAVE__GETPTY
slave_name
=
_getpty
(
&
master_fd
,
O_RDWR
,
0666
,
0
);
slave_name
=
_getpty
(
&
master_fd
,
O_RDWR
,
0666
,
0
);
if
(
slave_name
==
NULL
)
if
(
slave_name
==
NULL
)
return
posix_error
();
return
posix_error
();
...
@@ -2755,12 +2764,35 @@ posix_openpty(PyObject *self, PyObject *args)
...
@@ -2755,12 +2764,35 @@ posix_openpty(PyObject *self, PyObject *args)
slave_fd
=
open
(
slave_name
,
O_RDWR
);
slave_fd
=
open
(
slave_name
,
O_RDWR
);
if
(
slave_fd
<
0
)
if
(
slave_fd
<
0
)
return
posix_error
();
return
posix_error
();
#else
master_fd
=
open
(
"/dev/ptmx"
,
O_RDWR
|
O_NOCTTY
);
/* open master */
if
(
master_fd
<
0
)
return
posix_error
();
sig_saved
=
signal
(
SIGCHLD
,
SIG_DFL
);
if
(
grantpt
(
master_fd
)
<
0
)
/* change permission of slave */
return
posix_error
();
if
(
unlockpt
(
master_fd
)
<
0
)
/* unlock slave */
return
posix_error
();
signal
(
SIGCHLD
,
sig_saved
);
slave_name
=
ptsname
(
master_fd
);
/* get name of slave */
if
(
slave_name
==
NULL
)
return
posix_error
();
slave_fd
=
open
(
slave_name
,
O_RDWR
|
O_NOCTTY
);
/* open slave */
if
(
slave_fd
<
0
)
return
posix_error
();
#ifndef __CYGWIN__
ioctl
(
slave_fd
,
I_PUSH
,
"ptem"
);
/* push ptem */
ioctl
(
slave_fd
,
I_PUSH
,
"ldterm"
);
/* push ldterm */
#ifndef _hpux
ioctl
(
slave_fd
,
I_PUSH
,
"ttcompat"
);
/* push ttcompat */
#endif
/* _hpux */
#endif
/* HAVE_CYGWIN */
#endif
/* HAVE_OPENPTY */
#endif
/* HAVE_OPENPTY */
return
Py_BuildValue
(
"(ii)"
,
master_fd
,
slave_fd
);
return
Py_BuildValue
(
"(ii)"
,
master_fd
,
slave_fd
);
}
}
#endif
/* defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) */
#endif
/* defined(HAVE_OPENPTY) || defined(HAVE__GETPTY)
|| defined(HAVE_DEV_PTMX)
*/
#ifdef HAVE_FORKPTY
#ifdef HAVE_FORKPTY
PyDoc_STRVAR
(
posix_forkpty__doc__
,
PyDoc_STRVAR
(
posix_forkpty__doc__
,
...
@@ -7229,9 +7261,9 @@ static PyMethodDef posix_methods[] = {
...
@@ -7229,9 +7261,9 @@ static PyMethodDef posix_methods[] = {
#ifdef HAVE_FORK
#ifdef HAVE_FORK
{
"fork"
,
posix_fork
,
METH_VARARGS
,
posix_fork__doc__
},
{
"fork"
,
posix_fork
,
METH_VARARGS
,
posix_fork__doc__
},
#endif
/* HAVE_FORK */
#endif
/* HAVE_FORK */
#if defined(HAVE_OPENPTY) || defined(HAVE__GETPTY)
#if defined(HAVE_OPENPTY) || defined(HAVE__GETPTY)
|| defined(HAVE_DEV_PTMX)
{
"openpty"
,
posix_openpty
,
METH_VARARGS
,
posix_openpty__doc__
},
{
"openpty"
,
posix_openpty
,
METH_VARARGS
,
posix_openpty__doc__
},
#endif
/* HAVE_OPENPTY || HAVE__GETPTY */
#endif
/* HAVE_OPENPTY || HAVE__GETPTY
|| HAVE_DEV_PTMX
*/
#ifdef HAVE_FORKPTY
#ifdef HAVE_FORKPTY
{
"forkpty"
,
posix_forkpty
,
METH_VARARGS
,
posix_forkpty__doc__
},
{
"forkpty"
,
posix_forkpty
,
METH_VARARGS
,
posix_forkpty__doc__
},
#endif
/* HAVE_FORKPTY */
#endif
/* HAVE_FORKPTY */
...
...
configure
View file @
24a880b4
#! /bin/sh
#! /bin/sh
# From configure.in Revision: 1.38
0
.
# From configure.in Revision: 1.38
1
.
# Guess values for system-dependent variables and create Makefiles.
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.53 for python 2.3.
# Generated by GNU Autoconf 2.53 for python 2.3.
#
#
...
@@ -908,7 +908,7 @@ esac
...
@@ -908,7 +908,7 @@ esac
# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
# absolute.
# absolute.
ac_abs_builddir
=
`
cd
"
$ac_dir
"
&&
cd
$ac_builddir
&&
pwd
`
ac_abs_builddir
=
`
cd
"
$ac_dir
"
&&
cd
$ac_builddir
&&
pwd
`
ac_abs_top_builddir
=
`
cd
"
$ac_dir
"
&&
cd
$
ac_top_builddir
&&
pwd
`
ac_abs_top_builddir
=
`
cd
"
$ac_dir
"
&&
cd
$
{
ac_top_builddir
}
.
&&
pwd
`
ac_abs_srcdir
=
`
cd
"
$ac_dir
"
&&
cd
$ac_srcdir
&&
pwd
`
ac_abs_srcdir
=
`
cd
"
$ac_dir
"
&&
cd
$ac_srcdir
&&
pwd
`
ac_abs_top_srcdir
=
`
cd
"
$ac_dir
"
&&
cd
$ac_top_srcdir
&&
pwd
`
ac_abs_top_srcdir
=
`
cd
"
$ac_dir
"
&&
cd
$ac_top_srcdir
&&
pwd
`
...
@@ -16657,6 +16657,23 @@ _ACEOF
...
@@ -16657,6 +16657,23 @@ _ACEOF
fi
fi
echo
"
$as_me
:
$LINENO
: checking for /dev/ptmx"
>
&5
echo
$ECHO_N
"checking for /dev/ptmx...
$ECHO_C
"
>
&6
if
test
-e
/dev/ptmx
then
echo
"
$as_me
:
$LINENO
: result: yes"
>
&5
echo
"
${
ECHO_T
}
yes"
>
&6
cat
>>
confdefs.h
<<
\
_ACEOF
#define HAVE_DEV_PTMX 1
_ACEOF
else
echo
"
$as_me
:
$LINENO
: result: no"
>
&5
echo
"
${
ECHO_T
}
no"
>
&6
fi
echo
"
$as_me
:
$LINENO
: checking for socklen_t"
>
&5
echo
"
$as_me
:
$LINENO
: checking for socklen_t"
>
&5
echo
$ECHO_N
"checking for socklen_t...
$ECHO_C
"
>
&6
echo
$ECHO_N
"checking for socklen_t...
$ECHO_C
"
>
&6
if
test
"
${
ac_cv_type_socklen_t
+set
}
"
=
set
;
then
if
test
"
${
ac_cv_type_socklen_t
+set
}
"
=
set
;
then
...
@@ -17483,7 +17500,7 @@ esac
...
@@ -17483,7 +17500,7 @@ esac
# Don't blindly perform a `cd "
$ac_dir
"/
$ac_foo
&& pwd` since
$ac_foo
can be
# Don't blindly perform a `cd "
$ac_dir
"/
$ac_foo
&& pwd` since
$ac_foo
can be
# absolute.
# absolute.
ac_abs_builddir=`cd "
$ac_dir
" && cd
$ac_builddir
&& pwd`
ac_abs_builddir=`cd "
$ac_dir
" && cd
$ac_builddir
&& pwd`
ac_abs_top_builddir=`cd "
$ac_dir
" && cd
$
ac_top_builddir
&& pwd`
ac_abs_top_builddir=`cd "
$ac_dir
" && cd
$
{
ac_top_builddir
}
.
&& pwd`
ac_abs_srcdir=`cd "
$ac_dir
" && cd
$ac_srcdir
&& pwd`
ac_abs_srcdir=`cd "
$ac_dir
" && cd
$ac_srcdir
&& pwd`
ac_abs_top_srcdir=`cd "
$ac_dir
" && cd
$ac_top_srcdir
&& pwd`
ac_abs_top_srcdir=`cd "
$ac_dir
" && cd
$ac_top_srcdir
&& pwd`
...
...
configure.in
View file @
24a880b4
...
@@ -2486,6 +2486,17 @@ then
...
@@ -2486,6 +2486,17 @@ then
[Define if WINDOW in curses.h offers a field _flags.])
[Define if WINDOW in curses.h offers a field _flags.])
fi
fi
AC_MSG_CHECKING(for /dev/ptmx)
if test -e /dev/ptmx
then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DEV_PTMX, 1,
[Define if we have /dev/ptmx.])
else
AC_MSG_RESULT(no)
fi
AC_CHECK_TYPE(socklen_t,,
AC_CHECK_TYPE(socklen_t,,
AC_DEFINE(socklen_t,int,
AC_DEFINE(socklen_t,int,
Define to `int' if <sys/socket.h> does not define.),[
Define to `int' if <sys/socket.h> does not define.),[
...
...
pyconfig.h.in
View file @
24a880b4
...
@@ -65,6 +65,9 @@
...
@@ -65,6 +65,9 @@
/* Define to 1 if you have the device macros. */
/* Define to 1 if you have the device macros. */
#undef HAVE_DEVICE_MACROS
#undef HAVE_DEVICE_MACROS
/* Define if we have /dev/ptmx. */
#undef HAVE_DEV_PTMX
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
*/
#undef HAVE_DIRENT_H
#undef HAVE_DIRENT_H
...
...
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