Dev.pty

Pseudo-tty driver (QNX)

Syntax:

Dev.pty [-C number] [-I number] [-O number]
        [-l letter] [-n number] [-N mastername[,slavename] &

Options:

-C number
The size of the canonical input buffer (default is 256).
-I number
The size of the raw input buffer (default is 512).
-l letter
("el") The last letter of the device name (default is p, which results in /dev/ttyp). Other choices are q, r, or s.
-n number
The maximum number of pseudo tty pairs. Device pairs will be numbered incrementally in hexadecimal notation. Values greater than 16 (f) are possible but are not recommended for UNIX compatibility reasons. (default is 4)
-N mastername[,slavename]
The name to use for the master (and optionally, slave) sides of the pseudo tty devices. If full paths (i.e. ones which include the directory under which the devices should be registered) are not specified, the names will implicitly be registered under /dev. (The default mastername is /dev/pty and the default slavename is /dev/tty.) of the master (and optionally, slave)
-O number
The size of the output buffer (default is 512).

Examples:

Start Dev.pty; use defaults (this would create /dev/ptyp0 through /dev/ptyp3 and /dev/ttyp0 through /dev/ttyp3):

    Dev.pty &

Create 16 device pairs called /dev/ptyq0 through /dev/ptyqf and /dev/ttyq0 through /dev/ttyqf:

    Dev.pty -n 16 -l q &

Create 32 device pairs under a directory /dev/pseudo that is managed by a second Dev administrator. Name the devices /dev/pseudo/m0 through /dev/pseudo/m1f and /dev/pseudo/q0 through /dev/pseudo/q1f:

    Dev -N /dev/pseudo -n65 &
    Dev.pty -n32 -N /dev/pseudo/m,/dev/pseudo/s &

Description:

The Dev.pty driver manages pseudo tty devices (called ptys) in a QNX system. Pseudo devices are allocated in pairs; the members of each pair are internally connected to each other. Any data written to the master side (e.g. /dev/ptyp0) will be available for reading on the slave side (e.g. /dev/ttyp0).

Typically, a program will open the master side of a pty for read/write and then launch another program (e.g. a Shell) on the corresponding slave device. The slave program will think it's running on a normal tty device. Nevertheless, all the data that the slave writes will go to the master and all the data that the slave reads will really be data generated by the master.

Remember that Dev.pty must be run as root and cannot be started until the Device Manager (Dev) has been started.

Exit status:

Dev.pty will terminate only upon receipt of a signal, upon encountering a problem during startup, or upon having to fork() due to not being started in the "background" (i.e. the ampersand (&) was missing on its command-line invocation).

0
received a signal and performed a clean shutdown OR not started in the background from the shell and successfully forked to another process.
>0
An error occurred during startup. An error message was written to standard error.

A common cause of failure on startup is that Dev has hit its maximum number of devices and rejects Dev.pty's attempt to register. If this happens, increase the value of Dev's -n option.

Files:

Dev.pty closes its standard input, standard output and standard error immediately after startup initializations have been completed. An error message is written to standard error if an initialization problem is encountered.

Dev.pty will cause Dev to adopt a number of pairs of character special files under it's directory (/dev). Usually pairs will be named ptycn/ttycn where c is p (the default) or the letter specified by the -l option, and n will range from 1 to the number of pseudo-tty devices specified by the Dev.pty -n option.

See also: