From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fc89c,743d205366114387,start X-Google-Attributes: gidfc89c,public X-Google-Thread: fee84,743d205366114387,start X-Google-Attributes: gidfee84,public From: "Dean J." Subject: grantpt() fails after repeated operations Date: 1998/06/04 Message-ID: <3576D202.6570@nospam.com>#1/1 X-Deja-AN: 359557156 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: oops Newsgroups: comp.unix.programmer,comp.unix.osf.osf1 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