Pseudo-tty driver (QNX)
Dev.pty [-C number] [-I number] [-O number] [-l letter] [-n number] [-N mastername[,slavename] &
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.
QNX programs that open ptys (e.g. telnetd, rlogind,
etc.) search an extended set of ptys. The search order is:
Applications that wish to use the same pty search ordering can open ptys using the open_pty() function in the unix library: int open_pty(int *masterfd, int *slavefd, char *name, struct termios *termp, struct winsize *winp);(The arguments name, termp and winp may be NULL.) |
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 &
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 its 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.
Dev.pty will terminate only upon receiving a signal, encountering a problem during startup, or having to fork() due to not being started in the "background" (i.e. the ampersand [&] was missing on its command-line invocation).
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. |