ptsname(3C)ptsname(3C)NAME
ptsname() - get the pathname of a slave pty (pseudo-terminal)
SYNOPSIS
Obsolescent Interfaces
Remarks
supports STREAMS pty (see ptm(7) and pts(7)), and non-STREAMS pty (see pty(7)) which have different device naming conventions. Notice that
the STREAMS pty, being an optional feature, is supported only when it is installed on the system.
is useful only on systems that follow the insf(1M) naming conventions for pty (STREAMS and non-STREAMS).
DESCRIPTION
The passed parameter, fildes, is a file descriptor of an opened master pty. generates the name of the slave pty corresponding to this mas-
ter pty. This means that their minor numbers will be identical.
Obsolescent Interfaces
gets the pathname of a slave pty (pseudo-terminal).
RETURN VALUE
Upon successful completion, returns a string containing the full path name of a slave pty. Otherwise, a NULL pointer is returned. The
return value is pointed to static data area which is overwritten with each call to so it should be copied if it is to be saved.
ERRORS
fails and returns a NULL pointer under the following conditions:
o File descriptor does not refer to an open master pty.
o Request falls outside pty name-space.
o Pty device naming conventions have not been followed.
o failed to find a match.
WARNINGS
is obsolescent interface supported only for compatibility with existing DCE applications. New multi-threaded applications should use
EXAMPLES
The following example shows how is typically used for non-STREAMS pty to obtain the pathname of the slave pty corresponding to a master pty
obtained through a pty clone open.
...
The following example shows how is typically used on obtaining the pathname of the STREAMS slave pty corresponding to a STREAMS master pty.
...
AUTHOR
and were developed by HP and OSF.
SEE ALSO insf(1M), devnm(3), pty(7), grantpt(3C), unlockpt(3C), ptm(7), pts(7), ptem(7), ldterm(7).
ptsname(3C)
Check Out this Related Man Page
ptm(7) Miscellaneous Information Manual ptm(7)NAME
ptm - STREAMS master pty (pseudo-terminal) driver
SYNOPSIS DESCRIPTION
A pseudo-terminal (pty) consists of a tightly-coupled pair of character devices, called the master device and slave device. The pty master
and slave device drivers work together to simulate a terminal connection where the master provides a connection to the pseudo terminal
server process and the slave provides a terminal device special file access for the terminal application processes, as depicted below:
----------------
| pty functions |
Application <--> |----------------| <--> Server
Processes | Slave | Master | Process
| (pts) | (ptm) |
----------------
The slave driver, with (STREAMS pty emulation module) and (STREAMS line discipline module) pushed on top (not shown for simplicity), pro-
vides a terminal interface as described in termio(7). Whereas devices that provide the terminal interface described in termio(7) have a
hardware device behind them; in contrast, the slave device has another process manipulating it through the master side of the pty. Data
written on the master device is given to the slave device as input and data written on the slave device is presented as input on the master
device.
In order to use the STREAMS pty subsystem, a node for the master pty driver and N number of slave pty devices must be installed (see pts(7)
for details on slave pty). There are no nodes in the file system for each individual master device. Rather, the master driver is set up
as a STREAMS clone driver (see clone(7)) with its major device number set to the major for the clone driver and its minor device number set
to the major for the driver. The master driver is opened using the system call with as the device file parameter. The clone open finds
the next available minor number for the master device. The master device is available only if it and its corresponding slave device are
not already opened. Only one open is allowed on a master device whereas multiple open are allowed on the slave device. When the master
device is opened, the corresponding slave device is automatically locked out (see pts(7) on how to unlock the slave and obtain the slave
device name). After both the master and slave have been opened, the user has two file descriptors which represent the end points of a full
duplex connection composed of two streams. These two streams are automatically connected by the master and slave devices when they are
opened. The user may then push the necessary modules on the master and slave streams (e.g., and on for terminal semantics, and on for
Packet Mode feature).
The master and slave drivers pass all STREAMS messages to their adjacent drivers. Only the message needs some special processing because
the read queue of the master is connected to the write queue of the slave and vice versa. Hence, the flag is changed to flag and vice
versa whenever a message travels across the master-slave link. When the master device is closed, an message is sent to the corresponding
slave device which will render that slave device unusable. The process on the slave side gets the errno when attempting a system call on
the slave device but it will be able to read any data remaining on the slave stream. Finally, when all the data have been read, the system
call will return 0 (zero) indicating that the slave can no longer be used. On the last close of the slave device, a zero-length message is
sent to the corresponding master device. When the application on the master side issues a or system calls and a 0 is returned. The user
of the master device decides whether to close the master device file which will dismantle the streams on the master side. If the master
device remains opened, the corresponding slave device can be opened and used again by another user.
Unlike the slave device, the master device does not act like a terminal. If or is set, a read on the master device returns -1 with errno
set to if no data is available, and a write returns -1 with errno set to if there is internal flow control on the stream.
The master driver supports the following requests:
Determines whether the file descriptor is that of an open master device.
On success, it returns the major and minor number (type dev_t) of the master device which can be used to determine the name
of the corresponding slave device. On failure, it returns -1 with errno set to on HP-UX can return valid device number with
negative value. For example, with major number of the STREAMS pty master being 0x9c, will return 0x9C000000 which is a neg-
ative number. Therefore, it is imperative that applications check for an explicit -1 instead of "< 0" (less than 0) on the
return value.
is used by functions and User applications normally do not need to invoke this ioctl. The format of this ioctl is:
Unlocks the master and the corresponding slave devices.
On success, it returns 0. On failure, it returns -1 with errno set to is used by function User applications normally do not
need to invoke this ioctl. The format of this ioctl is:
This ioctl puts the STREAMS pty in and out of Remote Mode.
When Remote Mode is on, input data will be flow-controlled and passed through without any input processing regardless of the
terminal mode. When the pty master driver receives this ioctl, it will send an message downstream to via and The command in
the message is set to or depending whether to turn on or off the Remote Mode. The format of this ioctl is:
where the argument is set to 1 to turn on Remote Mode and 0 to turn it off. Remote Mode is normally used when doing remote
line editing in a window manager, or whenever flow-controlled input is required. Each write to the master device produces a
record boundary for the process reading the slave devices. In normal usage, a write of data is like the data typed as a
line on the terminal; a write of 0 (zero) bytes is like typing an (End-of-File) character.
This ioctl allows the master process to send a signal to the slave process.
The format of this ioctl is:
where the argument is the signal number as defined in the header file For example the master process can send an signal to
the slave process by doing:
AUTHOR
was developed by HP and OSF.
FILES
Streams pty master clone device
Streams pty slave devices (0 <=
N < where is a kernel tunable parameter which can be changed via SAM.
SEE ALSO insf(1M), getmsg(2), ioctl(2), open(2), read(2), write(2), grantpt(3C), ptsname(3C), unlockpt(3C), clone(7), ldterm(7), pckt(7), ptem(7),
pts(7), streamio(7), termio(7).
ptm(7)