Mailing List Archive

Re: perl5 open(FH,"|bad") not reporting error?
Does anybody know whether the ptm/s grantpt/unlockpt/etc. stuff is a
standard outside Solaris? It seems like each person that writes a
package adds the caveat that it probably won't work on anything but
Solaris.

I've already got a message from someone using AIX saying that his machine
looks SVR4-ish (i.e. no /vmunix), but he seems to have no /dev/ptmx. (It's
inconclusive so far, since he hasn't replied with the tests I suggested,
but it's a bad sign.)

Please copy me directly, I'm not on the alias anymore.

Thanks,
-Eric


----- Begin Included Message -----


From: Tim Bunce <Tim.Bunce@ig.co.uk>
Newsgroups: comp.lang.perl.misc
Subject: Re: RELEASE: Term::Pty 0.1 for Solaris 2.4
Lines: 70
Sender: news@ig.co.uk
X-Nntp-Posting-Host: ig.co.uk
Organisation: Paul Ingram Group, Software Systems, +44 1 483 424424

In article <458q9o$i6h@ns.ccsn.edu>, Russell Mosemann <mose@ns.ccsn.edu> wrote:
> Tom Christiansen was quoted as saying:
> > > You should probably just give up on perl for expect stuff.
>
> Eric Arnold then states his case that it _can_ be done in Perl, and
> he backs it up with code! Later Eric makes the statement
>
> > The main problem being that Perl has no interface to ptm functions
> > like "grantpt" and "ptsname". Making a C linkable module seems
> > like overkill. Is there a POSIX standard for this, which could place
> > it in the POSIX module?
>
> > Perl5 does have a good socket module, which should be used, I guess,
> > but it doesn't have Streams stuff like "I_PUSH", etc. So, system
> > dependencies will still have to live in the Comm.pl package.
>
> Both of these are very good points. A few weeks back I was looking
> for code which would allow a perl script to talk to the passwd program.
> That's all I wanted it to do. chat2.pl wasn't up to the task on
> Solaris, and I couldn't find any other scripts. So, I set out to write
> my own. I ran into several problems along the way, but with help from
> perl people like you I was able to solve them.
> The result of my efforts is Term::Pty 0.1, a set of routines that are
> as faithful as possible to the man pages for ptm and pts for creating a
> pseudoterminal under Solaris 2.4. It includes a dynamic module for
> loading the grantpt, ptsname and unlockpt functions and making them
> available to a perl script.

Sigh. I don't suppose many people know the one about London Buses but
roughly paraphrased it goes something like "You wait for ages for a
Pty module to come along and then two turn up at once!"

I recently added this to the Module List (to be posted on the 10th):

5) Networking, Device Control (modems) and InterProcess Communication

Name DSLI Description Info
----------- ---- -------------------------------------------- -----
Ptty adcf Pseudo terminal interface functions NI-S +

NI-S Nick Ing-Simmons <nik@tiuk.ti.com>

(I've CC'd this to Nick).

It's a pity that you didn't announce the fact that you were working
on this either here or on perl5-porters so we could have avoided the
duplication of effort. Sigh.

> Term::Pty is not a Swiss army knife. It does only one thing and it
> does it well for what I want it to do.

It looks quite comprehensive.

> This code is not portable and only works under Solaris 2.4, that I know of.

I _think_ Nick's module has been tested on a copule of other platforms.

> I do not plan on developing Term::Pty any more. It works, and I have
> too many other things to do.

Okay. Can we agree then that Nick will 'own' the Pseudo Terminal
Interface pumpkin and consolidate your code into his if/where applicable?

Let's, at the very least, agree an interface to pty management.

> Russell Mosemann Concordia College Voice: (402) 643-7445
> Computing Center Seward, NE 68434 Fax: (402) 643-4073

Tim.


----- End Included Message -----
Re: perl5 open(FH,"|bad") not reporting error? [ In reply to ]
Re: perl5 open(FH,"|bad") not reporting error? [ In reply to ]
On Mon, 9 Oct 1995, Eric Arnold wrote:

>
> Does anybody know whether the ptm/s grantpt/unlockpt/etc. stuff is a
> standard outside Solaris? It seems like each person that writes a
> package adds the caveat that it probably won't work on anything but
> Solaris.
>
> I've already got a message from someone using AIX saying that his machine
> looks SVR4-ish (i.e. no /vmunix), but he seems to have no /dev/ptmx. (It's
> inconclusive so far, since he hasn't replied with the tests I suggested,
> but it's a bad sign.)
>
> Please copy me directly, I'm not on the alias anymore.

I can assure you they aren't present on Linux and many other systems. Dig
up Expect if you want to see how someone has dealt with this.

> Thanks,
> -Eric

--
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)
Re: perl5 open(FH,"|bad") not reporting error? [ In reply to ]
In <Pine.LNX.3.91.951009212914.142H-100000@kjahds.com>
On Mon, 9 Oct 1995 21:29:58 -0400 (EDT)
Kenneth Albanowski <kjahds@kjahds.com> writes:
>On Mon, 9 Oct 1995, Eric Arnold wrote:
>
>>
>> Does anybody know whether the ptm/s grantpt/unlockpt/etc. stuff is a
>> standard outside Solaris? It seems like each person that writes a
>> package adds the caveat that it probably won't work on anything but
>> Solaris.
>>
>
>I can assure you they aren't present on Linux and many other systems. Dig
>up Expect if you want to see how someone has dealt with this.
>
Expect is one of several, there is also the 'screen' package, something
called 'pty-4.0', emacs, splitvt, xterm, xview's cmdtool etc. etc.

My Ptty used screen - simply because I understood its 'configure' rather
than for any technical reasons.

I would gladly relinquish ownership of this - perl/Tk is more than enough
really and I would rather expend any spare effort on fixing tied arrays
or assisting with sfio
Re[2]: perl5 open(FH,"|bad") not reporting error? [ In reply to ]
eric@m-e-ir1.Corp.Sun.COM (Eric Arnold) wrote:
]
] Does anybody know whether the ptm/s grantpt/unlockpt/etc. stuff is a
] standard outside Solaris? It seems like each person that writes a
] package adds the caveat that it probably won't work on anything but
] Solaris.
]
] I've already got a message from someone using AIX saying that his machine
] looks SVR4-ish (i.e. no /vmunix), but he seems to have no /dev/ptmx. (It's
] inconclusive so far, since he hasn't replied with the tests I suggested,
] but it's a bad sign.)
]
] Please copy me directly, I'm not on the alias anymore.
]
] Thanks,
] -Eric

The "ptm" style pseudo-ttys are STREAMS-driver based, and I belive they
exist on all true SVR4 systems (which should use streams drivers by default).
I'm not an AIX user, but at a trade show an IBM rep told me that they
never licensed SVR4, and have only implemented certain interfaces in
order to claim compatability. If so, their kernel is a Frankenstein and,
naturally, doesn't come with the standard SVR4 drivers.

FYI, /dev/ptmx is the "clone" driver for the master side driver (ptm).
This uses a generic STREAMS-driver mechanism which dynamically allocates
unused minor numbers on demand without requiring a separate device file for
each. In this case, opening /dev/ptmx returns a file descriptor to a
newly-allocated minor number of the master driver (ptm). The process can
then do fstat() to determine which minor it got, and open the corresponding
slave-side device file (the slave files normally pre-exist).

-Jim Avera
avera@hal.com
Re: Re[2]: perl5 open(FH,"|bad") not reporting error? [ In reply to ]
>The "ptm" style pseudo-ttys are STREAMS-driver based, and I belive they
>exist on all true SVR4 systems (which should use streams drivers by default).

It is certainly true that Harris' Power UNIX OS (which is mostly SVR4) uses
the "ptm" style of ptys. To grab a pty, I need to open /dev/ptmx, push a
batch of streams drivers on it, call ptsname() to find the slave, call
grantpt to get access to it, etc. I don't know if this is all exactly like
Solaris, but it sounds close.

--
Tom.Horsley@mail.hcsc.com
Home: 511 Kingbird Circle Delray Beach FL 33444
Work: Harris Computers, 2101 W. Cypress Creek Rd. Ft. Lauderdale FL 33309
Support Project Vote Smart! They need your support in non-election years too!
(email pvs@neu.edu, 1-800-622-SMART, http://www.vote-smart.org)
Re: Re[2]: perl5 open(FH,"|bad") not reporting error? [ In reply to ]
In <9510111854.AA23963@amber.ssd.csd.harris.com>
On Wed, 11 Oct 95 14:54:15 -0400
Tom Horsley <Tom.Horsley@hawk.hcsc.com> writes:
>>The "ptm" style pseudo-ttys are STREAMS-driver based, and I belive they
>>exist on all true SVR4 systems (which should use streams drivers by default).
>
>It is certainly true that Harris' Power UNIX OS (which is mostly SVR4) uses
>the "ptm" style of ptys. To grab a pty, I need to open /dev/ptmx, push a
>batch of streams drivers on it, call ptsname() to find the slave, call
>grantpt to get access to it, etc. I don't know if this is all exactly like
>Solaris, but it sounds close.

Have you tried Ptty?