This package contains a collection of utilities for dynamic virtual consoles.
Kernel version 1.1.54 or higher is required.

cspawnd: daemon to dynamically start new gettys on demand
close:	 de-allocates memory for unused vc's

This package also includes open-1.3 by Jon Tombs.  Please see the files in
open-1.3 for more information.  I have included them here with the permission
of the author in an effort to keep all of these things in the same place.
Jon has told me that he does not plan to develop these programs further.
I have made some enhancements to them, so you can send bug reports to me.
The programs in open-1.3 are:

open:	  starts a new VC running a specified command
switchto: switches to a new VC from the command line

Before you compile these, please edit the definitions in the top level
Makefile and config.h to suit your system.  Especially important is the
EXEC_GETTY definition in config.h.  See below for information.

Makefile targets:

all:	 builds all programs
install: installs binaries and manpages
setuid:	 installs set[ug]id. Please see note below.
clean, realclean:	cleans up

Send questions, comments, bug reports, etc., to me:

todd j. derr <tjd@haven.zets.org>

--------------------------------------------------------------------------
NOTE on installing setuid: (please read!!!)

First, a word about ttys.  Normally, your console tty's should all be mode
620 and owned by group 'tty'.  This allows programs like 'write' (and these
programs) to function properly.  /dev/console is an alias for the current
VC and should also be mode 620, group tty.  /dev/tty is an alias for the
current tty and should be mode 666.  This package assumes your ttys are
set up this way.  If your ttys are owned by a different group than 'tty',
you can change the TTY variable in the top-level Makefile.  'open' and
'cspawnd' try to enforce this policy if possible.  If you don't want this
to happen, comment out the definition of TTYDEFS in the Makefile.

A 'console user' is defined here as someone for whom '/dev/tty' is associated
with a VC, which should mean that that user is on the console.

Normally, 'close' and 'switchto' can be used by any 'console user' without
having to be setuid or setgid to anything.

Making 'switchto' set[ug]id is probably never a good idea, since it would
allow any user to wreak havoc on the 'console user'.  Thus, even if you
'make setuid', 'switchto' is installed normally (mode 711).

However, installing 'close' set[ug]id is not really harmful (it will only
close VC's that aren't being used for anything), so making setuid installs
'close' sgid to the TTY group.  Whether this is useful is another matter,
but it won't hurt.

'open' presents a different problem.  When you open a tty, it is desirable
that the ownership of the tty be changed to your uid for security.
However, 'open' must be running as root to accomplish this.  If you
'make setuid', open is installed as root.  It will still check to make
sure that the user is a 'console user', and will drop all of it's permissions
before running the user's command.  It will also try to chown() the tty back
to it's original owner if '-w' (wait) is specified.

'cspawnd' may only be run as root, usually as a daemon from rc.local.
--------------------------------------------------------------------------

cspawnd: daemon to dynamically start new gettys on demand

This program catches the signals produced by the Spawn_Console key and
starts new gettys (login prompts) on demand, thus saving memory (about
4K per VC for 80x25), and obviating the need to have a getty process
constantly running on every VC you ever want to use (you can have up to
63 consoles, on demand, in linux 1.1.54 or greater).

It is designed to be started as a daemon at system boot, probably from
your rc.local script.  You might add something like the following:

[ -x /sbin/cspawnd ] && /sbin/cspawnd # start dynamic console daemon

You'll also need to bind the Spawn_Console function to a key.  This
requires 'loadkeys' from the 'kbd' package.  The following command will
bind Spawn_Console to Alt-UpArrow:

echo "alt keycode 103=Spawn_Console" | /usr/bin/loadkeys

Now, pressing Alt-UpArrow will start a new getty whenever you need one.
This means that you can remove most of the getty commands from your
/etc/inittab file.  You should probably let init run a getty on VC1
(/dev/tty1) just to be safe, but comment out the other getty lines.

The daemon will also try to clean up unused VC's.  Every 10 minutes,
or whenever a process it has started exits, the daemon will wake up
and try to deallocate unused VC's.  This can be changed in config.h.

Speaking of config.h, hopefully you edited it beforehand to tell the
daemon how to start your version of getty.  The line:

#define EXEC_GETTY execl("/sbin/getty","getty",shortvtname,"VC","console",NULL)

is the important one.  If you don't understand what to do with this, this is
the place to look.  What you need to change is the stuff in the parentheses.
To do this, you need to know how your getty command wants to be called,
either by looking at the manpage, or in your /etc/inittab file.  The default
corresponds to the command:

/sbin/getty tty# VC console

where '#' is replaced by the actual VC that has just been allocated.
If your command is different than this, you'll have to modify the
EXEC_GETTY definition.  The first string should be the full path to
your getty program, the second should be either the full path or just
the command name (NOT the first argument to getty), and the remaining
arguments should all be quoted strings seperated by commas, with NULL
at the end.  The variable 'shortvtname' will give you 'tty#' and 'vtname'
will give you '/dev/tty#'.  If you need to use this, don't quote them.

--------------------------------------------------------------------------
close:	 de-allocates memory for unused vc's

The inverse of open; you can use it to close a VC you're not using anymore.
Specifying -v will make it verbose.  You can either list VC's that you want
to close (seperated by spaces), or omit the list, which makes close
deallocate all unused VCs.
