166492cf0SYuri Pankov.\" 266492cf0SYuri Pankov.\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for 366492cf0SYuri Pankov.\" permission to reproduce portions of its copyrighted documentation. 466492cf0SYuri Pankov.\" Original documentation from The Open Group can be obtained online at 5c10c16deSRichard Lowe.\" http://www.opengroup.org/bookstore/. 666492cf0SYuri Pankov.\" 766492cf0SYuri Pankov.\" The Institute of Electrical and Electronics Engineers and The Open 866492cf0SYuri Pankov.\" Group, have given us permission to reprint portions of their 966492cf0SYuri Pankov.\" documentation. 1066492cf0SYuri Pankov.\" 1166492cf0SYuri Pankov.\" In the following statement, the phrase ``this text'' refers to portions 1266492cf0SYuri Pankov.\" of the system documentation. 1366492cf0SYuri Pankov.\" 1466492cf0SYuri Pankov.\" Portions of this text are reprinted and reproduced in electronic form 1566492cf0SYuri Pankov.\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition, 1666492cf0SYuri Pankov.\" Standard for Information Technology -- Portable Operating System 1766492cf0SYuri Pankov.\" Interface (POSIX), The Open Group Base Specifications Issue 6, 1866492cf0SYuri Pankov.\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics 1966492cf0SYuri Pankov.\" Engineers, Inc and The Open Group. In the event of any discrepancy 2066492cf0SYuri Pankov.\" between these versions and the original IEEE and The Open Group 2166492cf0SYuri Pankov.\" Standard, the original IEEE and The Open Group Standard is the referee 2266492cf0SYuri Pankov.\" document. The original Standard can be obtained online at 2366492cf0SYuri Pankov.\" http://www.opengroup.org/unix/online.html. 2466492cf0SYuri Pankov.\" 25c10c16deSRichard Lowe.\" This notice shall appear on any product containing this material. 2666492cf0SYuri Pankov.\" 2766492cf0SYuri Pankov.\" The contents of this file are subject to the terms of the 2866492cf0SYuri Pankov.\" Common Development and Distribution License (the "License"). 2966492cf0SYuri Pankov.\" You may not use this file except in compliance with the License. 3066492cf0SYuri Pankov.\" 3166492cf0SYuri Pankov.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 3266492cf0SYuri Pankov.\" or http://www.opensolaris.org/os/licensing. 3366492cf0SYuri Pankov.\" See the License for the specific language governing permissions 3466492cf0SYuri Pankov.\" and limitations under the License. 3566492cf0SYuri Pankov.\" 3666492cf0SYuri Pankov.\" When distributing Covered Code, include this CDDL HEADER in each 3766492cf0SYuri Pankov.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. 3866492cf0SYuri Pankov.\" If applicable, add the following below this CDDL HEADER, with the 3966492cf0SYuri Pankov.\" fields enclosed by brackets "[]" replaced with your own identifying 4066492cf0SYuri Pankov.\" information: Portions Copyright [yyyy] [name of copyright owner] 4166492cf0SYuri Pankov.\" 4266492cf0SYuri Pankov.\" 4366492cf0SYuri Pankov.\" Copyright 1989 AT&T 4466492cf0SYuri Pankov.\" Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved 4566492cf0SYuri Pankov.\" Copyright (c) 2002, Sun Microsystems, Inc. All Rights Reserved. 46*1fa2a664SJoshua M. Clulow.\" Copyright 2022 Oxide Computer Company 4766492cf0SYuri Pankov.\" 48*1fa2a664SJoshua M. Clulow.Dd February 5, 2022 49*1fa2a664SJoshua M. Clulow.Dt PTSNAME 3C 50*1fa2a664SJoshua M. Clulow.Os 51*1fa2a664SJoshua M. Clulow.Sh NAME 52*1fa2a664SJoshua M. Clulow.Nm ptsname 53*1fa2a664SJoshua M. Clulow.Nd get the name of the subsidiary device of a pseudo-terminal 54*1fa2a664SJoshua M. Clulow.Sh SYNOPSIS 55*1fa2a664SJoshua M. Clulow.In stdlib.h 56*1fa2a664SJoshua M. Clulow.Ft char * 57*1fa2a664SJoshua M. Clulow.Fo ptsname 58*1fa2a664SJoshua M. Clulow.Fa "int fildes" 59*1fa2a664SJoshua M. Clulow.Fc 60*1fa2a664SJoshua M. Clulow.Sh DESCRIPTION 61*1fa2a664SJoshua M. ClulowThe 62*1fa2a664SJoshua M. Clulow.Fn ptsname 63*1fa2a664SJoshua M. Clulowfunction returns the name of the pseudo-terminal subsidiary device associated 64*1fa2a664SJoshua M. Clulowwith a pseudo-terminal manager device. 65*1fa2a664SJoshua M. ClulowThe 66*1fa2a664SJoshua M. Clulow.Fa fildes 67*1fa2a664SJoshua M. Clulowargument is a file descriptor returned from a successful open of the 68*1fa2a664SJoshua M. Clulowpseudo-terminal manager device; e.g., by calling 69*1fa2a664SJoshua M. Clulow.Xr posix_openpt 3C 70*1fa2a664SJoshua M. Clulowor by performing an 71*1fa2a664SJoshua M. Clulow.Xr open 2 72*1fa2a664SJoshua M. Clulowof the 73*1fa2a664SJoshua M. Clulow.Xr ptm 7D 74*1fa2a664SJoshua M. Clulowdevice. 75*1fa2a664SJoshua M. Clulow.Pp 76*1fa2a664SJoshua M. ClulowThe 77*1fa2a664SJoshua M. Clulow.Fn ptsname 78*1fa2a664SJoshua M. Clulowfunction returns a pointer to a string containing the null-terminated 79*1fa2a664SJoshua M. Clulowpath name of the subsidiary device. 80*1fa2a664SJoshua M. ClulowThis string is of the form 81*1fa2a664SJoshua M. Clulow.Pa /dev/pts/N , 82*1fa2a664SJoshua M. Clulowwhere 83*1fa2a664SJoshua M. Clulow.Sy N 84*1fa2a664SJoshua M. Clulowis a non-negative integer. 85*1fa2a664SJoshua M. Clulow.Sh RETURN VALUES 86*1fa2a664SJoshua M. ClulowIf successful, the 87*1fa2a664SJoshua M. Clulow.Fn ptsname 88*1fa2a664SJoshua M. Clulowfunction returns a pointer to a string which is the name of the pseudo-terminal 89*1fa2a664SJoshua M. Clulowsubsidiary device. 90*1fa2a664SJoshua M. ClulowThis value points to a static data area that is overwritten by each call to 91*1fa2a664SJoshua M. Clulow.Fn ptsname . 92*1fa2a664SJoshua M. Clulow.Pp 93*1fa2a664SJoshua M. ClulowUpon failure, 94*1fa2a664SJoshua M. Clulow.Fn ptsname 95*1fa2a664SJoshua M. Clulowreturns 96*1fa2a664SJoshua M. Clulow.Dv NULL . 97*1fa2a664SJoshua M. ClulowThis could occur if 98*1fa2a664SJoshua M. Clulow.Fa fildes 99*1fa2a664SJoshua M. Clulowis an invalid file descriptor or if the subsidiary device name does not exist 100*1fa2a664SJoshua M. Clulowin the file system. 101*1fa2a664SJoshua M. Clulow.Sh INTERFACE STABILITY 102*1fa2a664SJoshua M. Clulow.Sy Committed 103*1fa2a664SJoshua M. Clulow.Sh MT LEVEL 104*1fa2a664SJoshua M. Clulow.Sy Safe 105*1fa2a664SJoshua M. Clulow.Sh SEE ALSO 106*1fa2a664SJoshua M. Clulow.Xr open 2 , 107*1fa2a664SJoshua M. Clulow.Xr grantpt 3C , 108*1fa2a664SJoshua M. Clulow.Xr posix_openpt 3C , 109*1fa2a664SJoshua M. Clulow.Xr ttyname 3C , 110*1fa2a664SJoshua M. Clulow.Xr unlockpt 3C , 111*1fa2a664SJoshua M. Clulow.Xr attributes 5 , 112*1fa2a664SJoshua M. Clulow.Xr standards 5 , 113*1fa2a664SJoshua M. Clulow.Xr ptm 7D , 114*1fa2a664SJoshua M. Clulow.Xr pts 7D 115