Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / html / python / lib / module-pty.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python Documentation Index' />
<link rel="first" href="lib.html" title='Python Library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="module-fcntl.html" />
<link rel="prev" href="module-tty.html" />
<link rel="parent" href="unix.html" />
<link rel="next" href="module-fcntl.html" />
<meta name='aesop' content='information' />
<title>8.10 pty -- Pseudo-terminal utilities</title>
</head>
<body>
<DIV CLASS="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="8.9 tty "
href="module-tty.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="8. Unix Specific Services"
href="unix.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="8.11 fcntl "
href="module-fcntl.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-tty.html">8.9 tty </A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="unix.html">8. Unix Specific Services</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-fcntl.html">8.11 fcntl </A>
</div>
<hr /></div>
</DIV>
<!--End of Navigation Panel-->
<H1><A NAME="SECTION00101000000000000000000">
8.10 <tt class="module">pty</tt> --
Pseudo-terminal utilities</A>
</H1>
<A NAME="module-pty"></A>
<p class="availability">Availability: <span
class="platform">IRIX, Linux</span>.</p>
<P>
The <tt class="module">pty</tt> module defines operations for handling the
pseudo-terminal concept: starting another process and being able to
write to and read from its controlling terminal programmatically.
<P>
Because pseudo-terminal handling is highly platform dependant, there
is code to do it only for SGI and Linux. (The Linux code is supposed
to work on other platforms, but hasn't been tested yet.)
<P>
The <tt class="module">pty</tt> module defines the following functions:
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3020' xml:id='l2h-3020' class="function">fork</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Fork. Connect the child's controlling terminal to a pseudo-terminal.
Return value is <code>(<var>pid</var>, <var>fd</var>)</code>. Note that the child
gets <var>pid</var> 0, and the <var>fd</var> is <em>invalid</em>. The parent's
return value is the <var>pid</var> of the child, and <var>fd</var> is a file
descriptor connected to the child's controlling terminal (and also
to the child's standard input and output).
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3021' xml:id='l2h-3021' class="function">openpty</tt></b>(</nobr></td>
<td><var></var>)</td></tr></table></dt>
<dd>
Open a new pseudo-terminal pair, using <tt class="function">os.openpty()</tt> if
possible, or emulation code for SGI and generic <span class="Unix">Unix</span> systems.
Return a pair of file descriptors <code>(<var>master</var>, <var>slave</var>)</code>,
for the master and the slave end, respectively.
</dl>
<P>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
<td><nobr><b><tt id='l2h-3022' xml:id='l2h-3022' class="function">spawn</tt></b>(</nobr></td>
<td><var>argv</var><big>[</big><var>, master_read</var><big>[</big><var>, stdin_read</var><big>]</big><var></var><big>]</big><var></var>)</td></tr></table></dt>
<dd>
Spawn a process, and connect its controlling terminal with the current
process's standard io. This is often used to baffle programs which
insist on reading from the controlling terminal.
<P>
The functions <var>master_read</var> and <var>stdin_read</var> should be
functions which read from a file-descriptor. The defaults try to read
1024 bytes each time they are called.
</dl>
<DIV CLASS="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="8.9 tty "
href="module-tty.html"><img src='../icons/previous.png'
border='0' height='32' alt='Previous Page' width='32' /></A></td>
<td class='online-navigation'><a rel="parent" title="8. Unix Specific Services"
href="unix.html"><img src='../icons/up.png'
border='0' height='32' alt='Up One Level' width='32' /></A></td>
<td class='online-navigation'><a rel="next" title="8.11 fcntl "
href="module-fcntl.html"><img src='../icons/next.png'
border='0' height='32' alt='Next Page' width='32' /></A></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
href="contents.html"><img src='../icons/contents.png'
border='0' height='32' alt='Contents' width='32' /></A></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
border='0' height='32' alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
href="genindex.html"><img src='../icons/index.png'
border='0' height='32' alt='Index' width='32' /></A></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-tty.html">8.9 tty </A>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="unix.html">8. Unix Specific Services</A>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="module-fcntl.html">8.11 fcntl </A>
</div>
</div>
<hr />
<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>