Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ ptsname_r(3) — OSF/1 3.0 αXP

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

openpty(3)

pty(7)

ptsname(3)  —  Subroutines

NAME

ptsname, ptsname_r − Gets the name of a slave pty

LIBRARY

Standard C Library (libc.a)

SYNOPSIS

char ∗ptsname(
int masterfd); int ptsname_r(
int masterfd,
char ∗slavename,
int len);

PARAMETERS

masterfdSpecifies a file descriptor that is returned from a successful open of the master pty. 

slavenamePoints to the character array for the resulting null-terminated pathname of the slave pty. 

lenSpecifies the length of the slave pty specified by slavename.  This length must be 32 bytes. 

DESCRIPTION

The ptsname() function and the System V Release 4 pty name space are provided for System V Release 4 compatibility.  The ptsname() function returns the name of the slave pty associated with a master pty. 

The ptsname_r() function is the reentrant version of the ptsname() function. 

RETURN VALUES

Upon successful completion, the ptsname() function returns a pointer to a string that contains the null-terminated pathname of the slave pty. The pathname has the form: /dev/pts /N.  The pointer is to a static data area that is overwritten by each call to the ptsname() function. 

When the ptsname() function fails, it returns a null pointer.  Failure can result under the following conditions:

       •The file descriptor specified by the masterfd parameter is an invalid file descriptor. 

       •The file system does not contain any more slave device names. 

Upon successful completion, the ptsname_r() function stores the resulting string in the array pointed to by the slavename parameter, and a value of 0 (zero) is returned.  Otherwise, -1 is returned, and errno may be set. 

ERRORS

If the following conditions occur, the ptsname_r() function sets errno to the following value:

[EINVAL]The slavename parameter is invalid or the len parameter is too small. 

RELATED INFORMATION

Functions: openpty(3), pty(7). 

Guides: System V Compatibility User’s Guide

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026