[Patches] [ python-Patches-656590 ] /dev/ptmx support for ptys (cygwin)
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 31 Dec 2002 09:18:33 -0800
Patches item #656590, was opened at 2002-12-19 20:38
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=656590&group_id=5470
Category: Modules
Group: None
>Status: Open
Resolution: Accepted
Priority: 5
Submitted By: Paul Swartz (z3p)
>Assigned to: Neal Norwitz (nnorwitz)
Summary: /dev/ptmx support for ptys (cygwin)
Initial Comment:
On Cygwin (and I believe Solaris, but I'm not sure), ptys
are allocated using /dev/ptmx. This patch checks
for /dev/ptmx, and if it exists and openpty and _getpty
don't, it will open ptys using /dev/ptmx.
----------------------------------------------------------------------
>Comment By: Neal Norwitz (nnorwitz)
Date: 2002-12-31 12:18
Message:
Logged In: YES
user_id=33168
Paul, I had to modify the patch a bit to get posixmodule.c
to compile on HPUX11. HPUX also needs sys/stropts.h for
I_PUSH and the macro is __hpux, not _hpux.
However, after making these changes, test_openpty fails:
'Master-end of pty is not a terminal' and test_pty hangs
when doing: if not os.isatty(slave_fd)
Any ideas?
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2002-12-31 07:57
Message:
Logged In: YES
user_id=21627
Thanks for the patch. Committed as
configure 1.371
configure.in 1.382
pyconfig.h.in 1.67
ACKS 1.221
NEWS 1.581
posixmodule.c 2.277
----------------------------------------------------------------------
Comment By: Paul Swartz (z3p)
Date: 2002-12-27 14:13
Message:
Logged In: YES
user_id=123843
Fixed to use __CYGWIN__. I don't think doing forkpty in the
same way is the right idea, given that pty.fork() does the
same thing and is the "right" way to fork with ptys. The
openpty change is necessary because there is no way
duplicate it from pure-python, whereas forkpty can be
duplicated with openpty/fork.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2002-12-27 05:25
Message:
Logged In: YES
user_id=21627
It is common in Python to check for cygwin by checking
whether __CYGWIN__ is defined, so there is no need to invent
another mechanism.
Also, could you work out patches for forkpty as well?
----------------------------------------------------------------------
Comment By: Paul Swartz (z3p)
Date: 2002-12-21 13:23
Message:
Logged In: YES
user_id=123843
I reconciled the openpty parts of the two patches, and have
attached a new patch. The only thing I wonder about is if
there is a better way to check for Cygwin in posixmodule.
Adding an extra define seems like the wrong way.
----------------------------------------------------------------------
Comment By: Paul Swartz (z3p)
Date: 2002-12-21 11:49
Message:
Logged In: YES
user_id=123843
I took a look at the other patch, and back at the OpenSSH
pty code (where I got the idea). The pushes are in an '#ifndef
CYGWIN' in OpenSSH, and the ioctl for ttcompant is in
an '#ifndef _hpux'. Not changing the SIGCHLD handler didn't
break the cygwin code, but I doubt adding that would break
things. I'll work on combining the two, and upload another
patch. I'll also fix the nested #ifs.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2002-12-21 06:41
Message:
Logged In: YES
user_id=21627
How does this compare to #579433, in your opinion?
I like that this patch uses autoconf for ptmx usage, but I
wonder whether the various pushes are necessary in the
other patch.
Please use #elif instead of nested #ifs where possible.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=656590&group_id=5470