From Scott R. Every on 21 Sep 1998
i have a system which has been running for a while(actually a number of systems) after a bit the ttyp0 port is no longer available when telnetting in. it doesn't list anywhere as being used, but it doesn't work!
can you offer any suggestions?
Try the 'lsof' command. That should find out which process is using it.
The /dev/ttyp* devices are for "psuedo" tty's --- these are used by rlogind, telnetd, xterms, screen and many other programs. There are usually many of these psuedo tty's on a system.
Normally a daemon that uses a psuedo tty searches through the list and uses the first one that it can open. There is another approach used by some other forms of Unix --- and supported in recent kernel whereby the daemon makes a request of a sort of "dispatcher" device which then provide it with the number of the next available pty/ttyp device. This is referred to as "Unix '98 PTYs Support" in the linux kernel -- and I've heard it referred to as "ptmx" (psudo-tty multiplexing, or something like that). In the case of the Linux implementation the pty's can be dynamically generated under the "pts" virtual filesystem (which is a bit like the /proc filesystem in that it doesn't exist on a "disk" anywhere --- it simply provides a filesystem abstraction of the system's in memory data structures). Linux 2.2 will also probably support a "/devfs" --- another virtual filesystem which makes all of the entries under /dev into dynamic entries.
Of course, none of that applies to your situation. That's just the "vaporware report" on the future of the Linux kernel.
If there really is no process that still owns the ttyp0 in your case then it might be a bug in your kernel. I'd check the permissions of the device node to see if they are changing (or to see if there is something that's just blowing the device node away), then I'd look through the "Change Logs" for the recent 2.0.3x kernels. It might be that you are bumping into one of the bugs that Alan Cox and crew have been fixing. If you aren't running a 2.0.35 or 2.0.36 kernel --- consider trying it to see if that solves the problem.
To be honest I haven't seen a good description of the whole pty*/ttyp* mess or a decent explanation of what problems the Unix '98 ptmx design is supposed to solve. I've heard that pty's and ttyp's are paired off in "master/slave" pairs that have something to do with providing different device nodes for control (ioctl()?) and communications over the channel. If any of our readership knows of a good treatise on the topic, please pass me a pointer or mail me a copy.