Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

ptsname(3posix) [linux man page]

PTSNAME(P)						     POSIX Programmer's Manual							PTSNAME(P)

NAME
ptsname - get name of the slave pseudo-terminal device SYNOPSIS
#include <stdlib.h> char *ptsname(int fildes); DESCRIPTION
The ptsname() function shall return the name of the slave pseudo-terminal device associated with a master pseudo-terminal device. The fildes argument is a file descriptor that refers to the master device. The ptsname() function shall return a pointer to a string containing the pathname of the corresponding slave device. The ptsname() function need not be reentrant. A function that is not required to be reentrant is not required to be thread-safe. RETURN VALUE
Upon successful completion, ptsname() shall return a pointer to a string which is the name of the pseudo-terminal slave device. Upon fail- ure, ptsname() shall return a null pointer. This could occur if fildes is an invalid file descriptor or if the slave device name does not exist in the file system. ERRORS
No errors are defined. The following sections are informative. EXAMPLES
None. APPLICATION USAGE
The value returned may point to a static data area that is overwritten by each call to ptsname(). RATIONALE
None. FUTURE DIRECTIONS
None. SEE ALSO
grantpt() , open() , ttyname() , unlockpt() , the Base Definitions volume of IEEE Std 1003.1-2001, <stdlib.h> COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2003 Edition, Standard for Information Technol- ogy -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html . IEEE
/The Open Group 2003 PTSNAME(P)

Check Out this Related Man Page

PTSNAME(3)						   BSD Library Functions Manual 						PTSNAME(3)

NAME
ptsname -- get the pathname of the slave pseudo-terminal device LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <stdlib.h> char * ptsname(int masterfd); DESCRIPTION
The ptsname() function returns the pathname of the slave pseudo-terminal device that corresponds to the master pseudo-terminal device associ- ated with masterfd. The ptsname() function is not reentrant or thread-safe. RETURN VALUES
If successful, ptsname() returns a pointer to a nul-terminated string containing the pathname of the slave pseudo-terminal device. If an error occurs ptsname() will return NULL and errno is set to indicate the error. ERRORS
The ptsname() function will fail if: [EACCESS] the corresponding pseudo-terminal device could not be accessed. [EBADF] masterfd is not a valid descriptor. [EINVAL] masterfd is not associated with a master pseudo-terminal device. NOTES
The error returns of ptsname() are a NetBSD extension. The ptsname() function is equivalent to: struct ptmget pm; return ioctl(masterfd, TIOCPTSNAME, &pm) == -1 ? NULL : pm.ps; SEE ALSO
ioctl(2), grantpt(3), posix_openpt(3), unlockpt(3) STANDARDS
The ptsname() function conforms to IEEE Std 1003.1-2001 (``POSIX.1''). Its first release was in X/Open Portability Guide Issue 4, Version 2 (``XPG4.2''). BSD
May 25, 2004 BSD
Man Page

7 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

How to attach an xterm to a process/thread ?

Hi folks, I would like to know how to hook up an xterm to another process. Here is a high level view of what I am looking for 1. Main program starts 2. It creates an new xterm window 3. It then forks a second process & passes the xterm handle to it 4. The second process uses the second... (4 Replies)
Discussion started by: RipClaw
4 Replies

2. Programming

Pseudo-Terminal Programming-Extra newline

Hello everyone, im having a hard time figuring out why the program posted below prints an extra newline every time I type the enter key.I suspect this has to do with the terminal line discipline, but I can't really understand why.I have tried turning on/off several terminal options and disable... (0 Replies)
Discussion started by: rlex
0 Replies

3. Programming

Race condition with PTY

I've been experimenting with pseudo-terminals and found something I don't quite understand. Writing an EOF character to the master end doesn't work quite as I expect. Once I've written any other data, the master pty seems to treat a single ^D as a seperator, i.e. writing "abcabc" would let cat do... (1 Reply)
Discussion started by: Corona688
1 Replies

4. UNIX for Advanced & Expert Users

read system call reading the same data

Hi, I wrote a program, to read from a master terminal. However, the 'read' system call keeps returning the same data endlessly (I expected it to read once and then block). What will cause t data to be flushed, after 1 read? #include <stdio.h> #include <string.h> #include <sys/types.h>... (1 Reply)
Discussion started by: karthikb23
1 Replies

5. Linux

segmentation fault help required

After i build fep and do fep echo i get a Segmentation fault (gdb) bt full #0 0x000000341da785f4 in strncpy () from /lib64/libc.so.6 No symbol table info available. #1 0x000000000040228d in get_pty_master () at fep_main.c:888 pty = 0x1dd51a90 <Address 0x1dd51a90 out of bounds>... (2 Replies)
Discussion started by: nvprnth
2 Replies

6. Programming

scandir() and threads

I couldn't find anywhere informations about it. Is scandir() thread-safe? (4 Replies)
Discussion started by: dawwin
4 Replies

7. Red Hat

How to install expect after installing tcl on Redhat Linux

Hi, I have install tcl and then expect but I am getting below ouput while trying which expect which expect /usr/bin/which: no expect in (/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin) I have copied both in... (6 Replies)
Discussion started by: manish_1678
6 Replies