193 lines
4.5 KiB
HTML
193 lines
4.5 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of POSIX_OPENPT</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>POSIX_OPENPT</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2017-09-15<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
posix_openpt - open a pseudoterminal device
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<PRE>
|
|
<B>#include <<A HREF="file:///usr/include/stdlib.h">stdlib.h</A>></B>
|
|
<B>#include <<A HREF="file:///usr/include/fcntl.h">fcntl.h</A>></B>
|
|
|
|
<B>int posix_openpt(int </B><I>flags</I><B>);</B>
|
|
</PRE>
|
|
|
|
<P>
|
|
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+feature_test_macros">feature_test_macros</A></B>(7)):
|
|
|
|
|
|
<P>
|
|
|
|
|
|
<B>posix_openpt</B>():
|
|
|
|
_XOPEN_SOURCE >= 600
|
|
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
The
|
|
<B>posix_openpt</B>()
|
|
|
|
function opens an unused pseudoterminal master device, returning a
|
|
file descriptor that can be used to refer to that device.
|
|
<P>
|
|
|
|
The
|
|
<I>flags</I>
|
|
|
|
argument is a bit mask that ORs together zero or more of
|
|
the following flags:
|
|
<DL COMPACT>
|
|
<DT id="1"><B>O_RDWR</B>
|
|
|
|
<DD>
|
|
Open the device for both reading and writing.
|
|
It is usual to specify this flag.
|
|
<DT id="2"><B>O_NOCTTY</B>
|
|
|
|
<DD>
|
|
Do not make this device the controlling terminal for the process.
|
|
</DL>
|
|
<A NAME="lbAE"> </A>
|
|
<H2>RETURN VALUE</H2>
|
|
|
|
On success,
|
|
<B>posix_openpt</B>()
|
|
|
|
returns a nonnegative file descriptor which is the lowest
|
|
numbered unused file descriptor.
|
|
On failure, -1 is returned, and
|
|
<I>errno</I>
|
|
|
|
is set to indicate the error.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
See
|
|
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2).
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>VERSIONS</H2>
|
|
|
|
Glibc support for
|
|
<B>posix_openpt</B>()
|
|
|
|
has been provided since version 2.2.1.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>ATTRIBUTES</H2>
|
|
|
|
For an explanation of the terms used in this section, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<B>posix_openpt</B>()
|
|
|
|
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
POSIX.1-2001, POSIX.1-2008.
|
|
<P>
|
|
|
|
<B>posix_openpt</B>()
|
|
|
|
is part of the UNIX 98 pseudoterminal support (see
|
|
<B><A HREF="/cgi-bin/man/man2html?4+pts">pts</A></B>(4)).
|
|
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>NOTES</H2>
|
|
|
|
Some older UNIX implementations that support System V
|
|
(aka UNIX 98) pseudoterminals don't have this function, but it
|
|
is easy to implement:
|
|
<P>
|
|
|
|
|
|
|
|
int
|
|
posix_openpt(int flags)
|
|
{
|
|
<BR> return open("/dev/ptmx", flags);
|
|
}
|
|
|
|
|
|
<P>
|
|
|
|
Calling
|
|
<B>posix_openpt</B>()
|
|
|
|
creates a pathname for the corresponding pseudoterminal slave device.
|
|
The pathname of the slave device can be obtained using
|
|
<B><A HREF="/cgi-bin/man/man2html?3+ptsname">ptsname</A></B>(3).
|
|
|
|
The slave device pathname exists only as long as the master device is open.
|
|
<A NAME="lbAK"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+getpt">getpt</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+grantpt">grantpt</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+ptsname">ptsname</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+unlockpt">unlockpt</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?4+pts">pts</A></B>(4),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?7+pty">pty</A></B>(7)
|
|
|
|
<A NAME="lbAL"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="3"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="4"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="5"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="6"><A HREF="#lbAE">RETURN VALUE</A><DD>
|
|
<DT id="7"><A HREF="#lbAF">ERRORS</A><DD>
|
|
<DT id="8"><A HREF="#lbAG">VERSIONS</A><DD>
|
|
<DT id="9"><A HREF="#lbAH">ATTRIBUTES</A><DD>
|
|
<DT id="10"><A HREF="#lbAI">CONFORMING TO</A><DD>
|
|
<DT id="11"><A HREF="#lbAJ">NOTES</A><DD>
|
|
<DT id="12"><A HREF="#lbAK">SEE ALSO</A><DD>
|
|
<DT id="13"><A HREF="#lbAL">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:52 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|