[Python-Dev] posixmodule.c diffs for working forkpty() and openpty() under Solaris 2.8
Martin v. Loewis
martin@v.loewis.de
29 Jun 2002 19:59:47 +0200
Lance Ellinghaus <lellinghaus@yahoo.com> writes:
> Please let me know if anyone has any problems with this!
I do. I have the general problem with posting such patches to
python-dev; please put them onto SF instead. For specific problems,
please see below.
> ! #if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) || defined(sun)
> ! #ifdef sun
> ! #include <sys/stropts.h>
> ! #endif
I don't like #if <system> defines. What is the problem, and why can't
it be solved with a HAVE_ test?
Also, are you certain your changes apply to all systems that define sun?
> + master_fd = open("/dev/ptmx", O_RDWR|O_NOCTTY); /* open master */
> + sig_saved = signal(SIGCHLD, SIG_DFL);
> + grantpt(master_fd); /* change permission of slave */
> + unlockpt(master_fd); /* unlock slave */
> + signal(SIGCHLD,sig_saved);
> + slave_name = ptsname(master_fd); /* get name of slave */
> + slave_fd = open(slave_name, O_RDWR); /* open slave */
> + ioctl(slave_fd, I_PUSH, "ptem"); /* push ptem */
> + ioctl(slave_fd, I_PUSH, "ldterm"); /* push ldterm*/
> + ioctl(slave_fd, I_PUSH, "ttcompat"); /* push ttcompat*/
Again, that is a fragment that seems to apply to more systems than
just Solaris. It appears that atleast HP-UX has the same API, perhaps
other SysV systems have that as well.
On some of these other systems, ttcompat is not used, see
http://ou800doc.caldera.com/SDK_sysprog/_Pseudo-tty_Drivers_em_ptm_and_p.html
for an example. So I wonder whether it should be used by default -
especially since the Solaris man page says that it can be autopushed
as well.
Regards,
Martin