lkml.org 
[lkml]   [1998]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: dynamic pty driver...
On Thu, Mar 19, 1998 at 02:31:34PM -0500, Greg Alexander wrote:
> I'm working on a dynamic pty driver. The purpose being to allow the
> creation of ptys by normal users (no more suid root screen!) and to allow
> the creation of an almost unlimited number of ptys without wasting a bunch
> of RAM for huge arrays on small systems or trying to switch to 16-bit minors
> or anything like that. The ptys would not have associated files/devices and
> they'd be made using a syscall similar to pipe() (should I make a new
> syscall or just an ioctl()?). Another possibility would be to add another
> filetype for mknod(), S_IFPTY that normal users could create, but this
> doesn't seem reasonable to me and I am unlikely to bother to implement it.
> It would be trivial to modify rxvt, screen, etc. to use these instead of
> /dev/pty* and /dev/tty[p-za-e]?.
>
> It looks like the best way to do this is to make a different
> tty_driver struct for every pty. I'm not sure what major/minor to give
> them...I was thinking I could probably just make all of them 5,0 (/dev/tty),
> but this would cause ps to see 5,0 as the tty device in /proc/<pid>/stat so
> it would list all processes on dptys as being run on /dev/tty...not the most
> useful solution. I was also considering possibly not adding the tty_driver
> structs to the actual tty_driver linked list. All the tables would be
> dynamically allocated with the tty_driver struct and would be created with
> only one entry.
>
> I was just wondering if anyone had any comments, suggestions, etc.,
> before I go implementing (I haven't done much deep kernel hacking in the
> past and the whole tty layout is just now beginning to somewhat make a
> little sense).
>
> FYI, this idea is not my own but was suggested to me by Alan Cox (I
> think...it's been a while).
>

I have a suggestion :-)

If I remember correctly, the /dev/ptmx device is used to allocate a
new tty without having to try all the pty* devices in succession. The
semantics of /dev/ptmx doesn't deal with opening the device as
non-root but it is basically just making things faster for login and
others.

Now, what we want is a /dev/ptmx which normal users can open as
well. This could be accomplished by setting ownership when opening
/dev/ptmx if the calling process is not root. This would be a simple
extension of the current semantics. For programs that used /dev/ptmx
already (not many on linux I know..) you can start running it as
non-root. No code needs to be changed.

astor

--
Alexander Kjeldaas, Guardian Networks AS, Trondheim, Norway
http://www.guardian.no/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:41    [from the cache]
©2003-2011 Jasper Spaans