bind '#c' /dev /dev/cons /dev/consctl /dev/keyboard /dev/memory /dev/pin /dev/pointer /dev/random /dev/sysname /dev/time /dev/user
A control-U, ^U, typed at the keyboard kills the current input line (removes all characters from the buffer of characters not yet read via cons).|
A backspace erases the previous non-kill, non-erase character from the input buffer. Killing and erasing only delete characters back to, but not including, the last newline.|
Typed keystrokes produce 16-bit characters that are translated into the variable-length UTF encoding (see UTF, Unicode, ASCII - character set and format in Chapter A) before putting them into the buffer. A read, write, stream - read, write, or stream file in Chapter 8 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.
The behavior of the keyboard input can be changed by writing certain control strings to the consctl file.
If the string rawon has been written to the consctl file and the file is still open, cons is in raw mode with the following attributes:
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.
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.
The random device returns as many bytes of random data as are requested in the read.
The rest of the files contain (mostly) read-only strings. Each string has a fixed length: a read of more than that gives a result of that fixed length (the result does not include a terminating zero byte); a read of less than that length leaves the file offset so the rest of the string (but no more) will be read the next time. To reread the file without closing it, the system module seek call must be used to reset the offset.
The sysname file holds the text name of the machine. No privilege is needed to write to this file.
The user file contains the name of the user associated with the current process group.
The memory file returns a formatted presentation of the state of the memory allocation pools in the system. Each line of output returned reports the following parameters for a single pool:
prints data about kernel processes|
prints the kernel stack|
prints data about memory allocation|
reboots the system|
These sequences have no special meaning when running the emulator (emu).
UTF, Unicode, ASCII - character set and format in Chapter A