* grantpt() fails after repeated operations
@ 1998-06-04 4:00 Dean J.
1998-06-05 4:00 ` David S. Goldberg
1998-06-05 4:00 ` Serguei Patchkovskii
0 siblings, 2 replies; 3+ messages in thread
From: Dean J. @ 1998-06-04 4:00 UTC (permalink / raw)
PROBLEM/ BACKGROUND:
I'm trying to establish a pseudo-tty slave driver which runs ftp as a
child process, allowing me to write ftp commands and read replies (I
know expect does this, but ...)
The code does pretty much everything that's outlined in the book
"Advanced Programming in the Unix Environment".
Specifically, it does the following key processing:
1) opens master -/dev/ptmx
2) grantpt
3) unlockpt
4) opens slave, after getting ptsname
5) pushes modules ptem and ldterm
... it goes on to exec the ftp program and I proceed to write ftp
commands and read RFC959 (ftp standard) replies from the associated
stream.
One of my specific requirements is to establish a PTY/ftp child
regularly, once every hour, send my files (put etc.) and tear down the
PTY and go dormant. Its supposed to do this theoretically for ever, i.e.
on the hour every hour establish a PTY and send the files, then
de-establish the PTY et sequentia.
My problem is that I can only perform about 500 (it varies) such
iterations until grantpt specifically starts to fail. The errno is
pretty whacked, i.e. looks like its not getting set. BTW environment is
Digital 4.0D. Importantly, for testing purposes, I am cutting down the
test time iterations from one hour send intervals to 60 second send
intervals, so I can achieve 'endurance testing/longevity testing.' in
much less time.
QUESTIONS: Finally, here are my questions:
** What could be causing grantpt() to fail after its successful for
hundreds of times (i.e. return -1)?
** Could it be that basically doing the above every 60 seconds causes
some drain on the system to the point of failure? If I waited every hour
(as intended in the final implementation, would the associated resources
look after themselves or be looked after by some other process/system
daemon?
** Is there some cleanup processing I can do/should be doing to free up
the associated /dev/ptmx - /dev/pts/N resources et al?
** Could the problem lie elsewhere?
** Does anybody have any similar experiences?
Any contributions, greatly appreciated, in fact, if you live in the
Boston area, I'll give you a six pack of fine beer in appreciation (my
home brew ;-) )
Dean
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: grantpt() fails after repeated operations
1998-06-04 4:00 grantpt() fails after repeated operations Dean J.
@ 1998-06-05 4:00 ` David S. Goldberg
1998-06-05 4:00 ` Serguei Patchkovskii
1 sibling, 0 replies; 3+ messages in thread
From: David S. Goldberg @ 1998-06-05 4:00 UTC (permalink / raw)
> PROBLEM/ BACKGROUND: I'm trying to establish a pseudo-tty slave
> driver which runs ftp as a child process, allowing me to write ftp
> commands and read replies (I know expect does this, but ...)
[... grantpt starts failing]
Do you have a SIGCHLD handler set for dealing with your sub process?
If so, recall that grantpt calls an external program (at least it does
on SYSVR4 -- I assume the same on your system, but don't know for
sure) which will cause your handler to be run when that exits. If
your handler does anything besides reaping the child process, it may
screw up grantpt's wait for it's child and cause a failure. When this
happened to me it happened almost all the time, but it did work
occasionally until I figured it out (truss is a wonderful tool...) so
it's possible you're being similarly bit.
--
Dave Goldberg
Post: The Mitre Corporation\MS B305\202 Burlington Rd.\Bedford, MA 01730
Phone: 781-271-3887
Email: dsg@mitre.org
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: grantpt() fails after repeated operations
1998-06-04 4:00 grantpt() fails after repeated operations Dean J.
1998-06-05 4:00 ` David S. Goldberg
@ 1998-06-05 4:00 ` Serguei Patchkovskii
1 sibling, 0 replies; 3+ messages in thread
From: Serguei Patchkovskii @ 1998-06-05 4:00 UTC (permalink / raw)
Dean J. (jackmand@nospam.com) wrote:
: PROBLEM/ BACKGROUND:
: I'm trying to establish a pseudo-tty slave driver which runs ftp as a
: child process, allowing me to write ftp commands and read replies (I
: know expect does this, but ...)
FTP is a fairly simple protocol. It is probably easier to implement
a minimal FTP client than to deal with a command line ftp client
through the pty interface, especially if you do not want the fancier
parts of the protocol. The number of error conditions you'll have to
deal with, portability, and system load generated by your application
also look much brighter in this case.
Cheers,
/Serge.P
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1998-06-05 4:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-06-04 4:00 grantpt() fails after repeated operations Dean J.
1998-06-05 4:00 ` David S. Goldberg
1998-06-05 4:00 ` Serguei Patchkovskii
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox