Browse Source

Rewritten posix_openpt manual that doesn't include any of the POSIX

text.  OK deraadt@
OPENBSD_5_3
millert 12 years ago
parent
commit
3e820c77a4
1 changed files with 49 additions and 74 deletions
  1. +49
    -74
      src/lib/libc/stdlib/posix_openpt.3

+ 49
- 74
src/lib/libc/stdlib/posix_openpt.3 View File

@ -1,50 +1,25 @@
.\" $OpenBSD: posix_openpt.3,v 1.1 2012/12/03 20:08:33 millert Exp $ .\" $OpenBSD: posix_openpt.3,v 1.2 2012/12/04 18:53:45 millert Exp $
.\" .\"
.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> .\" Copyright (c) 2012 Todd C. Miller <Todd.Miller@courtesan.com>
.\" All rights reserved.
.\" .\"
.\" Portions of this software were developed under sponsorship from Snow .\" Permission to use, copy, modify, and distribute this software for any
.\" B.V., the Netherlands. .\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\" .\"
.\" Redistribution and use in source and binary forms, with or without .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" modification, are permitted provided that the following conditions .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" are met: .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" 1. Redistributions of source code must retain the above copyright .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" notice, this list of conditions and the following disclaimer. .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" 2. Redistributions in binary form must reproduce the above copyright .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" notice, this list of conditions and the following disclaimer in the .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" documentation and/or other materials provided with the distribution.
.\" .\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND .Dd $Mdocdate: December 4 2012 $
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" Portions of this text are reprinted and reproduced in electronic form
.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
.\" Portable Operating System Interface (POSIX), The Open Group Base
.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
.\" Electrical and Electronics Engineers, Inc and The Open Group. In the
.\" event of any discrepancy between this version and the original IEEE and
.\" The Open Group Standard, the original IEEE and The Open Group Standard is
.\" the referee document. The original Standard can be obtained online at
.\" http://www.opengroup.org/unix/online.html.
.\"
.\" $FreeBSD: head/lib/libc/sys/posix_openpt.2 181905 2008-08-20 08:31:58Z ed $
.\"
.Dd $Mdocdate: December 3 2012 $
.Dt POSIX_OPENPT 3 .Dt POSIX_OPENPT 3
.Os .Os
.Sh NAME .Sh NAME
.Nm posix_openpt .Nm posix_openpt
.Nd "open a pseudo-terminal device" .Nd open a pseudo-terminal device
.Sh SYNOPSIS .Sh SYNOPSIS
.In stdlib.h .In stdlib.h
.In fcntl.h .In fcntl.h
@ -53,48 +28,55 @@
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Fn posix_openpt .Fn posix_openpt
function allocates a new pseudo-terminal and establishes a connection function finds the next available pseudo-terminal and returns an open
with its master device. file descriptor for its master device.
After the pseudo-terminal has been allocated, the slave device should The path name of the slave device may be determined via the
have the proper permissions before it can be used (see .Fn ptsname
.Xr grantpt 3 ) . function.
The name of the slave device can be determined by calling Note that the
.Xr ptsname 3 . .Fn unlockpt
and
.Fn grantpt
functions should be called before opening the slave device.
.Pp .Pp
The file status flags and file access modes of the open file description The
shall be set according to the value of .Ar oflag
.Fa oflag . argument is formed by bitwise-inclusive
Values for .Tn OR Ns 'ing
.Fa oflag the following values defined in
are constructed by a bitwise-inclusive OR of flags from the following
list, defined in
.In fcntl.h : .In fcntl.h :
.Bl -tag -width ".Dv O_NOCTTY" .Pp
.Bl -tag -width O_NOCTTY -offset indent
.It Dv O_RDWR .It Dv O_RDWR
Open for reading and writing. Open for reading and writing.
.It Dv O_NOCTTY .It Dv O_NOCTTY
If set Prevent the device from being made the controlling terminal for the session.
.Fn posix_openpt This flag has no effect on
shall not cause the terminal device to become the controlling terminal .Ox
for the process. and is included for compatibility with other systems.
.El .El
.Pp .Pp
The The
.Fn posix_openpt .Dv O_RDWR
function shall fail when flag must be specified in
.Fa oflag .
If
.Fa oflag .Fa oflag
contains other values. contains values other than those listed above,
.Fn posix_openpt
will return an error.
.Sh RETURN VALUES .Sh RETURN VALUES
Upon successful completion, the If successful,
.Fn posix_openpt .Fn posix_openpt
function shall allocate a new pseudo-terminal device and return a returns a non-negative integer, the file descriptor for the
non-negative integer representing a file descriptor, which is connected pseudo-terminal master device.
to its master device. Otherwise, a value of \-1 is returned and
Otherwise, -1 shall be returned and errno set to indicate the error. .Va errno
is set to indicate the error.
.Sh ERRORS .Sh ERRORS
The The
.Fn posix_openpt .Fn posix_openpt
function shall fail if: function will fail if:
.Bl -tag -width Er .Bl -tag -width Er
.It Bq Er EMFILE .It Bq Er EMFILE
The per-process descriptor table is full. The per-process descriptor table is full.
@ -119,10 +101,3 @@ The
.Fn posix_openpt .Fn posix_openpt
function appeared in function appeared in
.Ox 5.3 . .Ox 5.3 .
.Sh CAVEATS
The flag
.Dv O_NOCTTY
is included for compatibility; in
.Ox ,
opening a terminal does not cause it to become a process's controlling
terminal.

|||||||
|||||||
xxxxxxxxxx
 
000:0
x
 
000:0
Loading…
Cancel
Save