Re: devfs v136, ZIP disks and glibc-2.1.2

Richard Gooch (rgooch@ras.ucalgary.ca)
Mon, 8 Nov 1999 11:22:05 -0700


Zack Weinberg writes:
> Richard Gooch wrote:
> > But I still favour the speculative open method (get a master, then try
> > and open the slave in /dev/pts, if it fails, set a flag). It's robust
> > and allows alternative implementations of /dev/pts (such as a daemon).
> > Why don't you implement it this way?
>
> The API does not permit this implementation. The Unix98 way to get a
> pty is
>
> mfd = open("/dev/ptmx", O_RDWR);
> grantpt(mfd);
> unlockpt(mfd);
> sfd = open(ptsname(mfd), O_RDWR);
[...]
> You cannot look for the slave inside getpt() because it may not exist
> at that point. devptsfs creates slaves when someone opens them
> successfully. But until unlockpt() is called, no one, not even root,
> can open the slave.
>
> Even if we could know at getpt() time whether the Unix98 slave
> existed, we would still need to know if devfs or devptsfs were in
> use. If neither one is in use, grantpt() has to run a setuid helper
> program that resets the permissions of the slave. We don't want to do
> that if it can be avoided, since it is an expensive and dangerous
> operation.

I see. Bugger. It just seems rather hackish to depend on knowledge of
mounted filesystems for this sort of thing.

Regards,

Richard....
Permanent: rgooch@atnf.csiro.au
Current: rgooch@ras.ucalgary.ca

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/