*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->Tru64 Unix man pages -> openpty (3)              
Title
Content
Arch
Section
 

openpty(3)

Contents


NAME    [Toc]    [Back]

       openpty, forkpty - Open and fork pseudoterminals

SYNOPSIS    [Toc]    [Back]

       #include <sys/termios.h> <sys/ioctl.h>

       int openpty(
               int *master,
               int *slave,
               char *name,
               struct termios *termp,
               struct winsize *winp ); pid_t forkpty(
               int *master,
               char *name,
               struct termios *termp,
               struct winsize *winp );

LIBRARY    [Toc]    [Back]

       Standard C Library (libc)

PARAMETERS    [Toc]    [Back]

       Points  to  the  returned  file  descriptor for the master
       pseudoterminal  (pty).   Points  to  the   returned   file
       descriptor  for  the slave pty.  Points to the pathname of
       the slave pty. This parameter is optional.  Specifies  the
       termios  structure  containing the terminal attributes for
       the opened slave pty. This parameter is optional.   Specifies
   the   winsize   structure   containing  the  window
       attributes for the opened slave  pty.  This  parameter  is
       optional.

DESCRIPTION    [Toc]    [Back]

       The openpty() function opens the pty master/slave pair and
       sets the terminal attributes of the  slave  pseudoterminal
       according  to  the  specifications  in  the termp and winp
       parameters.  The forkpty() function creates a  child  process
  and  establishes the slave pty as the child process'
       controlling terminal. The openpty()  function  will  first
       attempt to open an SVR4 slave device, such as /dev/pts/11.
       If unsuccessful, it will attempt a  BSD  device,  such  as
       /dev/ttyp1.

       Note  If  a  signal  handler  for  SIGCHLD  exists and the
       openpty() or forkpty() function is invoked  without  superuser
  privileges, the signal handler must be able to dismiss
 an unexpected SIGCHLD signal.

RETURN VALUES    [Toc]    [Back]

       Upon successful completion, the openpty() function returns
       a  value of 0 (zero). Otherwise, it returns a value of -1.

       On success, the forkpty() function returns a  value  of  0
       (zero)  to the child process and returns the process ID of
       the child process to the parent  process.  On  error,  the
       forkpty()  function  returns  a  value of -1 to the parent
       process and does not create a child process.






ERRORS    [Toc]    [Back]

       If any of the following conditions occurs,  the  openpty()
       function  sets errno to the corresponding value: The slave
       pty special files have been exhausted.  No more  ptys  can
       be opened. The configured number of ptys has been reached.
       The system limit for open file descriptors per process has
       already  reached  OPEN_MAX. The system limit for open file
       descriptors has been reached.

              [Tru64 UNIX]  Either the OPEN_MAX value or the perprocess
 soft descriptor limit is checked.  The system
 file table is full.  The system was  unable  to
              allocate  kernel  memory  for  more  file  descriptors/processes.
  The system-imposed  limit  on  the
              total  number  of  processes executing for a single
              user has been exceeded. This limit can be  exceeded
              by a process with superuser privilege.

SEE ALSO    [Toc]    [Back]

      
      
       Functions: fork(2)



                                                       openpty(3)
[ Back ]
 Similar pages
Name OS Title
perlfork OpenBSD Perl's fork() emulation
pthread_atfork IRIX register fork() handlers
vm_map_inherit FreeBSD set fork inheritance flags for a range within a map
atfork IRIX add fork pre and post interception routines
pthread_atfork Tru64 Declares fork handler routines to be called when the calling thread's process forks a child process
acl_get_fd IRIX get or set the ACL associated with an open file
funopen NetBSD open a stream
freopen Tru64 Open a stream
open IRIX Open a file
fopen Tru64 Open a stream
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service