home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / osf / osf1 / 43 < prev    next >
Encoding:
Text File  |  1992-12-30  |  4.6 KB  |  120 lines

  1. Newsgroups: comp.unix.osf.osf1
  2. Path: sparky!uunet!gatech!rpi!think.com!paperboy.osf.org!meissner
  3. From: meissner@osf.org (Michael Meissner)
  4. Subject: Re: /dev/ptm
  5. In-Reply-To: rince@dcs.warwick.ac.uk's message of 22 Dec 92 09:14:37 GMT
  6. Message-ID: <MEISSNER.92Dec30222841@curley.osf.org>
  7. Lines: 106
  8. Sender: news@osf.org (USENET News System)
  9. Organization: Open Software Foundation
  10. References: <1992Dec22.091437.11429@dcs.warwick.ac.uk>
  11. Date: Thu, 31 Dec 1992 03:28:44 GMT
  12. Lines: 106
  13.  
  14. In article <1992Dec22.091437.11429@dcs.warwick.ac.uk> rince@dcs.warwick.ac.uk (James Bonfield) writes:
  15.  
  16. | Hello,
  17. |     Why does the 'script' command allocate itself a new controlling tty
  18. | and yet no other 'standard' (eg emacs, fep) program seem able to? I've read
  19. | the manuals for other machines and written programs to grab themselves a new
  20. | tty by dissociating, becoming a session leader, and opening a terminal that
  21. | current has no controlling process.
  22. |     This works on all machines I've tried except an Alpha running OSF1. By
  23. | debugging script a bit I figured out it opens (read-write) /dev/ptm. This is
  24. | not in any of the online manuals as far as I can see, and neither is how to
  25. | become the controlling process. Can anyone offer assistance here?
  26.  
  27. While I can only speak for the OSF/1 that we ship to the licensees,
  28. and not what gets shiped ultimately to customers, the openpty and
  29. forkpty functions will open pty's for you.  Revision 1.0.x of OSF/1
  30. from us had the functions in libutil.a.  Revision 1.[12].x of OSF/1
  31. moved the functions to libc.a.  In revision 1.0 the manual did not
  32. cover these functions, an oversight which was fixed in 1.1.
  33.  
  34. The file /dev/ptm that you mention is a streams clone device that when
  35. opened gives you the file descriptor to the master end.  You get the
  36. slave file descriptor by taking the minor device number of the master
  37. fd, converting it to ascii, and prepending '/dev/pts/' to it, and
  38. opening that filename.
  39.  
  40. NAME
  41.      openpty, forkpty - Opens a pseudoterminal master and slave
  42.      device-pair
  43.  
  44. LIBRARY
  45.      Standard C Library (libc.a)
  46.  
  47. SYNOPSIS
  48.      int openpty(
  49.          int *amaster,
  50.          int *aslave,
  51.          char *name,
  52.          struct termios *termp,
  53.          struct winsize *winp);
  54.      int  forkpty(
  55.          int *amaster,
  56.          char *name,
  57.          struct termios *termp,
  58.          struct winsize *winp);
  59.  
  60. PARAMETERS
  61.      amaster   Points to the file descriptor of the master pty,
  62.            typically /dev/ptmx_bsd.
  63.  
  64.      aslave    Points to the file descriptor of a slave pty,
  65.            /dev/pty/N.
  66.  
  67.      name      Contains the name returned name of the slave pty
  68.            that was opened, or a null pointer if the open was
  69.            not successful.
  70.  
  71.      termp     Points to the termios structure containing the
  72.            terminal attributes for the opened slave pty.
  73.  
  74.      winp      Points to the winsize structure containing the
  75.            window attributes for the opened slave pty.
  76.  
  77. DESCRIPTION
  78.      The openpty() function opens a master and slave device-pair
  79.      for a pseudoterminal, and sets the terminal attributes for
  80.      the slave device according to the specifications in the term
  81.      and winp parameters.  This function invokes the pty_master()
  82.      and pty_slave() functions to perform the opening of the mas-
  83.      ter and slave devices.  If either of these functions return
  84.      [ENOENT] indicating failure due to a lack of available ptys,
  85.      the sysconfig command should be used to increase the limit
  86.      on these type devices in the system.
  87.  
  88.      The forkpty() function allocates and invokes a child process
  89.      for a pseudoterminal.  It sets the child process's pty ter-
  90.      minal attributes according to the specifications in the term
  91.      and winp parameters.
  92.  
  93. RETURN VALUES
  94.      Upon successful completion, the openpty() function returns a
  95.      value of 0 (zero).  Otherwise, it returns a value of -1. The
  96.      forkpty() function returns a value of 0 (zero) to the child
  97.      process, and returns the process ID of the child process to
  98.      the parent process on success.  However, on error, this
  99.      function returns a value of -1 to the parent process, and
  100.      does not create a child process.
  101.  
  102. ERRORS
  103.      If any of the following conditions occurs, the openpty()
  104.      function sets errno to the corresponding value:
  105.  
  106.      [ENXIO]   Unable to locate the specified pty.
  107.  
  108.      [ENOENT]  There are no more ptys that can be opened.
  109.  
  110. RELATED INFORMATION
  111.      Commands: sysconfig(8).
  112.  
  113.      Functions: pty_master, pty_slave.
  114. --
  115. Michael Meissner    email: meissner@osf.org        phone: 617-621-8861
  116. Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142
  117.  
  118. You are in a twisty little passage of standards, all conflicting.
  119.