git: pty - Introduce unix98 ptys

Alex Hornung alexh at crater.dragonflybsd.org
Tue Sep 1 08:07:50 PDT 2009


commit c578a286621a95cbcd28c62f7583d70c9bc908b5
Author: Alex Hornung <ahornung at gmail.com>
Date:   Tue Sep 1 14:00:15 2009 +0100

    pty - Introduce unix98 ptys
    
    * Add the clone base device, /dev/ptmx.
    
    * Add TIOCISPTMASTER ioctl, which returns successfully if the
      device is a unix98 pty master.
    
    * Add sysctl kern.pty_debug, default to 0, to control pty debug
      info printing.
    
    * Remove old unix98 pty code, which was inactive and inherited
      from an initial implementation during devfs development.
    
    * Add userland functions:
      - posix_openpt (is equivalent to opening /dev/ptmx)
      - ptsname (as described in standard but thread-safe)
      - unlockpt (no op)
      - grantpt (no op)
    
    * Implement proper permissions for unix98 pty slaves.
      Set them to real uid - group "tty" - 0620 for
      the slave device, as specified in standard (for grantpt).
      Master's permissions don't matter as the device cannot be opened
      again.
      Set the permissions of the unix98 ptys to be overridable by
      setattr() as the old ptys are.
    
    * Use the define UNIX98_PTYS to activate/deactivate the unix98
      pty code in tty_pty.c. By default it is enabled.
    
    NOTE: due to the permission handling on cloning of the slave
          pty, grantpt is not needed and would only pose a security
          risk.

Summary of changes:
 include/stdlib.h                       |    8 +-
 lib/libc/gen/Makefile.inc              |    2 +-
 lib/libc/gen/{fdevname.c => ptsname.c} |   87 +++++++++------
 sys/kern/tty_pty.c                     |  186 ++++++++++++++++++++++++--------
 sys/sys/ttycom.h                       |    1 +
 5 files changed, 202 insertions(+), 82 deletions(-)
 copy lib/libc/gen/{fdevname.c => ptsname.c} (67%)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/c578a286621a95cbcd28c62f7583d70c9bc908b5


-- 
DragonFly BSD source repository





More information about the Commits mailing list