Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

grantpt(3c) [hpux man page]

grantpt(3C)															       grantpt(3C)

NAME
grantpt - grant access to the STREAMS slave pty SYNOPSIS
DESCRIPTION
The passed parameter, fildes, is a file descriptor that is returned from a successful open of a STREAMS master pty (pseudo-terminal) device. The function modifies the ownership and mode of the slave pty device special file associated with its master pty counterpart. A root program is spawned to change ownership and mode of the pty slave device file in the following way: The group ID is set to a reserved group named "tty". The slave user ID is set to the effective owner of the calling process. The permissions of the slave device are set so that the owner is allowed read and write access and the group is allowed write access. RETURN VALUE
Upon successful completion, the function returns a value of 0 (zero). Otherwise, it returns a value of -1. Failure may result under the following conditions: o The file descriptor specified by the fildes parameter is not an open file descriptor. o The file descriptor specified by the fildes parameter is not associated with a STREAMS master pty device. o The corresponding slave pty device cannot be accessed. WARNINGS
The function may also fail if the application has installed a signal handler to catch the SIGCHLD (death of a child) signal. EXAMPLES
The following example shows how is typically used. ... AUTHOR
was developed by HP and OSF. SEE ALSO
open(2), unlockpt(3C), ptsname(3C), ptm(7), pts(7), ptem(7), ldterm(7). grantpt(3C)

Check Out this Related Man Page

GRANTPT(3)						     Linux Programmer's Manual							GRANTPT(3)

NAME
grantpt - grant access to the slave pseudo-terminal SYNOPSIS
#define _XOPEN_SOURCE #include <stdlib.h> int grantpt(int fd); DESCRIPTION
The grantpt() function changes the mode and owner of the slave pseudo-terminal device (pty) corresponding to the master pty referred to by fd. The user ID of the slave is set to the real UID of the calling process. The group ID is set to an unspecified value (e.g., tty). The mode of the slave is set to 0620 (crw--w----). The behavior of grantpt() is unspecified if a signal handler is installed to catch SIGCHLD signals. RETURN VALUE
When successful, grantpt() returns 0. Otherwise, it returns -1 and sets errno appropriately. ERRORS
EACCES The corresponding slave pty could not be accessed. EBADF The fd argument is not a valid open file descriptor. EINVAL The fd argument is valid but not associated with a master pty. VERSIONS
grantpt() is provided in glibc since version 2.1. CONFORMING TO
POSIX.1-2001. NOTES
This is part of the Unix98 pty support, see pts(4). Many systems implement this function via a set-user-ID helper binary called "pt_chown". With Linux devpts no such helper binary is required. SEE ALSO
open(2), posix_openpt(3), ptsname(3), unlockpt(3), pts(4), feature_test_macros(7), pty(7) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
2008-06-14 GRANTPT(3)
Man Page

4 More Discussions You Might Find Interesting

1. Programming

good example for pty usage ?

i am looking for a good example to explain *why* someone should use pty's. (3 Replies)
Discussion started by: grumpf
3 Replies

2. Solaris

need to restrict user to his home dir

Hello, i need to create a user who's access is restricted only to his home directory and below, i restricted his pty access by adding 'no-pty' to the options of the ssh key in authorized_keys file. However, sftp access still allows this user access to all my file system thanks (5 Replies)
Discussion started by: lidram
5 Replies

3. Programming

Some how the open(file,flag, acc) returns 0 and write to the screen, instead of the file ???

I am out of idea what to do to resolve the problem! I need to use the open(file, for.., access) function to write a file. Never have the situation like that: it is return 0 - zero. As a result all write(..) going to the screen! What the problem it could be? I do not even know... (2 Replies)
Discussion started by: alex_5161
2 Replies

4. AIX

Error while instrumenting purify

when i instrument ourify i am getting error like .*** OI_init: Error, cannot connect to X server Purify or PureCoverage slave: Warning: Can't open display "localhost:0", using tty mode. . Got it] I am using AIX1.6 OS i have xwin32 installed in my windows.. (1 Reply)
Discussion started by: greenworld123
1 Replies