pty - Introduce unix98 ptys
authorAlex Hornung <ahornung@gmail.com>
Tue, 1 Sep 2009 13:00:15 +0000 (14:00 +0100)
committerAlex Hornung <ahornung@gmail.com>
Tue, 1 Sep 2009 15:26:03 +0000 (16:26 +0100)
commitc578a286621a95cbcd28c62f7583d70c9bc908b5
tree16921ef94c1a22830fc496d770e2597533c9c5f3
parent2ebd9196c86c8a3aceace6f69944193723a4a2ac
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.
include/stdlib.h
lib/libc/gen/Makefile.inc
lib/libc/gen/ptsname.c [new file with mode: 0644]
sys/kern/tty_pty.c
sys/sys/ttycom.h