minix/lib/libc/stdlib
David van Moolenbroek da21d85025 Add PTYFS, Unix98 pseudo terminal support
This patch adds support for Unix98 pseudo terminals, that is,
posix_openpt(3), grantpt(3), unlockpt(3), /dev/ptmx, and /dev/pts/.
The latter is implemented with a new pseudo file system, PTYFS.

In effect, this patch adds secure support for unprivileged pseudo
terminal allocation, allowing programs such as tmux(1) to be used by
non-root users as well.  Test77 has been extended with new tests, and
no longer needs to run as root.

The new functionality is optional.  To revert to the old behavior,
remove the "ptyfs" entry from /etc/fstab.

Technical nodes:

o The reason for not implementing the NetBSD /dev/ptm approach is that
  implementing the corresponding ioctl (TIOCPTMGET) would require
  adding a number of extremely hairy exceptions to VFS, including the
  PTY driver having to create new file descriptors for its own device
  nodes.

o PTYFS is required for Unix98 PTYs in order to avoid that the PTY
  driver has to be aware of old-style PTY naming schemes and even has
  to call chmod(2) on a disk-backed file system.  PTY cannot be its
  own PTYFS since a character driver may currently not also be a file
  system.  However, PTYFS may be subsumed into a DEVFS in the future.

o The Unix98 PTY behavior differs somewhat from NetBSD's, in that
  slave nodes are created on ptyfs only upon the first call to
  grantpt(3).  This approach obviates the need to revoke access as
  part of the grantpt(3) call.

o Shutting down PTY may leave slave nodes on PTYFS, but once PTY is
  restarted, these leftover slave nodes will be removed before they
  create a security risk.  Unmounting PTYFS will make existing PTY
  slaves permanently unavailable, and absence of PTYFS will block
  allocation of new Unix98 PTYs until PTYFS is (re)mounted.

Change-Id: I822b43ba32707c8815fd0f7d5bb7a438f51421c1
2015-06-23 17:43:46 +00:00
..
_env.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
_rand48.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
a64l.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
a64l.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
abort.3 Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
abort.c Fix signal handling for services on abort/exit 2013-03-07 13:11:31 +01:00
abs.3 Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
abs.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
alloca.3 Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
at_quick_exit.3 Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
atexit.3 Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
atexit.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
atexit.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
atof.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
atof.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
atoi.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
atoi.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
atol.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
atol.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
atoll.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
atoll.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
bsearch.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
bsearch.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
div.3 Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
div.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
drand48.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
erand48.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
erand48_ieee754.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
exit.3 Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
exit.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
getenv.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
getenv.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
getopt.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
getopt.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
getopt_long.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
getopt_long.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
getsubopt.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
getsubopt.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
grantpt.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
hcreate.3 Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
hcreate.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
imaxabs.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
imaxdiv.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
insque.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
insque.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
jemalloc.3 Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
jemalloc.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
jrand48.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
l64a.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
labs.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
lcong48.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
ldiv.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
Lint_abs.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
Lint_div.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
Lint_imaxabs.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
Lint_labs.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
Lint_ldiv.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
Lint_llabs.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
llabs.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
lldiv.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
local.h Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
lrand48.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
lsearch.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
lsearch.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
Makefile.inc Add PTYFS, Unix98 pseudo terminal support 2015-06-23 17:43:46 +00:00
malloc.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
malloc.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
memory.3 Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
merge.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
mi_vector_hash.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
mi_vector_hash.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
mrand48.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
nrand48.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
posix_memalign.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
posix_openpt.3 Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
posix_openpt.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
ptsname.3 Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
pty.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
putenv.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
qabs.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
qabs.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
qdiv.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
qdiv.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
qsort.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
qsort.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
quick_exit.3 Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
quick_exit.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
radixsort.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
radixsort.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
rand.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
rand.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
rand48.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
rand48.h Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
rand_r.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
random.3 Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
remque.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
seed48.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
setenv.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
srand48.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
strfmon.3 Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
strfmon.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
strsuftoll.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
strsuftoll.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
strtod.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
strtoimax.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
strtol.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
strtol.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
strtoq.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
strtoul.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
strtouq.c Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
system.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
system.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
tdelete.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
tfind.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
tsearch.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
tsearch.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
twalk.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
unlockpt.3 Full switch to clang/ELF. Drop ack. Simplify. 2012-02-14 14:52:02 +01:00
unsetenv.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00