Index: trunk/minix/man/man4/console.4
===================================================================
--- trunk/minix/man/man4/console.4	(revision 9)
+++ 	(revision )
@@ -1,268 +1,0 @@
-.TH CONSOLE 4
-.SH NAME
-console, keyboard, log \- system console
-.SH DESCRIPTION
-The TTY device driver manages two devices related to the main user
-interface, the system screen and the keyboard.  These two together are
-named "the Console".
-.SS "The Screen"
-The screen of a PC can be managed by a Monochrome Display Adapter, a
-Hercules card, a Color Graphics Adapter, an Enhanced Graphics Adapter,
-or a Video Graphics Array.  To the console driver these devices are
-seen as a block of video memory into which characters can be written to
-be displayed, an I/O register that sets the video memory origin to the
-character that is to be displayed on the top-left position of the
-screen, and an I/O register that sets the position of the hardware
-cursor.  Each character within video memory is a two-byte word.  The low
-byte is the character code, and the high byte is the "attribute byte",
-a set of bits that controls the way the character is displayed,
-character and background colours for a colour card, or
-intensity/underline/reverse video for monochrome.
-.PP
-These are the characteristics of the adapters in text mode:
-.PP
-.RS
-.nf
-.ta +15n +15n
-Adapter	Usable memory	Mono/Colour
-.ta +1n +15n +15n
-	MDA	4K	M
-	Hercules	4K	M
-	CGA	16K	C
-	EGA	32K	M or C
-	VGA	32K	M or C
-.fi
-.RE
-.PP
-MDA and Hercules are the same to the console driver, because the graphics
-mode of the Hercules is of no use to MINIX 3.  EGA and VGA are also mostly
-seen as the same in text mode.  An EGA adapter is either a monochrome or a
-colour device depending on the screen attached to it.  A VGA adapter can run
-in either monochrome or colour (grayscale) mode depending on how the Boot
-Monitor has initialized it.
-.PP
-The driver uses the video origin to avoid copying the screen contents when
-scrolling up or down.  Instead the origin is simply moved one line.  This is
-named "hardware scrolling", as opposed to copying memory: "software
-scrolling".
-.PP
-The video origin is also used to implement several virtual consoles inside
-the video memory of the adapter.  Each virtual console gets a segment of
-video memory.  The driver chooses which console to display by moving the
-video origin.  Note that an MDA or Hercules adapter can only support one
-console.  CGA can support up to four 80x25 consoles, and EGA and VGA can
-have eight.  It is best to configure one less console to leave some video
-memory free so that hardware scrolling has some space to work in.
-.PP
-Character codes are used as indices into a display font that is stored in the
-adapter.  The default font is the IBM character set, which is an ASCII
-character set in the low 128 codes, and a number of mathematical, greek,
-silly graphics, and accented characters in the upper 128 codes.  This font
-is fixed in the MDA, Hercules and CGA adapters, but can be replaced by a
-user selected font for the EGA and VGA adapters.
-.PP
-A number of control characters and escape sequences are implemented by the
-driver.  The result is upward compatible with the ANSI standard terminal.
-The
-.BR termcap (5)
-type is
-.BR minix .
-Normal characters written to the console are displayed at the cursor
-position and the cursor is advanced one column to the right.  If an entire
-line is filled then the cursor wraps to the first column of the next line
-when the next character must be displayed.  The screen is scrolled up if
-needed to start a new line.  Some characters have special effects when sent
-to the console.  Some even have arguments in the form of comma separated
-decimal numbers.  These numbers default to the lowest possible value when
-omitted.  The top-left character is at position (1, 1).  The following
-control characters and escape sequences are implemented by the console:
-.PP
-.ta +10n +20n
-Sequence	Name	Function
-.in +31n
-.ti -30n
-^@	Null	Ignored (padding character)
-.ti -30n
-^G	Bell	Produce a short tone from the speaker
-.ti -30n
-^H	Backspace	Move the cursor back one column, wrapping from the
-left edge up one line to the right edge
-.ti -30n
-^I	Horizontal Tab	Move to the next tab stop, with each tab stop at
-columns 1, 9, 25, etc.  Wrap to the next line if necessary.
-.ti -30n
-^J	Line Feed	Move one line down, scrolling the screen up if
-necessary
-.ti -30n
-^K	Vertical Tab	Same as LF
-.ti -30n
-^L	Form Feed	Same as LF
-.ti -30n
-^M	Carriage Return	Move to column 1
-.ti -30n
-^[	Escape	Start of an escape sequence
-.ti -30n
-^[M	Reverse Index	Move one line up, scrolling the screen down if
-necessary
-.ti -30n
-^[[\fIn\fPA	Cursor Up	Move the cursor up \fIn\fP lines
-.ti -30n
-^[[\fIn\fPB	Cursor Down	Move the cursor down \fIn\fP lines
-.ti -30n
-^[[\fIn\fPC	Cursor Forward	Move the cursor right \fIn\fP columns
-.ti -30n
-^[[\fIn\fPD	Cursor Backward	Move the cursor left \fIn\fP columns
-.ti -30n
-^[[\fIm\fP;\fIn\fPH	Cursor Position	Move the cursor to line \fIm\fP,
-column \fIn\fP
-.ti -30n
-^[[\fIs\fPJ	Erase in Display	Clear characters as follows:
-.br
-\fIs\fP = 0: From cursor to end of screen
-.br
-\fIs\fP = 1: From start of screen to cursor
-.br
-\fIs\fP = 2: Entire screen
-.ti -30n
-^[[\fIs\fPK	Erase in Line	Clear characters as follows:
-.br
-\fIs\fP = 0: From cursor to end of line
-.br
-\fIs\fP = 1: From start of line to cursor
-.br
-\fIs\fP = 2: Entire line
-.ti -30n
-^[[\fIn\fPL	Insert Lines	Insert \fIn\fP blank lines
-.ti -30n
-^[[\fIn\fPM	Delete Lines	Delete \fIn\fP lines
-.ti -30n
-^[[\fIn\fP@	Insert Characters	Insert \fIn\fP blank characters
-.ti -30n
-^[[\fIn\fPP	Delete Characters	Delete \fIn\fP characters
-.ti -30n
-^[[\fIn\fPm	Character Attribute	Set character attribute as follows:
-.br
-\fIn\fP = 0: Normal (default) attribute
-.br
-\fIn\fP = 1: Bold (high intensity fg colour)
-.br
-\fIn\fP = 4: Underline (mono) / Cyan (colour)
-.br
-\fIn\fP = 5: Blinking
-.br
-\fIn\fP = 7: Reverse Video
-.br
-\fIn\fP = 30: Black foreground colour
-.br
-\fIn\fP = 31: Red
-.br
-\fIn\fP = 32: Green
-.br
-\fIn\fP = 33: Brown
-.br
-\fIn\fP = 34: Blue
-.br
-\fIn\fP = 35: Magenta
-.br
-\fIn\fP = 36: Cyan
-.br
-\fIn\fP = 37: Light Gray
-.br
-\fIn\fP = 39: Default fg colour (lt gray)
-.br
-\fIn\fP = 40\-47: Same for background colour
-.br
-\fIn\fP = 49: Default bg colour (black)
-.br
-Note: The "bold" versions of black, brown and lt gray become dark gray,
-yellow and white.
-.in -31n
-.PP
-The console device implements the following ioctl to copy a font into
-font memory on EGA and VGA adapters:
-.PP
-.RS
-.BI "ioctl(" fd ", TIOCSFON, u8_t " font "[256][32]);"
-.RE
-.PP
-Font memory consists of 256 character definitions of 32 lines per character
-and 8 pixels per line.  The first line is the topmost line of the character.
-The leftmost pixel is lit if the most significant bit of a line is set, etc.
-How many lines are used depends on the current video mode.  The 80x25 video
-mode used by MINIX 3 has an 8x16 character cell, 80x28 has 8x14 characters,
-and 132x43 or 132x50 has 8x8 characters.  The boot variable
-.B console
-is used by both the Boot Monitor and the console driver to set the video
-mode, software scrolling on/off, and VGA screen blank timeout.  See
-.BR boot (8).
-.SS "The Keyboard"
-The keyboard produces key codes for each key that is pressed.  These keys
-are transformed into character codes or sequences according to the current
-keyboard translation table.  The format of this table is described in
-.BR keymap (5).
-The character codes can be read from the console device unless they map to
-special hotkeys.  The hotkeys are as follows:
-.PP
-.ta +17n
-Name	Key	Function
-.in +18n
-.ti -17n
-CTRL\-ALT\-DEL	Send an abort signal to process 1 (init).  Init then
-halts the system
-.ti -17n
-CTRL\-ALT\-KP-.	Likewise for keypad period
-.ti -17n
-F1	Process table dump
-.ti -17n
-F2	Show memory map
-.ti -17n
-F3	Toggle software/hardware scrolling
-.ti -17n
-F5	Show network statistics
-.ti -17n
-CTRL\-F7	Send a quit signal to all processes connected to the console
-.ti -17n
-CTRL\-F8	Send an interrupt signal
-.ti -17n
-CTRL\-F9	Send a kill signal.  If CTRL\-F8 or CTRL\-F7 don't get 'em,
-then this surely will.  These keys are for disaster recovery.  You would
-normally use DEL and CTRL\-\e to send interrupt and quit signals.
-.\" .ig VC
-.ti -17n
-ALT\-F1	Select virtual console 0 (/dev/console)
-.ti -17n
-ALT\-F2	Select virtual console 1 (/dev/ttyc1)
-.ti -17n
-ALT\-F(\fIn\fP+1)	Select virtual console \fIn\fP
-(/dev/ttyc\fIn\fP)
-.ti -17n
-ALT\-Left	Select previous virtual console
-.ti -17n
-ALT\-Right	Select next virtual console
-.\" ..
-.in -18n
-.PP
-.\"XXX
-The keyboard map is set with the
-.B KIOCSMAP
-ioctl whose precise details are currently hidden in the
-.B loadkeys
-utility.
-.SS "Log device"
-The
-.B log
-device can be used by processes to print debug messages onto the console.
-The console is a terminal type device, so it is taken from processes when a
-session leader exits.  This does not happen with the log device.
-.SH "SEE ALSO"
-.BR tty (4),
-.BR loadkeys (1),
-.BR keymap (5),
-.BR boot (8).
-.SH NOTES
-Output processing turns Line Feeds into CR LF sequences.  Don't let this
-surprise you.  Either turn off output processing or use one of the synonyms
-for LF.
-.SH AUTHOR
-Kees J. Bot (kjb@cs.vu.nl)
-.\" minor editing of man page by asw 07.08.96
Index: trunk/minix/man/man4/controller.4
===================================================================
--- trunk/minix/man/man4/controller.4	(revision 9)
+++ 	(revision )
@@ -1,387 +1,0 @@
-.TH CONTROLLER 4
-.SH NAME
-controller, disk, tape, at, bios, esdi, aha1540, ncr810, dosfile, fatfile \- controllers, disks and tapes
-.SH DESCRIPTION
-.de SP
-.if t .sp 0.4
-.if n .sp
-..
-The
-.BI c n *
-family of devices refer to drivers that control disks, disk like devices,
-and tapes.  MINIX 3 contains a number of drivers for several different
-controllers.  These controllers can have disks, cdroms and tapes attached to
-them.  Boot Monitor variables specify which drivers are activated using
-the variables
-.BR c0 ,
-.BR c1 ,
-etc.  The names of the devices in
-.BR /dev
-that correspond with the driver for controller 0 are all named beginning
-with
-.BR c0 .
-.PP
-For each controller, the minor device numbers are organized as follows:
-.PP
-.RS
-.nf
-.ta +\w'122-127nnmm'u +\w'd0p0s0nnmm'u +\w'disk 0, part 0, subpart 0nnmm'u
-.ft B
-minor	device	what?	obsolete
-.ft P
-0	d0	disk 0	hd0
-1	d0p0	disk 0, partition 0	hd1
-2	d0p1	disk 0, partition 1	hd2
-3	d0p2	disk 0, partition 2	hd3
-4	d0p3	disk 0, partition 3	hd4
-5	d1	disk 1	hd5
-6	d1p0	disk 1, partition 0	hd6
-7	d1p1	disk 1, partition 1	hd7
-8	d1p2	disk 1, partition 2	hd8
-9	d1p3	disk 1, partition 3	hd9
-\&...	...
-39	d7p3	disk 7, partition 3	hd39
-.SP
-64	t0n	tape 0, non-rewinding
-65	t0	tape 0, rewind on close
-66	t1n	tape 1, non-rewinding
-67	t1	tape 1, rewind on close
-\&...	...
-78	t7n	tape 7, non-rewinding
-79	t7	tape 7, rewind on close
-.SP
-120	r0	raw access device 0
-121	r1	raw access device 1
-\&...	...
-127	r7	raw access device 7
-.SP
-128	d0p0s0	disk 0, part 0, subpart 0	hd1a
-129	d0p0s1	disk 0, part 0, subpart 1	hd1b
-130	d0p0s2	disk 0, part 0, subpart 2	hd1c
-131	d0p0s3	disk 0, part 0, subpart 3	hd1d
-132	d0p1s0	disk 0, part 1, subpart 0	hd2a
-\&...	...
-144	d1p0s0	disk 1, part 0, subpart 0	hd6a
-\&...	...
-255	d7p3s3	disk 7, part 3, subpart 3	hd39d
-.fi
-.RE
-.PP
-The device names in
-.B /dev
-also name the controller, of course, so the usual place for the MINIX 3
-root device, the first subpartition of the second partition of disk 0 on
-controller 0 is
-.BR /dev/c0d0p1s0 .
-Note that everything is numbered from 0!  The first controller is controller
-0, the first disk is disk 0, etc.  So the second partition is
-.BR p1 .
-.PP
-The fourth column in the table above shows the disk devices names that were
-used by previous versions of MINIX 3 for what is now controller 0.  These
-devices are no longer present in
-.BR /dev .
-.SS Disks
-Most disks are arrays of 512 byte sectors.  The disk devices are normally
-block devices, which means they are block buffered by the MINIX 3 file system
-cache using 1024 byte blocks.  The FS cache allows I/O at any byte offset,
-and takes care of cutting and pasting incomplete blocks together.  If one
-creates a character device for a disk device, then I/O must be in multiples
-of the disk block size.
-.PP
-For each disk there is a device that covers the entire disk, these are named
-.BR c0d0 ,
-.BR c0d1 ,
-etc, up to
-.B c0d7
-for controller 0.  If a partition table is placed in the first sector of the
-disk, then the disk is subdivided into regions named partitions.  Up to four
-partitions may be defined, named
-.BR c0d0p0
-to
-.BR c0d0p3
-for disk 0 on controller 0.  To make things interesting you can also place a
-partition table in the first sector of a MINIX 3 partition, which divides the
-partition into up to four subpartitions.  Normally MINIX 3 is installed into a
-single partition, with the root, swap and /usr file systems in subpartitions.
-.PP
-If a partition is an extended partition then it contains a linked list of
-partition tables each of which may specify a logical partition.  Up to four
-of these logical partitions are presented by the driver as subpartitions of
-the extended partition.
-.PP
-A sector containing a partition table starts with 446 bytes of boot code,
-followed by four partition table entries of 16 bytes each, and ends with
-the magic number 0xAA55 (little endian, so first 0x55 then 0xAA.)  Partition
-table information is defined in <ibm/partition.h>:
-.PP
-.nf
-.ta +2n +29n +37n
-/* Description of entry in the partition table.  */
-
-struct part_entry {
-	unsigned char bootind;	/* boot indicator 0/ACTIVE_FLAG	*/
-	unsigned char start_head;	/* head value for first sector	*/
-	unsigned char start_sec;	/* sector value + high 2 cyl bits	*/
-	unsigned char start_cyl;	/* low 8 cylinder bits	*/
-	unsigned char sysind;	/* system indicator	*/
-	unsigned char last_head;	/* h/s/c for the last sector	*/
-	unsigned char last_sec;
-	unsigned char last_cyl;
-	unsigned long lowsec;	/* logical first sector	*/
-	unsigned long size;	/* size of partition in sectors	*/
-};
-
-.ta +24n +7n +37n
-#define ACTIVE_FLAG	0x80	/* value for active in bootind field	*/
-#define NR_PARTITIONS	4	/* number of entries in table	*/
-#define PART_TABLE_OFF	0x1BE	/* offset of table in boot sector	*/
-
-/* Partition types (sysind). */
-#define NO_PART	0x00	/* unused entry */
-#define MINIX_PART	0x81	/* MINIX 3 partition type */
-.fi
-.PP
-The cylinder numbers are encoded in a very strange way, bits 8 and 9 are
-in the high two bits of the sector number.  The sector numbers count from 1,
-not 0!  More useful are the lowsec and size fields however, they simply give
-the location of the partition as an absolute sector offset and length within
-the drive.
-.PP
-The partition table entry defined above is specific to IBM type disks.  The
-device drivers use another partition entry structure to pass information on
-a partition.  This is what <minix/partition.h> looks like:
-.sp
-.nf
-.ta +2n +25n
-struct partition {
-	u64_t base;	/* byte offset to the partition start */
-	u64_t size;	/* number of bytes in the partition */
-	unsigned cylinders;	/* disk geometry for partitioning */
-	unsigned heads;
-	unsigned sectors;
-};
-.fi
-.PP
-The base and size fields are the byte offset and length of a partition.
-The geometry of the disk is also given for the benefit of
-partition table editors.  This information can be obtained from an open disk
-device with the call:
-.sp
-.RS
-.ft B
-ioctl(\fIfd\fP, DIOCGETP, &\fIentry\fP);
-.ft R
-.RE
-.sp
-One can change the placement of the device to the lowsec and size fields of
-.I entry
-by using the
-.B DIOCSETP
-call instead.  Only the base and size fields are used for
-.BR DIOCSETP .
-.PP
-The partition tables when read from disk by the driver are checked and
-truncated to fit within the primary partition or drive.  The first sector
-is normally left free for the partition table.
-.PP
-The partition tables are read when the in-use count (opens and mounts)
-changes from 0 to 1.  So an idle disk is automatically repartitioned on the
-next access.  This means that DIOCSETP only has effect if the disk is in
-use.
-.SS "Disk-like devices"
-Devices like a CD-ROM are treated as read-only disks, and can be accessed
-using disk devices.  A CD-ROM usually has a block size of 2048 bytes, but
-the driver knows this, and allows one to read at any byte offset by reading
-what isn't needed into a scratch buffer.
-.SS Tapes
-There are two kinds of tape devices:  Non-rewinding, and rewind-on-close.
-The non-rewinding devices treat the tape as a series of files.  The
-rewind-on-close devices look at the tape as a single file, and when you close
-such a device the tape is told to rewind.
-See
-.BR mt (1),
-and
-.BR mtio (4)
-for a description of the commands that may be sent to the tape, either from
-the command prompt or from a program.
-.PP
-There are two kinds of tape drives:  Fixed and variable block size tape
-drives.  Examples of the first kind are cartridge
-tapes, with a fixed 512 bytes block size.  An Exabyte tape drive has a
-variable block size, with a minimum of 1 byte and a maximum of 245760 bytes
-(see the documentation of such devices.)
-The maximum is truncated to 32767 bytes for Minix-86 and 61440 bytes for
-Minix-vmd, because the driver can't move more bytes in a single request.
-.PP
-A read or write to a fixed block size tape must be a precise multiple of the
-block size, any other count gives results in an I/O error.  A read from a
-variable block sized tape must be large enough to accept the block that is
-read, otherwise an I/O error will be returned.  A write can be any size
-above the minimum, creating a block of that size.  If the write count is
-larger than the maximum block size then more blocks are written until the
-count becomes zero.  The last block must be larger than the minimum of
-course.  (This minimum is often as small as 1 byte, as for the Exabyte.)
-.PP
-The
-.B mt blksize
-command may be used to select a fixed block size for a variable block sized
-tape.  This will speed up I/O considerably for small block sizes.  (Some
-systems can only use fixed mode and will write an Exabyte tape with 1024
-byte blocks, which read very slow in variable mode.)
-.PP
-A tape is a sequence of blocks and filemarks.  A tape may be opened and
-blocks may be read from it upto a filemark, after that all further reads
-return 0.  After the tape is closed and reopened one can read the blocks
-following the filemark if using a non-rewinding device.  This makes the tape
-look like a sequence of files.
-.PP
-If a tape has been written to or opened in write-only mode, then a filemark
-is written if the tape is closed or if a space command is issued.  No extra
-filemark is written if the drive is instructed to write filemarks.
-.SS "Raw Access Devices"
-Under Minix-vmd one can use the raw access devices to program a SCSI
-device entirely from user mode.  The disk and tape devices probe for devices
-when opened, start disks and load tapes, but the raw access devices do
-nothing at all.  Given an open file descriptor to any SCSI character device
-(not just the raw access devices) one can use the following ioctl:
-.PP
-.RS
-ioctl(fd, SCIOCCMD, &scsicmd)
-.RE
-.PP
-The structure whose address is passed as the third argument is defined
-in <sys/scsi.h> as follows:
-.PP
-.RS
-.nf
-struct scsicmd {
-	void	*cmd;
-	size_t	cmdlen;
-	void	*buf;
-	size_t	buflen;
-	void	*sense;
-	size_t	senselen;
-	int	dir;
-};
-.fi
-.RE
-.PP
-.B Cmd
-and
-.B cmdlen
-hold the address and length of an object holding a Group 0 or Group 1
-SCSI command.  The next two fields describe a buffer of at most 8 kilobytes
-used in the data in or out phase.
-.B Dir
-is 0 if data is to be read from the device, 1 if data is written to the
-device.  If the ioctl succeeds then 0 is returned, otherwise -1 with
-.B errno
-set to
-.B EIO
-and the request sense info returned in the buffer described by the sense and
-senselen fields.  If the sense key is zero on error then a host adapter
-error occurred, this means that the device is most likely turned off or not
-present.
-.SH DRIVERS
-By setting the Boot variables
-.BR c0
-to
-.BR c3
-under MINIX 3, or
-.BR c0
-to
-.BR c4
-under Minix-vmd one attaches a set of disk and tape devices to a driver.
-See
-.BR boot (8)
-for a list of boot variables that configure each of these drivers.
-The following drivers are available:
-.SS at
-The standard IBM/AT disk driver that also supports IDE disks.  This is the
-default driver for controller 0 on AT class machines.  (Most PCs are in that
-class.)
-.SS bios
-A disk driver that uses BIOS calls to do disk I/O.  This is the default
-driver on anything but an AT.  (Old XTs and PS/2s.)  On an XT this is the
-best driver you can use, but on any other machine this driver may be
-somewhat slow, because the system has to switch out of protected mode to
-make a BIOS call.  On a fast enough machine with a high enough setting of
-DMA_SECTORS (see
-.BR config (8))
-it works well enough.
-.SS esdi
-A hard disk driver for use on some PS/2 models.
-.SS "xt \fR(MINIX 3 only)"
-A hard disk driver for IBM/XT type hard disks.  Useful for old 286 based
-machines that have such a disk.  On XTs you are better off with the
-.B bios
-driver.
-.SS aha1540
-A SCSI driver for the Adaptec 1540 host adapter family, which includes the
-1540, 1540A, 1540B, 1540C, 1540CF, 1640, and 1740.  Also supported is the
-compatible BusLogic 545.
-.SS ncr810
-This will eventually become a Symbios 810 SCSI driver.  (Formerly owned by
-NCR.)  KJB has read the docs on this card three times, but has still done
-nothing, the lazy bum.
-.SS dosfile
-The "DOS file as disk" driver that is used when MINIX 3 is running
-under DOS.  It treats a large DOS file as a MINIX 3 disk.  Only primary
-partitions are supported, there are no subpartitions.  This is the default
-driver when MINIX 3 is started under DOS.
-.SS fatfile
-Uses a large file on a FAT file system as a disk.  It needs one of the other
-disk drivers to do the actual I/O.  This driver only knows how to interpret
-a FAT file system to find the file to use.  With a fast native disk driver
-this driver is much faster than the
-.B dosfile
-driver.
-.SH FILES
-.TP 25
-/dev/c*d*
-Disks devices.
-.TP
-/dev/c*d*p*
-Partitions.
-.TP
-/dev/c*d*p*s*
-Subpartitions.
-.TP
-/dev/c*t*n, /dev/c*t*
-Tapes.
-.TP
-/dev/c*r*
-Raw access devices.
-.SH "SEE ALSO"
-.BR dd (1),
-.BR mt (1),
-.BR eject (1),
-.BR ioctl (2),
-.BR int64 (3),
-.BR mtio (4),
-.BR boot (8),
-.BR config (8),
-.BR monitor (8),
-.BR part (8),
-.BR repartition (8).
-.SH BUGS
-The subpartitioning is incompatible with the MS-DOS method of extended
-partitions.  The latter does not map well to the sparse minor device number
-space.
-.PP
-The primary partition table is sorted by lowsec like MS-DOS does, subpartition
-tables are not.  Just think about what happens when you delete a partition in
-the MS-DOS scheme.
-.PP
-Don't move a partition that is mounted or kept open by some process.  The
-file system may write cached blocks to the new location.
-.PP
-The BIOS driver is not slow at all on a buffered disk.
-.PP
-Some IDE disks send an interrupt when they spin down under hardware power
-management.  The driver acknowledges the interrupt as it is supposed to do by
-reading the status register.  The disk then spins up again...  You have to
-disable the spin down in the computer setup to fix the problem.
-.SH AUTHOR
-Kees J. Bot (kjb@cs.vu.nl)
Index: trunk/minix/man/man4/dev.4
===================================================================
--- trunk/minix/man/man4/dev.4	(revision 9)
+++ 	(revision )
@@ -1,261 +1,0 @@
-.TH DEV 4
-.SH NAME
-dev \- device files in /dev
-.SH DESCRIPTION
-Device files are the eyes and ears of the system.  Through the device files
-one has access to the disks, terminals and other parts of the machine.
-Single bytes or disk blocks may be transferred to or from a device with
-ordinary
-.BR read (2)
-or
-.BR write (2)
-calls, byte positions set with
-.BR lseek (2),
-or more complicated control functions performed with
-.BR ioctl(2).
-.PP
-Device files as found in
-.B /dev
-have several attributes that must be considered.  Here are two examples as
-.B "ls \-l"
-shows them:
-.PP
-.RS
-.nf
-.if t .ft C
-brw-rw-rw-  1 root     operator   2,   1 Jun 10  1995 fd1
-crw--w----  1 kjb      tty        4,   0 May 11 09:41 console
-.if t .ft P
-.fi
-.RE
-.PP
-Most attributes are the same as for a regular file and have the same
-function.  The file type and the major and minor device numbers are special
-to devices.
-.PP
-Character devices are marked with a
-.B c
-as a file type letter.  Any I/O on a character device is sent down to the
-device driver without any interpretation.  This means that a process doing
-the I/O must know the characteristics of the device and deal with them
-appropriately.
-.PP
-Block devices provoke the file system server into buffering the data on
-those devices.  Data read or written by processes is passed through the file
-system block cache.  Unaligned bytes read or written are extracted or
-reassembled by the file server from or to whole blocks in the cache.  The
-file server transfers data to or from the device driver as blocks to
-positions at block size boundaries.  These blocks are MINIX 3 blocks of 1024
-bytes, disk devices usually have a 512 byte block size.  Only block devices
-can be mounted as part of the file system tree if they contain a MINIX 3 file
-system.
-.PP
-The major device number (2 for
-.B fd1
-and 4 for
-.BR console )
-are used by FS to find the device driver that manages a device.  The minor
-device number (1 for
-.B fd1
-and 0 for
-.BR console )
-is passed to the driver to select a device among a number of related devices
-that are all managed by that driver.  The device drivers are usually kernel
-tasks under MINIX 3, small processes that are contained within the address
-space of the kernel.  The following tasks and associated devices exist:
-.SS "Memory (major 1)"
-The
-.BR ram ,
-.BR mem ,
-.BR kmem ,
-and
-.BR null
-devices are managed by the memory task.
-The
-.B ram
-device is a block device for a chunk of memory that is the RAM disk.  Any
-byte read from or written to the
-.B ram
-device is copied from or to that memory chunk.
-The
-.B mem
-device is a character device for the entire address space of the system, but
-.B kmem
-only for the kernel data area.  These two devices allow programs like
-.BR ps (1)
-to hunt around the system looking for interesting bits.
-The
-.B null
-device is a data sink.  It happily swallows any bytes written to it, and
-returns nothing on a read.
-.SS "Floppy disk (major 2)"
-The
-.BR fd0 ,
-.BR fd0p0 ,
-.BR fd0p1 ,
-.BR fd0p2 ,
-and
-.BR fd0p3
-block devices are the first floppy disk and the four partitions that may
-exist on a that floppy disk.  Likewise are
-.BR fd1
-and
-.BR fd1p[0\-3]
-the device and partitions for the second floppy disk.  The floppy disk
-devices are described in detail in
-.BR fd (4).
-Partitioning in general is explained in
-.BR controller (4).
-.SS "Controller 0 (major 3)"
-The first hard disk on controller 0 can be accessed by block device
-.BR c0d0 .
-This device addresses the entire hard disk from the first to the last
-sector.  A hard disk is normally partitioned in up to four primary
-partitions,
-.BR c0d0p0 ,
-.BR c0d0p1 ,
-.BR c0d0p2 ,
-and
-.BR c0d0p3 .
-Each of these devices accesses a range of sectors on the
-.B c0d0
-device.  It is customary to give each operating system on a disk a primary
-partition.  So the Windows C: "drive" can be on
-.BR c0d0p0 ,
-and MINIX 3 can be on
-.BR c0d0p1 .
-MINIX 3 wants to have several partitions on its own, so
-.B c0d0p1
-can be further subdivided into the subpartitions
-.BR c0d0p1s0 ,
-.BR c0d0p1s1 ,
-.BR c0d0p1s2 ,
-and
-.BR c0d0p1s3 .
-.B /dev
-contains devices for the first and second hard disk
-.RB ( c0d0
-and
-.BR c0d1 ),
-their primary partitions
-.RB ( c0d[01]p[0\-3] )
-and subpartitions thereof
-.RB ( c0d[01]p[0\-3]s[0\-3] ).
-More detail can be found in
-.BR controller (4).
-.SS "Terminals (minor 4)"
-The TTY driver manages the system console device, aptly named
-.BR console ,
-the serial lines,
-.BR tty00
-and
-.BR tty01 ,
-and the pseudo ttys.
-Through the console device one can display characters on a screen attached
-to a monochrome, Hercules, color, or VGA adapter.  The
-.BR ttyc1 ,
-.BR ttyc2 ,
-etc. devices are the so-called "virtual consoles" that share the one
-console display.  One can select which virtual console is to be visible on
-the screen and take input from the keyboard.
-To allow remote login the devices with minor numbers of 128 or higher offer
-virtual terminals.  These pseudo ttys come in tty, pty pairs that form a
-pipe between processes running under the tty, and a controlling process
-attached to the pty side.
-See also
-.BR console (4),
-and
-.BR tty (4).
-.SS "Anonymous TTY (major 5)"
-This is just one device named
-.BR tty
-that is a synonym for the controlling tty of a process.  This device is not
-managed by any device driver, but is handled by FS itself.  A process can
-get access to the terminal it is running under by using
-.BR /dev/tty .
-.SS "Line printer (major 6)"
-The
-.B lp
-device sends any bytes written to it to the printer.
-.SS "TCP/IP (major 7)"
-The TCP/IP task is not a kernel task, but a server like MM and FS.  It sits
-between FS and the DP8390 task that manages the ethernet boards.  Together
-they implement the TCP/IP protocol.  See also
-.BR ip (4).
-.SS "Controller 1 (major 8)"
-Like controller 0 (major 3), but managing a second controller with devices
-.BR /dev/c1* .
-.SS "Controller 2 (major 10)"
-Like controller 0.
-.SS "Controller 3 (major 12)"
-Like controller 0.
-.SS "Audio (major 13)"
-The
-.B audio
-device can be used to produce or record air vibrations using a Soundblaster
-16 type audio card.  See
-.BR audio (4).
-.SS "Mixer (major 14)"
-The
-.B mixer
-device is used to control the audio driver.
-.SH FILES
-.TP 10
-.B /dev/*
-All MINIX 3 devices
-.SH "SEE ALSO"
-.BR read (2),
-.BR write (2),
-.BR lseek (2),
-.BR ioctl (2),
-.BR console (4),
-.BR fd (4),
-.BR controller (4),
-.BR ip (4),
-.BR tty (4),
-.BR MAKEDEV (8).
-.SH DIAGNOSTICS
-There are five prominent errors that processes accessing device files may
-provoke:
-.IP "ENODEV \- No such device" 5
-There is no driver managing the device class this device belongs to.  Either
-the driver is configured out, or it is not loaded (inet).
-.IP "ENXIO \- No such device or address"
-This device is not available.  Either the driver does not support it at all,
-or the hardware isn't available, i.e. accessing the second disk on a system
-with only one disk.
-.IP "EACCES \- Permission denied"
-This error may cause a lot of head scratching if
-.B ls \-l
-shows a device file to be writable.  The media you are trying to access is
-simply physically write protected!
-.IP "EINVAL \- Invalid argument"
-Devices may not like reads or writes that are not block multiples, or very
-big transfers, etc.  The device manual page should list the limits.
-.IP "EIO \- I/O error"
-This may be a real I/O error, i.e. a read or write on the device failing due
-to a media error.  But it may also be the result of an operation that a
-device can't do, or an empty tape drive, etc.
-.SH NOTES
-Some devices are not present by default.  The
-.BR MAKEDEV
-script knows how to make them.
-.SS "MS-DOS/Windows equivalents"
-The names of MS-DOS/Windows devices probably map to MINIX 3 devices as follows:
-.PP
-.RS
-.nf
-.ta +\w'COM1mmm'u +\w'c0d1, c0d2, c0d3mmm'u
-A:	fd0
-B:	fd1
-C:	c0d0p0	(usually the first partition)
-D:	c0d1p0, c0d2p0	(if it's another disk)
-D:	c0d0p1s0	(if it's an extended partition)
-D:	c0d1, c0d2, c0d3	(if it's a CD-ROM)
-CON	console
-COM1	tty00	(UNIX counts from 0)
-LPT1	lp
-.fi
-.RE
-.SH AUTHOR
-Kees J. Bot (kjb@cs.vu.nl)
Index: trunk/minix/man/man4/fd.4
===================================================================
--- trunk/minix/man/man4/fd.4	(revision 9)
+++ 	(revision )
@@ -1,88 +1,0 @@
-.TH FD 4
-.SH NAME
-fd \- floppy disk
-.SH DESCRIPTION
-The
-.B fd*
-devices refer to the Floppy disk driver using the NEC PD765 floppy disk
-controller.  These diskettes are arrays of 512 byte sectors, although MINIX 3
-always works with two sectors at a time due to its 1024 byte block size.  You
-can read or write any number of bytes however, MINIX 3 takes care of cutting
-and pasting incomplete blocks together.
-.PP
-The driver is normally configured for two floppy disk devices
-.B fd0
-and
-.BR fd1 .
-It can handle two more, but it is unlikely that the average PC can.
-.PP
-On the first access to an
-.B fd
-device (by
-.BR open (2)
-or
-.BR mount (2)),
-the driver will execute a series of read tests to determine the floppy type.
-This works ok for all floppy types except the true 360k type, because it
-is indistinguishable from the 720k type.  This only means that the size of
-the floppy is not estimated right.
-.PP
-Bits 2\-6 of the minor device number may be set to the floppy disk type
-to make it known to the driver what type of diskette it is reading or
-writing.  The non-auto devices should be used for formatting, or when one wants to
-be absolutely sure that the device is accessed right.  These devices exist for
-drive 0:
-.sp
-.nf
-.ta +4n +7n +9n +8n
-	type	device	minor	media
-.ta +5n +7n +9n +7n
-	0	fd0	0	autodetect
-	1	pc0	4	360k, 5.25"
-	2	at0	8	1.2M, 5.25"
-	3	qd0	12	360k in a 720k, 5.25" drive
-	4	ps0	16	720k, 3.5"
-	5	pat0	20	360k in a 1.2M, 5.25" drive
-	6	qh0	24	720k in a 1.2M, 5.25" drive
-	7	PS0	28	1.44M, 3.5"
-.fi
-.DT
-.PP
-Type 4 may also be used for the rarely seen 720k, 5.25" floppies (type 2 made
-them obsolete fast.)  Note that these "types" only describe the floppies from
-a software point of view, type 1 and 4 drives use the same parameters.
-.PP
-If the format bit (bit 7) is set, then the driver interprets write commands
-as track formatting requests.  This is used by the
-.BR format (1)
-command.
-.PP
-If the type bits are set to 28, 29, 30, or 31, then the driver uses a
-partition table found in sector 0 to partition the floppy.  The partitions
-of
-.B fd0
-may be accessed as
-.B fd0p0
-through
-.BR fd0p3 .
-See
-.BR controller (4)
-for a description of the partition table, and associated ioctl commands.
-.SH FILES
-/dev/fd[0\-3], /dev/pc[0\-3], /dev/at[0\-3], /dev/qd[0\-3], /dev/ps[0\-3],
-/dev/pat[0\-3], /dev/qh[0\-3], /dev/PS[0\-3], /dev/fd[0\-3]p[0\-3]
-.SH "SEE ALSO"
-.BR format (1),
-.BR controller (4),
-.BR part (8).
-.SH BUGS
-The driver does not know the size of a 360k diskette in a 360k 5.25"
-drive, because it uses the 720k parameters for it.  So it will happily try
-to read past the end making all kinds of interesting noises.  It's a good
-thing these drives are practically obsolete.
-.PP
-The partition table is only read when the drive motor is off and only for
-an auto or partition device.  The driver assumes that a floppy in a drive
-with a running motor can't have been replaced all of a sudden.
-.SH AUTHOR
-Kees J. Bot (kjb@cs.vu.nl)
Index: trunk/minix/man/man4/ip.4
===================================================================
--- trunk/minix/man/man4/ip.4	(revision 9)
+++ 	(revision )
@@ -1,1466 +1,0 @@
-.\"
-.\" Copyright 1994 Vrije Universiteit, The Netherlands.
-.\" For full copyright and restrictions on use see the file COPYRIGHT in the
-.\" top level of the Amoeba distribution.
-.\"
-.ig
-	Software: Philip Homburg, 1991
-	Document: Philip Homburg, Sept 3, 1991
-	Modified: Greg Sharp and Philip Homburg, March 1992
-		  - merged with udp(L) and made a little more complete.
-		  Greg Sharp, April 1992
-		  - updated keywords for auto index generation
-	Modified: Kees J. Bot, June 1994
-		  - changed to man(7) format for MINIX 3.
-..
-.TH IP 4
-.SH NAME
-ip, eth, psip, udp, tcp \- Internet Protocol server devices and definitions
-.SH DESCRIPTION
-.de SP
-.if t .sp 0.4
-.if n .sp
-..
-The
-.BR ip* ,
-.BR eth* ,
-.BR psip* ,
-.BR tcp* ,
-and
-.B udp*
-devices give access to the Internet Protocol (IP) services in MINIX 3.
-There can be up to 16 different networks, with 4 network devices each
-(a network has either an
-.B eth*
-or a
-.B psip*
-device, not both.)
-The
-.B *
-in the device names is a decimal number, so one may see names from
-.B ip0
-to
-.BR ip15 .
-A program scanning all networks must try all 16, and not stop if one in
-between is missing.  One network is the default network.  Its devices are
-linked to names without numbers.
-.PP
-The
-.B eth*
-and
-.B psip*
-devices give direct access to the network packets at the lowest level.
-The
-.BR ip* ,
-.BR tcp* ,
-and
-.B udp*
-devices give access to IP, TCP, or UDP services.
-.PP
-Most programs that use TCP/IP use code like the following to access the
-proper devices:
-.PP
-.RS
-.nf
-if ((tcp_device= getenv("TCP_DEVICE")) == NULL)
-	tcp_device= "/dev/tcp";
-.fi
-.RE
-.PP
-The low level networking programs such as
-.BR ifconfig (8)
-also have options to select the device they are working with.  The
-convention is:
-.PP
-.RS
-.BI ETH_DEVICE= device
-.br
-.BI -E " device"
-.RS
-Device to use as raw ethernet device instead of the default /dev/eth.
-.RE
-.SP
-.BI PSIP_DEVICE= device
-.br
-.BI -P " device"
-.RS
-Pseudo IP device to use instead of
-.BR /dev/psip .
-.RE
-.SP
-.BI IP_DEVICE= device
-.br
-.BI -I " device"
-.RS
-IP device to use instead of
-.BR /dev/ip .
-.RE
-.SP
-.BI TCP_DEVICE= device
-.br
-.BI -T " device"
-.RS
-TCP device to use instead of
-.BR /dev/tcp .
-.RE
-.SP
-.BI UDP_DEVICE= device
-.br
-.BI -U " device"
-.RS
-UDP device to use instead of
-.BR /dev/udp .
-.RE
-.RE
-.SS Programming
-Access to the IP services is provided using filedescriptors to open IP
-devices.  These open IP channels can be configured with
-.BR ioctl (2)
-calls, and data can be transferred by calls to
-.BR read (2),
-and
-.BR write (2).
-.SS "Types (general)"
-.IP <sys/types.h>
-.br
-Defines
-.BR u8_t ,
-.BR u16_t ,
-.B u32_t
-and
-.B i32_t
-(and
-.BR U8_t ,
-.BR U16_t ,
-.B U32_t
-and
-.B I32_t
-for use in prototypes).
-.SS "Types (eth)"
-.IP <net/gen/ether.h>
-.br
-Defines struct ether_addr (\fBether_addr_t\fP) and
-.B ether_type_t
-and
-.B Ether_type_t
-for use in prototypes.
-.IP <net/gen/eth_io.h>
-.br
-Defines struct nwio_ethopt (\fBnwio_ethopt_t\fP) and
-struct nwio_ethstat (\fBnwio_ethstat_t\fP)
-.IP <net/gen/eth_hdr.h>
-.br
-Defines struct eth_hdr (\fBeth_hdr_t\fP)
-.SS "Types (psip)"
-.IP <net/gen/psip_hdr.h>
-.br
-[[[No description available yet.]]]
-.IP <net/gen/psip_io.h>
-.br
-[[[No description available yet.]]]
-.SS "Types (ip)"
-.IP <net/gen/in.h>
-.br
-Defines
-.BR ipaddr_t ,
-.BR ipproto_t
-and struct ip_hdropt (\fBip_hdropt_t\fP).
-.IP <net/gen/ip_io.h>
-.br
-Defines struct nwio_ipconf (\fBnwio_ipconf_t\fP) and
-struct nwio_ipopt (\fBnwio_ipopt_t\fP)
-.IP <net/gen/ip_hdr.h>
-.br
-Defines struct ip_hdr (\fBip_hdr_t\fP)
-.IP <net/gen/route.h>
-.br
-Defines struct nwio_route (\fBnwio_route_t\fP)
-.SS "Types (tcp)"
-.IP <net/gen/tcp.h>
-.br
-Defines
-.B tcpport_t
-and
-.B Tcpport_t
-for use in prototypes.
-.IP <net/gen/tcp_io.h>
-.br
-Defines struct nwio_tcpconf (\fBnwio_tcpconf_t\fP),
-struct nwio_tcpcl (\fBnwio_tcpcl_t\fP),
-struct nwio_tcpatt (\fBnwio_tcpatt_t\fP) and
-struct nwio_tcpopt (\fBnwio_tcpopt_t\fP).
-.IP <net/gen/tcp_hdr.h>
-.br
-Defines struct tcp_hdr (\fBtcp_hdr_t\fP) and struct tcp_hdropt
-(\fBtcp_hdropt_t\fP).
-.SS "Types (udp)"
-.IP <net/gen/udp.h>
-.br
-Defines
-.B udpport_t
-and
-.B Udpport_t
-for use in prototypes.
-.IP <net/gen/udp_io.h>
-.br
-Defines struct nwio_udpopt (\fBnwio_udpopt_t\fP).
-.IP <net/gen/udp_hdr.h>
-.br
-Defines struct udp_hdr (\fBudp_hdr_t\fP) and struct udp_io_hdr
-(\fBudp_io_hdr_t\fP).
-.SS "Byte Order Conversion"
-All 16-bit and 32-bit quantities in IP headers must be in network byte
-order.  The macros described in
-.BR hton (3)
-can be used to convert these values to and from the byte order used by
-the host machine.
-.SS "The Internet Checksum"
-The
-.B oneC_sum
-function (see
-.BR oneC_sum (3))
-is used to calculate the one's complement checksum needed for IP network
-packets.
-.SS "General Functions"
-.PP
-.ft B
-\fIfd\fP = open(\fItcpip_device\fP, O_RDWR)
-.ft R
-.PP
-This is how one normally obtains a filedescriptor for a new TCP/IP channel.
-.I tcpip_device
-names one of the TCP/IP devices.  The channel may be used both to send or to
-receive data.
-.PP
-.ft B
-\fIn\fP = read(\fIfd\fP, \fIbuf\fP, \fIsize\fP)
-.ft R
-.PP
-Receives one packet (low level devices) or a number of bytes (TCP stream).
-Returns the the number of bytes placed into
-.IR buf ,
-or returns -1 with an error code placed into
-.BR errno .
-.PP
-.ft B
-\fIn\fP = write(\fIfd\fP, \fIbuf\fP, \fIsize\fP)
-.ft R
-.PP
-Sends one packet (low level devices) or a number of bytes (TCP stream).
-Returns
-.I size
-or -1 with the error code placed into
-.BR errno .
-The TCP/IP
-.B read
-and
-.B write
-functions behave like reads and writes on pipes when it comes to signals.
-.SS "ETH Functions"
-.PP
-.ft B
-ioctl(\fIfd\fP, NWIOGETHSTAT, &struct nwio_ethstat)
-.ft R
-.PP
-The
-.B NWIOGETHSTAT
-ioctl
-returns the Ethernet address and some statistics of the Ethernet server of
-the channel
-.IR fd .
-The result is returned in the nwio_ethstat structure.
-The \fBstruct nwio_ethstat\fP is defined in <net/gen/eth_io.h>:
-.PP
-.RS
-.nf
-.if t .ft C
-typedef struct nwio_ethstat
-{
-        ether_addr_t nwes_addr;
-        eth_stat_t nwes_stat;
-} nwio_ethstat_t;
-.SP
-typedef struct eth_stat
-{
-    unsigned long ets_recvErr,  /* # receive errors */
-	ets_sendErr,            /* # send error */
-	ets_OVW,                /* # buffer overwrite warnings,
-                                   (packets arrive faster than
-                                    can be processed) */
-	ets_CRCerr,             /* # crc errors of read */
-	ets_frameAll,           /* # frames not aligned (# bits
-                                   not a multiple of 8) */
-	ets_missedP,            /* # packets missed due to too
-                                   slow packet processing */
-	ets_packetR,            /* # packets received */
-	ets_packetT,            /* # packets transmitted */
-	ets_transDef,           /* # transmission deferred (there
-                                   was a transmission of an
-                                   other station in progress */
-	ets_collision,          /* # collisions */
-	ets_transAb,            /* # transmissions aborted due
-                                   to excessive collisions */
-	ets_carrSense,          /* # carrier sense lost */
-	ets_fifoUnder,          /* # fifo underruns (processor
-                                   is too busy) */
-	ets_fifoOver,           /* # fifo overruns (processor is
-                                   too busy) */
-	ets_CDheartbeat,        /* # times unable to transmit
-                                   collision signal */
-	ets_OWC;                /* # times out of window
-                                   collision */
-} eth_stat_t;
-.if t .ft R
-.fi
-.RE
-.PP
-.ft B
-ioctl(\fIfd\fP, NWIOSETHOPT, &struct nwio_ethopt)
-.ft R
-.PP
-Before an Ethernet channel can be used to send or receive
-Ethernet packets, it has to be configured using the
-.B NWIOSETHOPT
-ioctl.
-The structure
-.B nwio_ethopt
-is defined in <net/gen/eth_io.h>:
-.PP
-.RS
-.nf
-.if t .ft C
-typedef struct nwio_ethopt
-{
-	u32_t nweo_flags;
-	ether_addr_t nweo_multi, nweo_rem;
-	ether_type_t nweo_type;
-} nwio_ethopt_t;
-.SP
-#define NWEO_NOFLAGS    0x0000L
-#define NWEO_ACC_MASK   0x0003L
-#       define NWEO_EXCL        0x00000001L
-#       define NWEO_SHARED      0x00000002L
-#       define NWEO_COPY        0x00000003L
-#define NWEO_LOC_MASK   0x0010L
-#       define NWEO_EN_LOC      0x00000010L
-#       define NWEO_DI_LOC      0x00100000L
-#define NWEO_BROAD_MASK 0x0020L
-#       define NWEO_EN_BROAD    0x00000020L
-#       define NWEO_DI_BROAD    0x00200000L
-#define NWEO_MULTI_MASK 0x0040L
-#       define NWEO_EN_MULTI    0x00000040L
-#       define NWEO_DI_MULTI    0x00400000L
-#define NWEO_PROMISC_MASK 0x0080L
-#       define NWEO_EN_PROMISC  0x00000080L
-#       define NWEO_DI_PROMISC  0x00800000L
-#define NWEO_REM_MASK   0x0100L
-#       define NWEO_REMSPEC     0x00000100L
-#       define NWEO_REMANY      0x01000000L
-#define NWEO_TYPE_MASK  0x0200L
-#       define NWEO_TYPESPEC    0x00000200L
-#       define NWEO_TYPEANY     0x02000000L
-#define NWEO_RW_MASK    0x1000L
-#       define NWEO_RWDATONLY   0x00001000L
-#       define NWEO_RWDATALL    0x10000000L
-.if t .ft R
-.fi
-.RE
-.PP
-The configuration is divided in a number of section (covered by the xx_MASK
-macros).
-Options can be set in the
-.B nweo_flags
-field.
-The first section (\fBNWEO_ACC_MASK\fP) controls the access to a certain
-Ethernet packet type.
-If
-.B NWEO_EXCL
-is selected then this is the only channel that can send or
-receive Ethernet packets of the selected type.
-If
-.B NWEO_SHARED
-is selected then multiple channels (which all have to
-select
-.BR NWEO_SHARED )
-can use the same Ethernet type, they all can send
-packets but incoming packets will be delivered to at most one of them.
-If
-.B NWEO_COPY
-is selected then multiple channels have access to the same
-Ethernet type and all receive a copy of an incoming packet.
-.LP
-The
-.B NWEO_LOC_MASK
-flags control the delivery of packets with a destination
-address equal to the Ethernet address of the machine.
-If
-.B NWEO_EN_LOC
-is selected then these packets will be delivered and with
-.B NWEO_DI_LOC
-they will be discarded.
-.PP
-.BR NWEO_BROAD_MASK ,
-.BR NWEO_MULTI_MASK ,
-and
-.B NWEO_PROMISC_MASK
-do the same to broadcast packets,
-multicast packets and promiscuous mode packets as
-.B NWEO_LOC_MASK
-does for local packets.
-Except that the precise multicast address is taken from the \fBnweo_multi\fP
-field.
-.LP
-The
-.B NWEO_REM_MASK
-flags control whether communication is restricted to
-single destination or not.
-.B NWEO_REMSPEC
-restricts sending and receiving of packets to the single
-remote computer specified in the \fBnweo_rem\fP field.
-.B NWEO_REMANY
-allows sending to and receiving from any remote computer.
-.PP
-.B NWEO_TYPESPEC
-restricts sending and receiving of packets to the type
-specified in \fBnweo_type\fP.
-The type has to be in network byte order (using
-.BR hton (3)).
-.B NWEO_TYPEANY
-allows any type.
-.PP
-If the Ethernet header is completely specified by the
-.B nweo_flags
-i.e., all of
-.BR NWEO_EN_LOC ,
-.BR NWEO_DI_BROAD ,
-.BR NWEO_DI_MULTI ,
-.BR NWEO_DI_PROMISC ,
-.BR NWEO_REMSPEC
-and
-.B NWEO_TYPESPEC
-are
-specified, then
-.B NWEO_RWDATONLY
-can be used to send and receive only the data part of an Ethernet packet.
-If
-.B NWEO_RWDATALL
-is specified then both Ethernet header and data are used.
-.SS "PSIP Functions"
-.PP
-[[[No description available yet.]]]
-.SS "IP Functions"
-.PP
-.ft B
-ioctl(\fIfd\fP, NWIOGIPCONF, &struct nwio_ipconf)
-.ft R
-.PP
-The
-.B NWIOGIPCONF
-ioctl reports the Internet Address and the netmask.
-For the \fInwio_ipconf\fP structure see the \fBNWIOSIPCONF\fP ioctl below.
-.PP
-.ft B
-ioctl(\fIfd\fP, NWIOGIPOROUTE, &struct nwio_route)
-.ft R
-.PP
-The
-.B NWIOGIPOROUTE
-ioctl can be used to query an IP server about its routing table.
-[[[NWIODIPOROUTE, NWIOGIPIROUTE, NWIODIPIROUTE?]]]
-The structure \fBnwio_route\fP is defined in <net/gen/route.h>:
-.PP
-.RS
-.nf
-.if t .ft C
-typedef struct nwio_route
-{
-        u32_t nwr_ent_no;
-        u32_t nwr_ent_count;
-        ipaddr_t nwr_dest;
-        ipaddr_t nwr_netmask;
-        ipaddr_t nwr_gateway;
-        u32_t nwr_dist;
-        u32_t nwr_flags;
-        u32_t nwr_pref;
-} nwio_route_t;
-.SP
-#define NWRF_EMPTY      0
-#define NWRF_INUSE      1
-#define NWRF_FIXED      2
-.if t .ft R
-.fi
-.RE
-.PP
-The requested entry is taken from \fBnwr_ent_no\fP.
-Entries are counted from 0, so the value 0 can be used for an initial query.
-The size of the routing table is returned in \fBnwr_ent_count\fP.
-The \fBnwr_flags\fP indicates if the entry is in use (\fBNWRF_INUSE\fP) and
-if the entry was inserted manually (using \fBNWIOSIPOROUTE\fP) or generated
-by the IP server itself.
-The route is described by
-.BR nwr_dest ,
-.BR nwr_netmask ,
-.BR nwr_gateway ,
-.BR nwr_dist ,
-and
-.BR nwr_pref .
-\fBNwr_dest\fP and \fBnwr_netmask\fP select the destination addresses.
-A value of 0.0.0.0 (0x0) in both \fBnwr_dest\fP and \fBnwr_netmask\fP means
-every host.
-A value of 255.255.255.255 (0xffffffff) in \fBnwr_netmask\fP means a single
-host.
-Other values of \fBnwr_netmask\fP are netmasks for the network specified
-by \fBnwr_dest\fP.
-\fBNwr_gateway\fP is gateway that should be used.
-\fBNwr_dist\fP is a minimal distance.
-Packets with a time to live smaller than \fBnwr_dist\fP will not reach the
-destination.
-If two routes have equal netmask and distance fields but different
-gateways then the gateway with highest value in \fBnwr_pref\fP is used.
-.PP
-.ft B
-ioctl(\fIfd\fP, NWIOSIPCONF, &struct nwio_ipconf)
-.ft R
-.PP
-The
-.B NWIOSIPCONF
-ioctl can be used to inform the IP server about its Internet Address
-and/or its netmask.
-Normally an IP server will discover its Internet Address using the RARP
-protocol.
-.B NWIOSIPCONF
-can be used in the case that the RARP failed, or the netmask has to be changed.
-Note that higher level protocols (TCP and UDP) assume that the Internet Address
-of an IP device does not change, therefore TCP and UDP stop functioning if
-the Internet Address is changed.
-.PP
-The structure \fBnwio_ipconf\fP is defined in <net/gen/ip_io.h>:
-.PP
-.RS
-.nf
-.if t .ft C
-typedef struct nwio_ipconf
-{
-	u32_t   nwic_flags;
-	ipaddr_t nwic_ipaddr;
-	ipaddr_t nwic_netmask;
-} nwio_ipconf_t;
-.SP
-#define NWIC_NOFLAGS            0x0
-#define NWIC_FLAGS              0x3
-#       define NWIC_IPADDR_SET          0x1
-#       define NWIC_NETMASK_SET         0x2
-.if t .ft R
-.fi
-.RE
-.PP
-The function of \fBnwio_ipconf\fP depends on the value of \fBnwic_flags\fP.
-If
-.B NWIC_IPADDR_SET
-is set then the Internet Address will be set to
-\fBnwic_ipaddr\fP.
-If
-.B NWIC_NETMASK_SET
-is set then the Internet Address will be set to
-\fBnwic_netmask\fP.
-.PP
-.ft B
-ioctl(\fIfd\fP, NWIOSIPOPT, &struct nwio_ipopt)
-.ft R
-.PP
-Before an IP channel can be used, it has to be configured using the
-.B NWIOSIPOPT
-ioctl.
-The structure \fBnwio_ipopt\fP is defined in <net/gen/ip_io.h>:
-.PP
-.RS
-.nf
-.if t .ft C
-typedef struct nwio_ipopt
-{
-        u32_t nwio_flags;
-        ipaddr_t nwio_rem;
-        ip_hdropt_t nwio_hdropt;
-        u8_t nwio_tos;
-        u8_t nwio_ttl;
-        u8_t nwio_df;
-        ipproto_t nwio_proto;
-} nwio_ipopt_t;
-.SP
-#define NWIO_NOFLAGS    0x0000L
-#define NWIO_ACC_MASK   0x0003L
-#       define NWIO_EXCL        0x00000001L
-#       define NWIO_SHARED      0x00000002L
-#       define NWIO_COPY        0x00000003L
-#define NWIO_LOC_MASK   0x0010L
-#       define NWIO_EN_LOC      0x00000010L
-#       define NWIO_DI_LOC      0x00100000L
-#define NWIO_BROAD_MASK 0x0020L
-#       define NWIO_EN_BROAD    0x00000020L
-#       define NWIO_DI_BROAD    0x00200000L
-#define NWIO_REM_MASK   0x0100L
-#       define NWIO_REMSPEC     0x00000100L
-#       define NWIO_REMANY      0x01000000L
-#define NWIO_PROTO_MASK 0x0200L
-#       define NWIO_PROTOSPEC   0x00000200L
-#       define NWIO_PROTOANY    0x02000000L
-#define NWIO_HDR_O_MASK 0x0400L
-#       define NWIO_HDR_O_SPEC  0x00000400L
-#       define NWIO_HDR_O_ANY   0x04000000L
-#define NWIO_RW_MASK    0x1000L
-#       define NWIO_RWDATONLY   0x00001000L
-#       define NWIO_RWDATALL    0x10000000L
-.if t .ft R
-.fi
-.RE
-.PP
-The options are divided in several categories:
-.BR NWIO_ACC_MASK ,
-.BR NWIO_LOC_MASK ,
-.BR NWIO_BROAD_MASK ,
-.BR NWIO_REM_MASK ,
-.BR NWIO_PROTO_MASK ,
-.B NWIO_HDR_O_MASK
-and
-.BR NWIO_RW_MASK .
-A channel is configured when one option of each category is set.
-.PP
-The options covered by
-.B NWIO_ACC_MASK
-control the number of channels that
-can use one IP protocol.
-If
-.B NWIO_EXCL
-is specified then only that channel can use a certain IP protocol.
-If
-.B NWIO_SHARED
-then multiple channels that all have to specify
-.B NWIO_SHARED
-can use the same IP protocol, but incoming packets will
-be delivered to a most one channel.
-.B NWIO_COPY
-does not impose any restrictions.
-Every channel gets a copy of an incoming packet.
-.PP
-.B NWIO_LOC_MASK
-and
-.B NWIO_BROAD_MASK
-control the delivery of packets.
-If
-.B NWIO_EN_LOC
-is specified then packets that are explicitly send to
-the IP server are delivered.
-If
-.B NWIO_EN_BROAD
-is specified then broadcast packets are delivered.
-Either one or both of them can be disabled with
-.B NWIO_DI_LOC
-and
-.BR NWIO_DI_BROAD .
-.PP
-.B NWIO_REMSPEC
-can be used to restrict communication to one remote host.
-This host is taken from the \fBnwio_rem\fP field.
-If any remote host is to be allowed then
-.B NWIO_REMANY
-can be used.
-.PP
-.B NWIO_PROTOSPEC
-restricts communication to one IP protocol, specified
-in \fBnwio_proto\fP.
-.B NWIO_PROTOANY
-allows any protocol to be sent or received.
-.PP
-.B NWIO_HDR_O_SPEC
-specifies all IP header options in advance.
-The values are taken from
-.BR nwio_hdropt ,
-.BR nwio_tos ,
-.BR nwio_ttl ,
-and
-.BR nwio_df .
-\fBNwio_hdropt\fP specifies the IP options that should be present in an
-outgoing packet.
-\fBIp_hdropt_t\fP is defined in <net/gen/in.h>:
-.PP
-.RS
-.nf
-.if t .ft C
-typedef struct ip_hdropt
-{
-        u8_t iho_opt_siz;
-        u8_t iho_data[IP_MAX_HDR_SIZE-IP_MIN_HDR_SIZE];
-} ip_hdropt_t;
-.if t .ft R
-.fi
-.RE
-.PP
-The bytes of size \fBiho_opt_siz\fP in \fBiho_data\fP are appended to the IP
-header.
-\fBNwio_tos\fP specifies the value of the ``type of service'' bits,
-\fBnwio_ttl\fP gives the value of the ``time to live'' field and \fBnwio_df\fP
-specifies whether fragmentation is disallowed or not.
-.B NWIO_HDR_O_ANY
-specifies that the header options should be specified at
-each write request.
-.PP
-.B NWIO_RWDATONLY
-specifies that the header should be omitted from a
-write request.
-This option can only be used when all header fields are specified in previous
-options:
-.BR NWIO_EN_LOC ,
-.BR NWIO_DI_BROAD ,
-.BR NWIO_REMSPEC ,
-.B NWIO_PROTOSPEC
-and
-.BR NWIO_HDR_O_SPEC .
-A read operation will also only return the data part, so the IP options will
-be lost.
-.PP
-.ft B
-ioctl(\fIfd\fP, NWIOSIPOROUTE, &struct nwio_route)
-.ft R
-.PP
-The
-.B NWIOSIPOROUTE
-ioctl adds a route to the routing table.
-See \fBNWIOGIPOROUTE\fP above for a description of the \fBnwio_route\fP
-structure.
-The fields \fBnwr_ent_no\fP and \fBnwr_ent_count\fP are ignored.
-.SS "TCP Functions"
-.PP
-.ft B
-ioctl(\fIfd\fP, NWIOTCPCONN, &struct nwio_tcpcl)
-.ft R
-.PP
-The
-.B NWIOTCPCONN
-ioctl tries to setup a connection with a remote TCP/IP server.
-The channel must be fully configured (see
-.BR NWIOSTCPCONF )
-and values for the local port, the remote port and the remote address have be
-specified using
-.B NWTC_LP_SET
-or
-.BR NWTC_LP_SEL ,
-.B NWTC_SET_RA
-and
-.BR NWTC_SET_RP .
-The struct nwio_tcpcl is defined in <net/gen/tcp_io.h> as:
-.PP
-.RS
-.nf
-.if t .ft C
-typedef struct nwio_tcpcl
-{
-	long nwtcl_flags;
-	long nwtcl_ttl;
-} nwio_tcpcl_t;
-.if t .ft R
-.fi
-.RE
-.PP
-Set the
-.B nwtcl_flags
-field to zero before the connect or listen call.  [[[Further explanation of
-nwio_tcpcl?]]]
-.PP
-.ft B
-ioctl(\fIfd\fP, NWIOGTCPCONF, &struct nwio_tcpconf)
-.ft R
-.PP
-This call reports the current configuration of a TCP channel.
-The
-.B nwtc_flags
-field shows the status of the
-.BR access ,
-.BR locport ,
-.B remaddr
-and
-.B remport
-fields.
-.B Nwtc_locaddr
-contains the Internet address of the TCP/IP server.
-.B Remaddr
-contains the Internet address of the remote TCP/IP server when set with
-.B NWTC_SET_RA
-or after a successful connect or listen (see
-.B NWIOTCPCONN
-or
-.BR NWIOTCPLISTEN ).
-.B Nwio_locport
-contains the local TCP/IP port set with
-.B NWTC_LP_SET
-or the selected port set with
-.BR NWTC_LP_SEL .
-.B Nwtc_remport
-contains the TCP port of the remote TCP/IP server as set with
-.B NWIO_SET_RP
-or after a successful connect or listen.
-.PP
-A value of 0 (zero) is reported for
-.BR nwtc_remaddr ,
-.B nwtc_locport
-or
-.B nwtc_remport
-when no value is set either explicitly or implicitly.
-.PP
-.ft B
-ioctl(\fIfd\fP, NWIOTCPLISTEN, &struct nwio_tcpcl)
-.ft R
-.PP
-The
-.B NWIOTCPLISTEN
-ioctl waits until a remote TCP/IP server tries to connect to this channel.
-The channel has to be configured (see
-.BR NWIOSTCPCONF ).
-An additional restriction is that the local port
-must be set (with
-.BR NWTC_LP_SET )
-or selected (with
-.BR NWTC_LP_SEL ).
-When a remote address is set only connections for that host are accepted, and
-when a remote port is set only connections from that port are accepted.
-After a successful listen
-.B NWIOGTCPCONF
-can be used to find out what the address and port of the other side are.
-.PP
-.ft B
-ioctl(\fIfd\fP, NWIOSTCPCONF, &struct nwio_tcpconf)
-.ft R
-.PP
-Before a TCP channel can be used it must configured using the
-.B NWIOSTCPCONF
-ioctl.
-The parameters to
-.B NWIOSTCPCONF
-are the channel file descriptor and a
-.B struct nwio_tcpconf
-as defined in <net/gen/tcp_io.h>:
-.PP
-.RS
-.nf
-.if t .ft C
-typedef struct nwio_tcpconf
-{
-	u32_t nwtc_flags;
-	ipaddr_t nwtc_locaddr;
-	ipaddr_t nwtc_remaddr;
-	tcpport_t nwtc_locport;
-	tcpport_t nwtc_remport;
-} nwio_tcpconf_t;
-.SP
-#define NWTC_NOFLAGS    0x0000L
-#define NWTC_ACC_MASK   0x0003L
-#       define NWTC_EXCL        0x00000001L
-#       define NWTC_SHARED      0x00000002L
-#       define NWTC_COPY        0x00000003L
-#define NWTC_LOCPORT_MASK       0x0030L
-#       define NWTC_LP_UNSET    0x00000010L
-#       define NWTC_LP_SET      0x00000020L
-#       define NWTC_LP_SEL      0x00000030L
-#define NWTC_REMADDR_MASK       0x0100L
-#       define NWTC_SET_RA      0x00000100L
-#       define NWTC_UNSET_RA    0x01000000L
-#define NWTC_REMPORT_MASK       0x0200L
-#       define NWTC_SET_RP      0x00000200L
-#       define NWTC_UNSET_RP    0x02000000L
-.if t .ft R
-.fi
-.RE
-.PP
-A tcp channel is considered configured when one flag in each category has
-been selected.
-Thus one of
-.BR NWTC_EXCL ,
-.B NWTC_SHARED
-or
-.BR NWTC_COPY ,
-one of
-.BR NWTC_LP_UNSET ,
-.B NWTC_LP_SET
-or
-.BR NWTC_LP_SEL ,
-one of
-.B NWTC_SET_RA
-or
-.BR NWTC_UNSET_RA ,
-and one of
-.B NWTC_SET_RP
-or
-.BR NWTC_UNSET_RP .
-.PP
-The acc flags control the access to a certain TCP port.
-.B NWTC_EXCL
-means exclusive access.
-An attempt to configure a channel will be denied if the same port is specified
-as that of a channel that requested exclusive access.
-.B NWTC_SHARED
-indicates that several channels use the same port but cooperate.
-If the shared mode is specified for one channel than all other channel that
-use the same port should also be configured with the
-.B NWTC_SHARED
-flag.
-.B NWTC_COPY
-is specified when the programmer does not care about other channels.
-This is the default.
-.PP
-The locport flags control which TCP port is used for communication.
-.B NWTC_LP_UNSET
-indicates the absence of a local port.
-This is the default.
-.B NWTC_LP_SET
-means that the
-.B nwtc_locport
-field contains the local port to be used by TCP.
-This value must be in network byte order (see
-.BR hton (3).)
-.B NWTC_LP_SEL
-requests the TCP server to pick a port.
-This port will be in the range from 32768 to 65535 and will be unique.
-.LP
-The
-.B remaddr
-flags specify which hosts are acceptable for connections.
-.B NWTC_SET_RA
-indicates that only connection to the host specified in
-.B nwtc_remaddr
-are acceptable.
-.B Nwtc_remaddr
-should be in network byte order (see
-.BR hton (3).)
-.B NWTC_UNSET_RA
-allows every host on the other side of a connection.
-This is the default.
-.PP
-The
-.B remport
-flags specify which remote ports are acceptable for connections.
-.B NWTC_SET_RP
-indicates that only the port specified in
-.B nwtc_remport
-is acceptable.
-.B NWTC_UNSET_RP
-allows every port on the other side of a connection.
-This is the default.
-.PP
-.ft B
-ioctl(\fIfd\fP, NWIOTCPSHUTDOWN)
-.ft R
-.PP
-The
-.B NWIOTCPSHUTDOWN
-tells the TCP/IP server that no more data will be sent over the channel
-specified by
-.IR fd .
-This command can be issued when the channel is connected to a remote TCP/IP
-server.
-The TCP/IP server will tell the remote TCP/IP server and the client of the
-remote TCP/IP server will receive an end-of-file indication.
-.PP
-.ft B
-ioctl(\fIfd\fP, NWIOGTCPOPT, &struct nwio_tcpopt)
-.br
-ioctl(\fIfd\fP, NWIOSTCPOPT, &struct nwio_tcpopt)
-.ft R
-.PP
-The behaviour of a TCP channel may be changed by setting a number of
-options.  The TCP options can be obtained with the
-.B NWIOGTCPOPT
-ioctl and set with the
-.B NWIOSTCPOPT
-ioctl.  The options are passed in a
-.B struct nwio_tcpopt
-as defined in <net/gen/tcp_io.h>:
-.PP
-.RS
-.nf
-.if t .ft C
-typedef struct nwio_tcpopt
-{
-	u32_t nwto_flags;
-} nwio_tcpopt_t;
-.SP
-#define NWTO_NOFLAG     0x0000L
-#define NWTO_SND_URG_MASK       0x0001L
-#       define NWTO_SND_URG     0x00000001L
-#       define NWTO_SND_NOTURG  0x00010000L
-#define NWTO_RCV_URG_MASK       0x0002L
-#       define NWTO_RCV_URG     0x00000002L
-#       define NWTO_RCV_NOTURG  0x00020000L
-#define NWTO_BSD_URG_MASK       0x0004L
-#       define NWTO_BSD_URG     0x00000004L
-#define NWTO_DEL_RST_MASK       0x0008L
-#       define NWTO_DEL_RST     0x00000008L
-.if t .ft R
-.fi
-.RE
-.PP
-The
-.B NWTO_SND_URG
-option causes bytes written to the channel to be send out as urgent data.
-On receiving an
-.B EURG
-error the
-.B NWTO_RCV_URG
-option must be set to switch over to reading urgent data.  When all urgent
-data has been read an
-.B ENOURG
-error will follow,
-indicating that the option must be cleared with
-.BR NWTO_RCV_NOTURG .
-Alas the BSD implementation of urgent data disagrees with the RFC's, so to
-be BSD compatible one must set the
-.B NWTO_BSD_URG
-option beforehand on a channel that is to send or receive urgent data.
-Given that the BSD implementation is the regarded as the TCP/IP standard one
-should always use the BSD style.  The
-.B NWTO_DEL_RST
-option delays a failure response on a connect to the same port as the
-current open connection.  Without this option a connect would fail if
-a server is not yet listening.  With this option a connect will linger
-on until the server starts listening.  This option is useful for a server
-that opens a connection, tells the remote end the local port number and
-then listens (FTP), or for a program that forks off servers for incoming
-connections (TELNET).  A new connection may come in before a new listen
-can be started, so it is nice if the new connect doesn't fail.  Use this
-option only when it is clearly needed.
-.SS "UDP Functions"
-.PP
-.ft B
-ioctl(\fIfd\fP, NWIOGUDPOPT, &struct nwio_udpopt)
-.ft R
-.PP
-The
-.B NWIOGUDPOPT
-ioctl returns the current options that result from the default options
-and the options set with
-.BR NWIOSUDPOPT .
-When
-.B NWUO_LP_SEL
-or
-.B NWUO_LP_SET
-is selected the local port is returned in
-.BR nwuo_locport .
-When
-.B NWUO_RP_SET
-is selected the remote port is returned in
-.BR nwuo_remport .
-The local address is always returned in
-.BR nwuo_locaddr ,
-and when
-.B NWUO_RA_SET
-is selected the remote address is returned in
-.BR nwuo_remaddr .
-.PP
-.ft B
-ioctl(\fIfd\fP, NWIOSUDPOPT, &struct nwio_udpopt)
-.ft R
-.PP
-A UDP channel must be configured using the
-.B NWIOSUDPOPT
-ioctl before any data can be read or written.
-.B NWIOSUDPOPT
-takes two parameters, a file descriptor to an open UDP device and
-pointer to a
-.B nwio_udpopt
-structure that describes the requested configuration.
-The
-.B nwio_udpopt
-structure is defined in <net/gen/udp_io.h> as:
-.PP
-.RS
-.nf
-.if t .ft C
-typedef struct nwio_udpopt
-{
-	unsigned long nwuo_flags;
-	udpport_t nwuo_locport;
-	udpport_t nwuo_remport;
-	ipaddr_t nwuo_locaddr;
-	ipaddr_t nwuo_remaddr;
-} nwio_udpopt_t;
-.SP
-#define NWUO_NOFLAGS            0x0000L
-#define NWUO_ACC_MASK           0x0003L
-#define         NWUO_EXCL               0x00000001L
-#define         NWUO_SHARED             0x00000002L
-#define         NWUO_COPY               0x00000003L
-#define NWUO_LOCPORT_MASK       0x000CL
-#define         NWUO_LP_SEL             0x00000004L
-#define         NWUO_LP_SET             0x00000008L
-#define         NWUO_LP_ANY             0x0000000CL
-#define NWUO_LOCADDR_MASK       0x0010L
-#define         NWUO_EN_LOC             0x00000010L
-#define         NWUO_DI_LOC             0x00100000L
-#define NWUO_BROAD_MASK         0x0020L
-#define         NWUO_EN_BROAD           0x00000020L
-#define         NWUO_DI_BROAD           0x00200000L
-#define NWUO_REMPORT_MASK       0x0100L
-#define         NWUO_RP_SET             0x00000100L
-#define         NWUO_RP_ANY             0x01000000L
-#define NWUO_REMADDR_MASK       0x0200L
-#define         NWUO_RA_SET             0x00000200L
-#define         NWUO_RA_ANY             0x02000000L
-#define NWUO_RW_MASK            0x1000L
-#define         NWUO_RWDATONLY          0x00001000L
-#define         NWUO_RWDATALL           0x10000000L
-#define NWUO_IPOPT_MASK         0x2000L
-#define         NWUO_EN_IPOPT           0x00002000L
-#define         NWUO_DI_IPOPT           0x20000000L
-.if t .ft R
-.fi
-.RE
-.PP
-A UDP channel is considered configured when one flag in each category has been
-selected.
-Thus one of
-.BR NWUO_EXCL ,
-.B NWUO_SHARED
-or
-.BR NWUO_COPY ,
-one of
-.BR NWUO_LP_SEL ,
-.B NWUO_LP_SET
-or
-.BR NWUO_LP_ANY ,
-one of
-.B NWUO_EN_LOC
-or
-.BR NWUO_DI_LOC ,
-one of
-.BR NWUO_EN_BROAD ,
-or
-.BR NWUO_DI_BROAD ,
-one of
-.BR NWUO_RP_SET ,
-or
-.BR NWUO_RP_ANY ,
-one of
-.BR NWUO_RA_SET ,
-or
-.BR NWUO_RA_ANY ,
-one of
-.BR NWUO_RWDATONLY ,
-or
-.BR NWUO_RWDATALL ,
-and one of
-.BR NWUO_EN_IPOPT ,
-or
-.BR NWUO_DI_IPOPT .
-The acc flags control the access to a certain UDP port.
-.B NWUO_EXCL
-means exclusive access:
-no other channel can use this port.
-.B NWUO_SHARED
-means shared access:
-only channels that specify shared access can use this port
-and all packets that are received are handed to at most one channel.
-.B NWUO_COPY
-imposes no access restriction and all channels get a copy of every received
-packet for that port.
-.PP
-The
-.B locport
-flags control the selection of the UDP port for this channel.
-.B NWUO_LP_SEL
-requests the server to pick a port.
-This port will be in the range from 32768 to 65535 and it will be unique.
-.B NWUO_LP_SET
-sets the local port to the value of the
-.B nwuo_locport
-field.
-.B NWUO_LP_ANY
-does not select a port.
-Reception of data is therefore not possible but it is
-possible to send data.
-.PP
-The
-.B locaddr
-flags control the reception of packets.
-.B NWUO_EN_LOC
-enables the reception of packets with the local IP address as destination.
-.B NWUO_DI_LOC
-disables the reception of packet for the local IP address.
-.PP
-The
-.B broad
-flags control the reception of broadcast packets.
-.B NWUO_EN_BROAD
-enables the reception of broadcast packets and
-.B NWUO_DI_BROAD
-disables the reception of broadcast packets.
-.PP
-The
-.B remport
-flags let the client to specify one specific remote UDP port or
-to allow any remote port.
-.B NWUO_RP_SET
-sets the remote UDP port to the value of
-.BR nwuo_remport .
-Only packets with a matching remote port will be delivered
-and all packets will be sent to that port.
-.B NWUO_RP_ANY
-allows reception of packets form any port and when transmitting packets the
-remote port has to be specified.
-.PP
-The
-.B remaddr
-flags control the remote IP address.
-.B NWUO_RA_SET
-sets the remote IP address the value of
-.BR nwuo_remaddr .
-Only packets from that address will be delivered and all packets will be sent
-to that address.
-.B NWUO_RA_ANY
-allows reception of packets from any host and when transmitting packets the
-remote host has to be specified.
-.PP
-The
-.B rw
-flags control the format of the data to be sent or received.
-With
-.B NWUO_RWDATONLY
-only the data part of a UDP packet is sent to the server and only the data
-part is received from the server.
-The
-.B NWUO_RWDATALL
-mode presents the data part of a UDP packet with a header that contains
-the source and destination IP address, source and destination UDP ports,
-the IP options, etc.
-The server expects such a header in front of the data to be transmitted.
-.ig \" Some for Philip to explain properly:
-The header is defined in <net/gen/udp_hdr.h> and looks like this:
-.PP
-.RS
-.nf
-.if t .ft C
-typedef struct udp_io_hdr
-{
-	ipaddr_t uih_src_addr;
-	ipaddr_t uih_dst_addr;
-	udpport_t uih_src_port;
-	udpport_t uih_dst_port;
-	u16_t uih_ip_opt_len;
-	u16_t uih_data_len;
-} udp_io_hdr_t;
-.if t .ft R
-.fi
-.RE
-.PP
-The first four fields are the source and destination IP addresses and
-ports.
-.B Uih_ip_opt_len
-is ???.
-.B Uih_data_len
-should equal the length of the packet data (packet lenght minus the
-header.) ???
-..
-.PP
-The
-.B ipopt
-flags control the delivery and transmission of IP options.
-When
-.B NWUO_EN_IPOPT
-is set IP, options will be delivered and sent.
-When
-.B NWUO_DI_IPOPT
-is set IP option will be stripped from received packets and no IP options will
-be sent.
-.ig \" MINIX 3 doesn't have this stuff (yet? ever?)
-.SS "UDP Library Functions"
-.PP
-The following routines provide an somewhat easier to use interface to UDP than
-the routines described above (\fBtcpip_open\fP, \fBudp_ioc_setopt\fP,
-\fBtcpip_read\fP and \fBtcpip_write\fP).
-.LP
-.sC
-errstat
-udp_connect(udp_cap, chan_cap, srcport, dstport, dstaddr, flags)
-capability *udp_cap;
-capability *chan_cap;
-udpport_t srcport;
-udpport_t dstport;
-ipaddr_t dstaddr;
-int flags;
-.eC
-.kW "\fIudp_connect\fP"
-\fIUdp_connect\fP combines the functionality of \fItcpip_open\fP and
-\fIudp_ioc_setopt\fP.
-A pointer to a UDP server capability should be passed in \fIudp_cap\fP, and
-the channel capability will be returned in the capability pointed to by
-\fIchan_cap\fP.
-If \fIsrcport\fP is 0 then an unused port will be selected, otherwise the local
-port will be set to \fIsrcport\fP.
-If \fIdstport\fP is non-zero then communication will be restricted to remote ports
-that equal to \fIdstport\fP, otherwise any data can be sent to or received from
-any remote port.
-The same thing applies to \fIdstaddr\fP; if \fIdstaddr\fP is non-zero then
-only \fIdstaddr\fP can be reached.
-Currently no flags are defined so \fIflags\fP should be 0.
-.sH
-udp_reconnect
-.LP
-.sC
-errstat
-udp_reconnect(chan_cap, srcport, dstport, dstaddr, flags)
-capability *chan_cap;
-udpport_t srcport;
-udpport_t dstport;
-ipaddr_t dstaddr;
-int flags;
-.eC
-.kW "\fIudp_reconnect\fP"
-\fIUdp_reconnect\fP is the same as \fIudp_connect\fP except that an existing
-channel capability is (re)used.
-.sH
-udp_read_msg
-.LP
-.sC
-errstat
-udp_read_msg(chan_cap, msg, msglen, actlen, flags)
-capability *chan_cap;
-char *msg;
-int msglen;
-int *actlen;
-int flags;
-.eC
-.kW "\fIudp_read_msg\fP"
-\fIUdp_read_msg\fP delivers a UDP packet.
-The data part of the UDP packet is
-prepended with an \fIudp_io_hdr\fP.
-The actual length of the possibly truncated packet is returned in \fIactlen\fP.
-No flags are defined so \fIflags\fP should be 0.
-.sH
-udp_write_msg
-.LP
-.sC
-errstat
-udp_write_msg(chan_cap, msg, msglen, flags)
-capability *chan_cap;
-char *msg;
-int msglen;
-int flags;
-.eC
-.kW "\fIudp_write_msg\fP"
-A UDP packet can be sent with \fIudp_write_msg\fP.
-\fIMsg\fP should point to a \fIudp_io_hdr\fP followed by the data part of the
-UDP packet.
-The \fIuih_dst_addr\fP and \fIuih_dst_port\fP fields of the \fIudp_io_hdr\fP
-should be filled in if no values are specified in the \fIudp_connect\fP,
-or \fIudp_reconnect\fP.
-.sH
-udp_close
-.LP
-.sC
-errstat
-udp_close(chan_cap, flags)
-capability *chan_cap;
-int flags;
-.eC
-.kW "\fIudp_close\fP"
-\fIUdp_close\fP cleans up the administration kept by the UDP library but does
-not destroy the capability.
-The function should be used if the capability is passed to another process
-and should continue to exist.
-No flags are defined so \fIflags\fP should be 0.
-.sH
-udp_destroy
-.LP
-.sC
-errstat
-udp_destroy(chan_cap, flags)
-capability *chan_cap;
-int flags;
-.eC
-.kW "\fIudp_destroy\fP"
-\fIUdp_destroy\fP not only cleans up the administration kept by the UDP library
-but also destroys the channel capability.
-..
-.SH FILES
-.IP /dev/eth* \w'/dev/psip*mmm'u
-Raw ethernet.  The numbers in the device names are decimal, so one may see
-names from
-.B eth0
-to
-.BR eth15 .
-
-.IP /dev/psip*
-First and second Pseudo IP network.
-.IP /dev/ip*
-IP devices for two ethernets and two Pseudo IP networks.
-.IP /dev/tcp*
-TCP devices for same four networks.
-.IP /dev/udp*
-UDP devices.
-.IP "/dev/eth, /dev/psip, /dev/ip, /dev/tcp, /dev/udp"
-Devices for the default network, links to the devices above.
-.B Eth
-is only present if ethernet is the default,
-.B psip
-only for pseudo IP.
-.SH "SEE ALSO"
-.BR hton (3),
-.BR oneC_sum (3),
-.BR inet (8),
-.BR boot (8).
-.SH DIAGNOSTICS
-Several errors may be returned by the TCP/IP server.  The error code
-is found in the
-.B errno
-variable if the
-.BR read ,
-.BR write ,
-or
-.B ioctl
-call returns -1.  The TCP/IP error codes defined in <errno.h> are:
-.IP EPACKSIZE 5c
-This indicates an attempt to read or write with a buffer that is too
-large or too small.
-.IP EOUTOFBUFS
-The TCP/IP server has insufficient memory to execute the request.
-.IP EBADIOCTL
-This indicates an attempt to execute a command the particular server
-does not understand.
-For example, a
-.B NWIOGTCPCONF
-on an ETH channel.
-.IP EBADMODE
-The request is refused because the channel is not fully configured, in the
-wrong state or the parameters are invalid.
-.IP EBADDEST
-This indicates an illegal destination address for a packet.
-.IP EDSTNORCH
-The destination is not reachable.
-.IP EISCONN
-The channel is already connected so a second request is refused.
-.IP EADDRINUSE
-This address is in use.
-.IP ECONNREFUSED
-The connection is refused by the other side.
-.IP ECONNRESET
-The connection is reset (non-gracefully terminated) by the other side.
-.IP ETIMEDOUT
-The connection is terminated due to an expired timer.
-.IP EURG
-Urgent data is present and the current receive mode does not allow urgent data
-to be transferred.
-.IP ENOURG
-No urgent data is present and a request came for urgent data.
-.IP ENOTCONN
-The request requires a connected channel and the channel is not connected.
-.IP ESHUTDOWN
-The connection is shut down.
-That is, a
-.B NWIOTCPSHUTDOWN
-has been executed so no more data can be transmitted.
-.IP ENOCONN
-The connection does not exist.
-.IP EGENERIC
-A generic error code for extremely weird cases.
-.SH AUTHOR
-Philip Homburg (philip@cs.vu.nl)
-
-.\"
-.\" $PchId: ip.4,v 1.4 2001/01/08 19:58:14 philip Exp $
Index: trunk/minix/man/man4/lp.4
===================================================================
--- trunk/minix/man/man4/lp.4	(revision 9)
+++ 	(revision )
@@ -1,28 +1,0 @@
-.TH LP 4
-.SH NAME
-lp \- line printer
-.SH DESCRIPTION
-The
-.B lp
-device refers to the line printer attached to the parallel port.  Any byte
-written to this device is printed.  Only one process may have the device
-open.
-.PP
-The
-.B write (2)
-call may return with a smaller count then the number of bytes requested to
-write.  The next write call is then likely to fail with the error code
-.B EAGAIN
-if the printer is out of paper, or
-.B EIO
-if the printer is turned off.
-.SH FILES
-.TP 10
-/dev/lp
-Parallel port device.
-.SH "SEE ALSO"
-.BR lp (1).
-.SH BUGS
-Only one parallel port is supported.
-.SH AUTHOR
-Kees J. Bot (kjb@cs.vu.nl)
Index: trunk/minix/man/man4/mtio.4
===================================================================
--- trunk/minix/man/man4/mtio.4	(revision 9)
+++ 	(revision )
@@ -1,98 +1,0 @@
-.TH MTIO 4
-.SH NAME
-mtio \- magnetic tape commands
-.SH SYNOPSIS
-.B "#include <sys/types.h>"
-.br
-.B "#include <sys/mtio.h>"
-.br
-.B "#include <sys/ioctl.h>"
-.SH DESCRIPTION
-.de SP
-.if t .sp 0.4
-.if n .sp
-..
-The magnetic tape devices described in
-.BR sd (4)
-may be sent commands or queried for their status using the following ioctl
-calls:
-.PP
-.RS
-.BR ioctl ( \fIfd ,
-.BR MTIOCTOP ,
-.RB & "struct mtop" )
-.br
-.BR ioctl ( \fIfd ,
-.BR MTIOCGET ,
-.RB & "struct mtget" )
-.RE
-.PP
-The struct mtop, struct mtget and associated definitions are defined in
-<sys/mtio.h> as follows:
-.PP
-.nf
-
-/* Tape operations: ioctl(fd, MTIOCTOP, &struct mtop) */
-
-.ta +4n +7n +15n
-struct mtop {
-	short	mt_op;	/* Operation (MTWEOF, etc.) */
-	int	mt_count;	/* Repeat count. */
-};
-
-.ta +17n +5n
-#define MTWEOF	0	/* Write End-Of-File Marker */
-#define MTFSF	1	/* Forward Space File mark */
-#define MTBSF	2	/* Backward Space File mark */
-#define MTFSR	3	/* Forward Space Record */
-#define MTBSR	4	/* Backward Space Record */
-#define MTREW	5	/* Rewind tape */
-#define MTOFFL	6	/* Rewind and take Offline */
-#define MTNOP	7	/* No-Operation, set status only */
-#define MTRETEN	8	/* Retension (completely wind and rewind) */
-#define MTERASE	9	/* Erase the tape and rewind */
-#define MTEOM	10	/* Position at End-Of-Media */
-#define MTMODE	11	/* Select tape density */
-#define MTBLKZ	12	/* Select tape block size */
-
-/* Tape status: ioctl(fd, MTIOCGET, &struct mtget) */
-
-.ta +4n +7n +15n
-struct mtget {
-	short	mt_type;	/* Type of tape device. */
-
-	/* Device dependent "registers". */
-	short	mt_dsreg;	/* Drive status register. */
-	short	mt_erreg;	/* Error register. */
-
-	/* Misc info. */
-	off_t	mt_resid;	/* Residual count. */
-	off_t	mt_fileno;	/* Current File Number. */
-	off_t	mt_blkno;	/* Current Block Number within file. */
-	off_t	mt_blksize;	/* Current block size. */
-};
-
-.fi
-.PP
-See
-.BR mt (1)
-for a detailed description on what each operation does.  The mt_type field
-is always zero, there is no use for it yet.  Mt_dsreg is 0 (OK), 1 (Error),
-or 2 (EOF encountered.)  Mt_erreg holds the SCSI sense key of the last
-operation.  Mt_blksize is the current tape block size in bytes, zero if the
-block size is variable.
-.PP
-Note that one can issue these commands on a file descriptor that is in use
-to read or write data, something that
-.B mt
-can't do.  So you can add eof markers in the middle of an output stream,
-or get the status of a device before a rewind-on-close tape rewinds.
-.PP
-The driver will automatically add an end of file marker to a tape that is
-written to if you execute a space command.  If you write eof markers
-yourself then the driver will not add one extra on close.
-.SH "SEE ALSO"
-.BR mt (1),
-.BR sd (4).
-.SH AUTHOR
-Kees J. Bot (kjb@cs.vu.nl)
Index: trunk/minix/man/man4/tty.4
===================================================================
--- trunk/minix/man/man4/tty.4	(revision 9)
+++ 	(revision )
@@ -1,736 +1,0 @@
-.TH TTY 4
-.SH NAME
-tty, termios \- terminals
-.SH DESCRIPTION
-The
-.B tty
-driver family takes care of all user input and output.  It governs the
-keyboard, the console, the serial lines, and pseudo ttys.  Input on any of
-these devices undergoes "input processing", and output undergoes "output
-processing" according to the standard termios terminal interface.
-.SS "Input processing"
-Each terminal device has an input queue.  This queue is used to store
-preprocessed input characters, and to perform the backspacing and erase
-functions.  Some special characters like a newline make the contents of the
-queue available to a process reading from the terminal.  Characters up to
-and including the newline, or another so-called "line break", may be read by
-a process.  The process need not read all characters at once.  An input line
-may be read byte by byte if one wants to.  A line break just makes
-characters available for reading, thats all.
-.PP
-When data is made available depends on whether the tty is in canonical mode
-or not.  In canonical mode the terminal processes input line by line.  A
-line ends with a newline
-.RB ( NL ),
-end-of-file
-.RB ( EOF ),
-or end-of-line
-.RB ( EOL ).
-Characters that have not been delimited by such a line break may be erased
-one by one with the
-.B ERASE
-character or all at once with the
-.B KILL
-character.  Once a line break is typed the characters become available to a
-reading process and can no longer be erased.  Once read they are removed
-from the input queue.  Several lines may be gathered in the input queue if
-no reader is present to read them, but a new reader will only receive one
-line.  Two line breaks are never returned in one read call.  The input queue
-has a maximum length of
-.B MAX_CANON
-characters.  Any more characters are discarded.  One must use
-.B ERASE
-or
-.B KILL
-to make the terminal functioning again if the input queue fills up.  If
-nonblocking I/O is set then \-1 is returned with
-.B errno
-set to
-.B EAGAIN
-if the reader would otherwise be blocked.
-.PP
-In non-canonical mode (raw mode for short) all characters are immediately
-available to the reader in principle.  One may however tune the terminal to
-bursty input with the
-.B MIN
-and
-.B TIME
-parameters, see the raw I/O parameters section below.  In raw mode no
-characters are discarded if the input queue threatens to overflow if the
-device supports flow control.
-.SS "Output processing"
-Characters written to a terminal device may undergo output processing, which
-is usually just inserting a carriage returns before newlines.  A writer
-may return before all characters are output if the characters can be stored
-in the output buffers.  If not then the writer may be blocked until space is
-available.  If non-blocking I/O is set then only the count of the number of
-bytes that can be processed immediately is returned.  If no characters can
-be written at all then \-1 is returned with
-.B errno
-set to
-.BR EAGAIN .
-.SS "Special characters"
-Some characters have special functions in some of the terminal modes.  These
-characters are as follows, with the MINIX 3 defaults shown in parentheses:
-.TP 5
-.BR INTR " (^?)"
-Special input character that is recognized if
-.B ISIG
-is set.  (For
-.B ISIG
-and other flags see the various modes sections below.)  It causes a
-.B SIGINT
-signal to be sent to all processes in the terminal process group.  (See the
-section on session leaders below.)
-.TP
-.BR QUIT " (^\e)"
-Special input character if
-.B ISIG
-is set.  Causes a
-.B SIGQUIT
-signal to be sent to the terminal process group.
-.TP
-.BR ERASE " (^H)"
-Special input character if
-.B ICANON
-is set.  Erases the last character in the current line.
-.TP
-.BR KILL " (^U)"
-Special input character if
-.B ICANON
-is set.  Erases the entire line.
-.TP
-.BR EOF " (^D)"
-Special input character if
-.B ICANON
-is set.  It is a line break character that is not itself returned to a
-reader.  If EOF is typed with no input present then the read returns zero,
-which normally causes the reader to assume that end-of-file is reached.
-.TP
-.BR CR " (^M)"
-Special input character if
-.B IGNCR
-or
-.B ICRNL
-is set.  It is a carriage return ('\er').  If
-.B IGNCR
-is set then
-.B CR
-is discarded.  If
-.B ICRNL
-is set and
-.B IGNCR
-is not set then
-.B CR
-is changed into an
-.B NL
-and has the same function as
-.BR NL.
-.TP
-.BR NL " (^J)"
-Special input character if
-.B ICANON
-is set.  It is both a newline ('\en') and a line break.
-.br
-Special output character if
-.B OPOST
-and
-.B ONLCR
-are set.  A
-.B CR NL
-sequence is output instead of just
-.BR NL .
-(MINIX 3 specific, but almost mandatory on any UNIX-like system.)
-.TP
-.BR TAB " (^I)"
-Special character on output if
-.B OPOST
-and
-.B XTABS
-are set.  It is transformed into the number of spaces necessary to reach a
-column position that is a multiple of eight.  (Only needed for terminals
-without hardware tabs.)
-.TP
-.BR EOL " (undefined)"
-Special input character if
-.B ICANON
-is set.  It is an additional line break.
-.TP
-.BR SUSP " (^Z)"
-Special input character if job control is implemented and
-.B ISIG
-is set.  It causes a
-.B SIGTSTP
-signal to be send to the terminal process group.  (MINIX 3 does not have job
-control.)
-.TP
-.BR STOP " (^S)"
-Special input character if
-.B IXON
-is set.  It suspends terminal output and is then discarded.
-.TP
-.BR START " (^Q)"
-Special output character if
-.B IXON
-is set.  It starts terminal output if suspended and is then discarded.  If
-.B IXANY
-is also set then any other character also starts terminal output, but they
-are not discarded.
-.TP
-.BR REPRINT " (^R)"
-Special input character if
-.B IEXTEN
-and
-.B ECHO
-are set.  Reprints the input queue from the last line break onwards.  A
-reprint also happens automatically if the echoed input has been messed up by
-other output and
-.B ERASE
-is typed.
-.TP
-.BR LNEXT " (^V)"
-Special input character if
-.B IEXTEN
-is set.  It is the "literal next" character that causes the next character
-to be input without any special processing.
-.TP
-.BR DISCARD " (^O)"
-Special input character if
-.B IEXTEN
-is set.  Causes output to be discarded until it is typed again.  (Implemented
-only under Minix-vmd.)
-.PP
-All of these characters except
-.BR CR ,
-.B NL
-and
-.B TAB
-may be changed or disabled under MINIX 3.  (Changes to
-.B START
-and
-.B STOP
-may be ignored under other termios implementations.)  The
-.B REPRINT
-and
-.B LNEXT
-characters are MINIX 3 extensions that are commonly present in other
-implementations.  \s-2POSIX\s+2 is unclear on whether
-.BR IEXTEN,
-.BR IGNCR
-and
-.BR ICRNL
-should be active in non-canonical mode, but under MINIX 3 they are.
-.SS "Terminal attributes"
-The attributes of a terminal, such as whether the mode should be canonical or
-non-canonical, are controlled by routines that use the
-.B termios
-structure as defined in
-.BR <termios.h> :
-.PP
-.RS
-.nf
-.ta +4n +10n +15n
-struct termios {
-	tcflag_t	c_iflag;	/* input modes */
-	tcflag_t	c_oflag;	/* output modes */
-	tcflag_t	c_cflag;	/* control modes */
-	tcflag_t	c_lflag;	/* local modes */
-	speed_t	c_ispeed;	/* input speed */
-	speed_t	c_ospeed;	/* output speed */
-	cc_t	c_cc[NCCS];	/* control characters */
-};
-.fi
-.RE
-.PP
-The types
-.BR tcflag ,
-.B speed_t
-and
-.B cc_t
-are defined in
-.B <termios.h>
-as unsigned integral types.
-.SS "Input Modes"
-The
-.B c_iflag
-field contains the following single bit flags that control input processing:
-.TP 5
-.B ICRNL
-Map
-.B CR
-to
-.B NL
-on input.
-.TP
-.B IGNCR
-Ignore
-.B CR
-on input.  This flag overrides
-.BR ICRNL .
-.TP
-.B INLCR
-Map
-.B NL
-to
-.B CR
-on input.  This is done after the
-.B IGNCR
-check.
-.TP
-.B IXON
-Enable start/stop output control.
-.TP
-.B IXOFF
-Enable start/stop input control.  (Not implemented.)
-.TP
-.B IXANY
-Allow any character to restart output.  (MINIX 3 specific.)
-.TP
-.B ISTRIP
-Strip characters to seven bits.
-.TP
-.B IGNPAR
-Ignore characters with parity errors.  (Not implemented.)
-.TP
-.B INPCK
-Enable input parity checking.  (Not implemented.)
-.TP
-.B PARMRK
-Mark parity errors by preceding the faulty character with '\e377', '\e0'.
-The character '\e377' is preceded by another '\e377' to avoid ambiguity.
-(Not implemented.)
-.TP
-.B BRKINT
-Send the signal
-.B SIGINT
-to the terminal process group when receiving a break condition.  (Not
-implemented.)
-.TP
-.B IGNBRK
-Ignore break condition.  If neither
-.B BRKINT
-or
-.B IGNBRK
-is set a break is input as a single '\e0', or if
-.B PARMRK
-is set as '\e377', '\e0', '\e0'.
-(Breaks are always ignored.)
-.SS "Output Modes"
-The
-.B c_oflag
-field contains the following single bit flags that control output processing:
-.TP
-.B OPOST
-Perform output processing.  This flag is the "main switch" on output
-processing.  All other flags are MINIX 3 specific.
-.TP
-.B ONLCR
-Transform an
-.B NL
-to a
-.B CR NL
-sequence on output.  Note that a key labeled "RETURN" or "ENTER" usually
-sends a
-.BR CR .
-In line oriented mode this is normally transformed into
-.B NL
-by
-.BR ICRNL .
-.B NL
-is the normal UNIX line delimiter ('\en').  On output an
-.B NL
-is transformed into the
-.B CR NL
-sequence that is necessary to reach the first column of the next line.
-(This is a common output processing function for UNIX-like systems, but not
-always separately switchable by an
-.B ONLCR
-flag.)
-.TP
-.B XTABS
-Transform a
-.B TAB
-into the number of spaces necessary to reach a column position that is a
-multiple of eight.
-.TP
-.B ONOEOT
-Discard
-.B EOT
-(^D) characters.  (Minix-vmd only.)
-.SS "Control Modes"
-The
-.B c_cflag
-field contains the following single bit flags and bit field for basic
-hardware control:
-.TP
-.B CLOCAL
-Ignore modem status lines.
-.TP
-.B CREAD
-Enable receiver.  (The receiver is always enabled.)
-.TP
-.B CSIZE
-Number of bits per byte.
-.B CSIZE
-masks off the values
-.BR CS5 ,
-.BR CS6 ,
-.BR CS7
-and
-.BR CS8
-that indicate that 5, 6, 7 or 8 bits are used.
-.TP
-.B CSTOPB
-Send two stop bits instead of one.  Two stop bits are normally used at 110
-baud or less.
-.TP
-.B PARENB
-Enable parity generation.
-.TP
-.B PARODD
-Generate odd parity if parity is generated, otherwise even parity.
-.TP
-.B HUPCL
-Drop the modem control lines on the last close of the terminal line.  (Not
-implemented.)
-.SS "Local Modes"
-The
-.B c_lflag
-field contains the following single bit flags that control various functions:
-.TP
-.B ECHO
-Enable echoing of input characters.  Most input characters are echoed as
-they are.  Control characters are echoed as 
-.BI "^" X
-where
-.I X
-is the letter used to say that the control character is
-.BI CTRL\- X\fR.
-The
-.BR CR ,
-.BR NL
-and
-.BR TAB
-characters are echoed with their normal effect unless they are escaped by
-.BR LNEXT .
-.TP
-.B ECHOE
-If
-.B ICANON
-and
-.B ECHO
-are set then echo
-.B ERASE
-and
-.B KILL
-as one or more backspace-space-backspace sequences to wipe out the last
-character or the entire line, otherwise they are echoed as they are.
-.TP
-.B ECHOK
-If
-.B ICANON
-and
-.B ECHO
-are set and
-.B ECHOE
-is not set then output an
-.B NL
-after the
-.B KILL
-character.  (For hardcopy terminals it is best to unset
-.B ECHOE
-and to set
-.BR ECHOK .)
-.TP
-.B ECHONL
-Echo
-.B NL
-even if
-.B ECHO
-is not set, but
-.B ICANON
-is set.
-.TP
-.B ICANON
-Canonical input.  This enables line oriented input and erase and kill
-processing.
-.TP
-.B IEXTEN
-Enable implementation defined input extensions.
-.TP
-.B ISIG
-Enable the signal characters
-.BR INTR ,
-.BR QUIT
-and
-.BR SUSP .
-.TP
-.B NOFLSH
-Disable the flushing of the input and output queues that is normally done if
-a signal is sent.
-.TP
-.B TOSTOP
-Send a
-.B SIGTTOU
-signal if job control is implemented and a background process tries to
-write.  (MINIX 3 has no job control.)
-.SS "Input and output speed"
-The input and output speed are encoded into the
-.B c_ispeed
-and
-.B c_ospeed
-fields.
-.B <termios.h>
-defines the symbols
-.BR B0 ,
-.BR B50 ,
-.BR B75 ,
-.BR B110 ,
-.BR B134 ,
-.BR B150 ,
-.BR B200 ,
-.BR B300 ,
-.BR B600 ,
-.BR B1200 ,
-.BR B1800 ,
-.BR B2400 ,
-.BR B4800 ,
-.BR B9600 ,
-.BR B19200 ,
-.BR B38400 ,
-.BR B57600
-and
-.BR B115200
-as values used to indicate the given baud rates.  The zero baud rate,
-.BR B0 ,
-if used for the input speed causes the input speed to be equal to the
-output speed.  Setting the output speed to zero hangs up the line.  One
-should use the functions
-.BR cfgetispeed() ,
-.BR cfgetospeed() ,
-.BR cfsetispeed()
-and
-.BR cfsetospeed()
-to get or set a speed, because the
-.B c_ispeed
-and
-.B c_ospeed
-fields may not be visible under other implementations.  (The
-.B c_ispeed
-and
-.B c_ospeed
-fields and the
-.B B57600
-and
-.B B115200
-symbols are MINIX 3 specific.)
-.SS "Special characters"
-The
-.B c_cc
-array contains the special characters that can be modified.  The array has
-length
-.B NCCS
-and is subscripted by the symbols
-.BR VEOF ,
-.BR VEOL ,
-.BR VERASE ,
-.BR VINTR ,
-.BR VKILL ,
-.BR VMIN ,
-.BR VQUIT ,
-.BR VTIME ,
-.BR VSUSP ,
-.BR VSTART ,
-.BR VSTOP ,
-.BR VREPRINT ,
-.BR VLNEXT
-and
-.BR VDISCARD .
-All these symbols are defined in
-.BR <termios.h> .
-Some implementations may give the same values to the
-.B VMIN
-and
-.B VTIME
-subscripts and the
-.B VEOF
-and
-.B VEOL
-subscripts respectively, and may ignore changes to
-.B START
-and
-.BR STOP .
-(Under MINIX 3 all special characters have their own
-.I c_cc
-slot and can all be modified.)
-.SS "Raw I/O Parameters"
-The
-.B MIN
-and
-.B TIME
-parameters can be used to adjust a raw connection to bursty input.
-.B MIN
-represents a minimum number of bytes that must be received before a read
-call returns.
-.B TIME
-is a timer of 0.1 second granularity that can be used to time out a read.
-Setting either of these parameters to zero has special meaning, which leads
-to the following four possibilities:
-.TP 5
-.B "MIN > 0, TIME > 0"
-.B TIME
-is an inter-byte timer that is started (and restarted) when a byte is
-received.  A read succeeds when either the minimum number of characters
-is received or the timer expires.  Note that the timer starts
-.B after
-the first character, so the read returns at least one byte.
-.TP
-.B "MIN > 0, TIME = 0"
-Now the timer is disabled, and a reader blocks indefinitely until at least
-.B MIN
-characters are received.
-.TP
-.B "MIN = 0, TIME > 0"
-.B TIME
-is now a read timer that is started when a read is executed.  The read will
-return if the read timer expires or if at least one byte is input.  (Note
-that a value of zero may be returned to the reader.)
-.TP
-.B "MIN = 0, TIME = 0"
-The bytes currently available are returned.  Zero is returned if no bytes
-are available.
-.SS "User Level Functions"
-Termios attributes are set or examined, and special functions can be
-performed by using the functions described in
-.BR termios (3).
-.SS "Session Leaders and Process Groups"
-With the use of the
-.B setsid()
-function can a process become a session leader.  A session leader forms a
-process group with a process group id equal to the process id of the session
-leader.  If a session leader opens a terminal device file then this terminal
-becomes the controlling tty of the session leader.  Unless the terminal is
-already the controlling tty of another process, or unless the
-.B O_NOCTTY
-flag is used to prevent the allocation of a controlling tty.  The process
-group of the session leader is now remembered as the terminal process group
-for signals sent by the terminal driver.  All the children and grandchildren
-of the session leader inherit the controlling terminal and process group
-until they themselves use
-.BR setsid() .
-.PP
-The controlling tty becomes inaccessible to the children of the session
-leader when the session leader exits, and a hangup signal is sent to all
-the members of the process group.  The input and output queues are flushed
-on the last close of a terminal and all attributes are reset to the default
-state.
-.PP
-A special device
-.B /dev/tty
-is a synonym for the controlling tty of a process.  It allows a process to
-reach the terminal even when standard input, output and error are
-redirected.  Opening this device can also be used as a test to see if a
-process has a controlling tty or not.
-.PP
-For MINIX 3 a special write-only device
-.B /dev/log
-exists for processes that want to write messages to the system console.
-Unlike the console this device is still accessible when a session leader
-exits.
-.PP
-Minix-vmd also has a
-.B /dev/log
-device, but this device is read-write.  All messages written to the log
-device or to the console when X11 is active can be read from
-.BR /dev/log .
-The system tries to preserve the log buffer over a reboot so that panic
-messages reappear in the log if the system happens to crash.
-.SS "Pseudo Terminals"
-Pseudo ttys allow a process such as a remote login daemon to set up a
-terminal for a remote login session.  The login session uses a device like
-.B /dev/ttyp0
-for input and output, and the remote login daemon uses the device
-.B /dev/ptyp0
-to supply input to or take output from the login session and transfer this
-to or from the originating system.  So the character flow may be:  Local
-user input sent to the remote system is written to
-.B /dev/ptyp0
-by the remote login daemon, undergoes input processing and appears on
-.B /dev/ttyp0
-as input to the login session.  Output from the login session to
-.B /dev/ttyp0
-undergoes output processing, is read from
-.B /dev/ptyp0
-by the remote login daemon and is send over to the local system to be
-displayed for the user.  (So there are only four data streams to worry about
-in a pseudo terminal.)
-.PP
-A pseudo terminal can be allocated by trying to open all the controlling
-devices
-.BI /dev/pty nn
-one by one until it succeeds.  Further opens will fail once a pty is open.
-The process should now fork, the child should become session leader, open
-the tty side of the pty and start a login session.
-.PP
-If the tty side is eventually closed down then reads from the pty side will
-return zero and writes return \-1 with
-.B errno
-set to
-.BR EIO .
-If the pty side is closed first then a
-.B SIGHUP
-signal is sent to the session leader and further reads from the tty side
-return zero and writes return \-1 with
-.B errno
-set to
-.BR EIO .
-(Special note:  A line erase may cause up to three times the size of the
-tty input queue to be sent to the pty reader as backspace overstrikes.  Some
-of this output may get lost if the pty reader cannot accept it all at once
-in a single read call.)
-.SS "Backwards compatibility"
-The
-.BR TIOCGETP ,
-.BR TIOCSETP ,
-.BR TIOCGETC
-and
-.BR TIOCSETC
-ioctl functions that are used by the old
-.B sgtty
-terminal interface are still supported by the terminal driver by emulation.
-Note that these old functions cannot control all termios attributes, so the
-terminal must be in a relatively sane state to avoid problems.
-.SH FILES
-The list below shows all devices that MINIX 3 and Minix-vmd have.  Not all of
-these devices are configured in by default, as indicated by the numbers
-(i/j/k, l/m/n) that tell the minimum, default and maximum possible number of
-these devices for MINIX 3 (i/j/k) and Minix-vmd (l/m/n).
-.TP 20
-.B /dev/console
-System console.
-.TP
-.B /dev/ttyc[1-7]
-Virtual consoles.  (0/1/7, 0/1/7)
-.TP
-.BR /dev/log
-Console log device.
-.TP
-.B /dev/tty0[0-3]
-Serial lines.  (0/2/2, 4/4/4)
-.TP
-.B /dev/tty[p-w][0-f]
-Pseudo ttys.  (0/0/64, 1/32/128)
-.TP
-.B /dev/pty[p-w][0-f]
-Associated pseudo tty controllers.
-.SH "SEE ALSO"
-.BR stty (1),
-.BR termios (3),
-.BR setsid (2),
-.BR read (2),
-.BR write (2).
-.SH BUGS
-A fair number of flags are not implemented under MINIX 3 (yet).  Luckily they
-are very limited utility and only apply to RS-232, not to the user interface.
-.SH AUTHOR
-Kees J. Bot (kjb@cs.vu.nl)
