lkml.org 
[lkml]   [1999]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: devfs v136, ZIP disks and glibc-2.1.2
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/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.089 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site