cons — Inferno 1.1ed
cons
Synopsis
bind '#c' /dev /dev/cons /dev/consctl /dev/keyboard /dev/memory /dev/pin /dev/pointer /dev/random /dev/sysname /dev/time /dev/user
Description
cons (read-write)
The console device serves a one-level directory giving access to the console and miscellaneous information.Reading the cons file returns characters typed on the keyboard. Normally, characters are buffered until a newline ('\n') is entered to enable erase and kill processing via special characters:
Typed keystrokes produce 16-bit characters that are translated into the variable-length UTF encoding (see utf) before putting them into the buffer. A read of length greater than zero causes the process to wait until a newline or a ^D ends the buffer, and then returns as much of the buffer as the argument to read allows, but only up to one complete line.
A terminating ^D is not put into the buffer. The next read will return immediately with unread bytes typed since the last newline but before the ^D. Thus, a ^D entered at the start of a line will cause a read system call to return 0 bytes, the equivalent of reading at the end of a file.
consctl (write-only)
The behavior of the keyboard input can be changed by writing certain control strings to the consctl file. "rawon"
If the string "rawon" has been written to the consctl file and the file is still open, cons is in "raw mode". That is:
- Characters are not echoed as they are typed.
- Backspace and ^D are not treated specially.
- Characters are available to read as soon as they are typed.
"rawoff"
Ordinary mode is reentered when "rawoff" is written to consctl or this file is closed.
keyboard (read-only)
The keyboard file returns the underlying tokens produced by the keyboard hardware as they are produced; in the emulation environment, it is like an always-raw mode cons file.
null (read-write)
The null file throws away anything written to it and always returns zero bytes when read.
pointer (read-only)
A read of the pointer file returns the status of the mouse or other pointing device: its position and button state. The read blocks until the state has changed since the last read. The read returns an m character followed by three integers in the standard Inferno 12-character decimal format. See Limbo Modules - Miscellaneous .
The integers are the device's coordinates on the screen (x and y) and a bit mask with the 1, 2, and 4 bits set when the pointer's left, middle, and right buttons, respectively, are down.
pin (read-write*)
The pin file, when read, returns either the string "no pin" if no PIN has been set for authentication, or "pin set", if one has. The pin file may be written once per process group with a decimal representation of the PIN to use on this Inferno machine. random (read-only)
The random device returns as many bytes of random data as are requested in the read.
When the file contains numeric data, each number is formatted in decimal as an 11-digit number with leading blanks and one trailing blank: twelve bytes total. There is no trailing newline character.
sysname (read-write)
The sysname file holds the text name of the machine. No privilege is needed to write to this file. user (read-write*)
The user file contains the name of the user associated with the current process group. memory (read-only)
The memory file returns a formatted presentation of the state of the memory allocation pools in the system. Each line of output returned reports, for a single pool:
- amount of memory in use
- upper size limit
- number of allocations done
- number of frees done
- number of extensions done
- name of the pool
time (read-write)
Reading the time file obtains in decimal format ("%.lld") number of microseconds since the epoch 00:00:00 GMT, Jan. 1, 1970.This `clock' can be reset by writing the desired time value (in decimal format) to the time file.
See Also
utf
Notes
|
^T^Tp
|
prints data about kernel processes
|
|
^T^Ts
|
prints the kernel stack
|
|
^T^Tx
|
prints data about memory allocation
|
|
^T^Tr
|
reboots the system
|
These sequences have no special meaning when running the emulator (emu).
infernosupport@lucent.com Copyright © 1996,Lucent Technologies, Inc. All rights reserved.