NAME
consolefs, C, clog – file system for console access

SYNOPSIS
aux/consolefs [ –m mntpt ] [ –c consoledb ]

C system

aux/clog console log system

DESCRIPTION
To ease administration of multiple machines one might attach many serial console lines to a single computer. Consolefs is a file system that lets multiple users simultaneously access these console lines. The consoles and permissions to access them are defined in the file consoledb (default /lib/ndb/consoledb). The format of consoledb is the same as that of other /lib/ndb files, ndb(6). Consoles are defined by entries of the form:

console=dirty dev=/dev/eia205
uid=bignose
gid=support
speed=56200
cronly=

Each console/dev pair represents the name of a console and the device associated with it. Consolefs presents a single level directory with up to three files per console: console, consolectl, and consolestat. Writes of console are equivalent to writes of dev and reads and writes of consolectl and consolestat are equivalent to reads and writes of devctl and devstat respectively. Consolectl and consolestat will not exist if the underlying dev does not provide them. Consolefs broadcasts anything it reads from dev to all readers of console. Therefore, many users can con(1) to a console, see all output, and enter commands.

The cronly= attribute causes newlines typed by the user to be sent to the console as returns. The speed=x attribute/value pair specifies a bit rate for the console. The default is 9600 baud. The openondemand= attribute causes the console device (dev) to be opened only when the corresponding mntpt/console file is open.

Access to the console is controlled by the uid and gid attributes/value pairs. The uid values are user account names. The gid values are the names of groups defined in consolefs by entries of the form:

group=support
uid=bob
uid=carol
uid=ted
uid=alice

Groups are used to avoid excessive typing. Using gid=x is equivalent to including a uid=y for each user y that is a member of x.

To keep users from inadvertently interfering with one another, notification is broadcast to all readers whenever a user opens or closes name. For example, if user boris opens a console that users vlad and barney have already opened, all will read the message:

[+boris, vlad, barney]

If vlad then closes, boris and barney will read:

[–vlad, boris, barney]

Consolefs posts the client end of its 9P channel in /srv/consolefs and mounts this locally in mntpt (default /mnt/consoles); remote clients must mount (see bind(1)) this file to see the consoles.

The rc(1) script C automates this procedure. It uses import(4) to connect to /mnt/consoles on the machine connected to all the consoles, then uses con(1) to connect to the console of the machine system. The script must be edited at installation by the local administration to identify the system that holds /mnt/consoles.

Aux/clog opens the file console and writes every line read from it, prefixed by the ASCII time to the file log.

An example of 2 consoles complete with console logging is:
% cat /lib/ndb/consoledb
group=sys
uid=glenda
console=bootes dev=/dev/eia0 gid=sys
console=fornax dev=/dev/eia1 gid=sys
% aux/consolefs
% ls –p /mnt/consoles
bootes
bootesctl
fornax
fornaxctl
% clog /mnt/consoles/fornax /sys/log/fornax &
% clog /mnt/consoles/bootes /sys/log/bootes &

The console server's default name space must mount the consoles for C to import. This can be arranged by adding
mount /srv/consoles /mnt/consoles

to /lib/namespace.$sysname.

FILES
/srv/consoles        Client end of pipe to server.
/mnt/consoles        Default mount point.
/lib/ndb/consoledb   Default user database.

SOURCE
/sys/src/cmd/aux/consolefs.c
/rc/bin/C
/sys/src/cmd/aux/clog.c

BUGS

Changing the gid's or uid's while consolefs is running is detected by consolefs. However, to add new consoles one must restart consolefs.
Copyright © 2024 Alcatel-Lucent. All rights reserved.