summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormillert <>2012-12-04 18:53:45 +0000
committermillert <>2012-12-04 18:53:45 +0000
commit6d94da22b85b9fe9f53fab32d68e3a49d7481396 (patch)
tree33e57a93b25c71ed4ebb6e4745ed7ca3f58116fd
parent25a8b243d4b43fa63801be9d42c902307b9ed60a (diff)
downloadopenbsd-6d94da22b85b9fe9f53fab32d68e3a49d7481396.tar.gz
openbsd-6d94da22b85b9fe9f53fab32d68e3a49d7481396.tar.bz2
openbsd-6d94da22b85b9fe9f53fab32d68e3a49d7481396.zip
Rewritten posix_openpt manual that doesn't include any of the POSIX
text. OK deraadt@
-rw-r--r--src/lib/libc/stdlib/posix_openpt.3123
1 files changed, 49 insertions, 74 deletions
diff --git a/src/lib/libc/stdlib/posix_openpt.3 b/src/lib/libc/stdlib/posix_openpt.3
index d292ac0a5f..20b1c417f9 100644
--- a/src/lib/libc/stdlib/posix_openpt.3
+++ b/src/lib/libc/stdlib/posix_openpt.3
@@ -1,50 +1,25 @@
1.\" $OpenBSD: posix_openpt.3,v 1.1 2012/12/03 20:08:33 millert Exp $ 1.\" $OpenBSD: posix_openpt.3,v 1.2 2012/12/04 18:53:45 millert Exp $
2.\" 2.\"
3.\" Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> 3.\" Copyright (c) 2012 Todd C. Miller <Todd.Miller@courtesan.com>
4.\" All rights reserved.
5.\" 4.\"
6.\" Portions of this software were developed under sponsorship from Snow 5.\" Permission to use, copy, modify, and distribute this software for any
7.\" B.V., the Netherlands. 6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\" 8.\"
9.\" Redistribution and use in source and binary forms, with or without 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" modification, are permitted provided that the following conditions 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" are met: 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" 1. Redistributions of source code must retain the above copyright 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" notice, this list of conditions and the following disclaimer. 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" 2. Redistributions in binary form must reproduce the above copyright 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" notice, this list of conditions and the following disclaimer in the 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\" documentation and/or other materials provided with the distribution.
17.\" 16.\"
18.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17.Dd $Mdocdate: December 4 2012 $
19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28.\" SUCH DAMAGE.
29.\"
30.\" Portions of this text are reprinted and reproduced in electronic form
31.\" from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology --
32.\" Portable Operating System Interface (POSIX), The Open Group Base
33.\" Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of
34.\" Electrical and Electronics Engineers, Inc and The Open Group. In the
35.\" event of any discrepancy between this version and the original IEEE and
36.\" The Open Group Standard, the original IEEE and The Open Group Standard is
37.\" the referee document. The original Standard can be obtained online at
38.\" http://www.opengroup.org/unix/online.html.
39.\"
40.\" $FreeBSD: head/lib/libc/sys/posix_openpt.2 181905 2008-08-20 08:31:58Z ed $
41.\"
42.Dd $Mdocdate: December 3 2012 $
43.Dt POSIX_OPENPT 3 18.Dt POSIX_OPENPT 3
44.Os 19.Os
45.Sh NAME 20.Sh NAME
46.Nm posix_openpt 21.Nm posix_openpt
47.Nd "open a pseudo-terminal device" 22.Nd open a pseudo-terminal device
48.Sh SYNOPSIS 23.Sh SYNOPSIS
49.In stdlib.h 24.In stdlib.h
50.In fcntl.h 25.In fcntl.h
@@ -53,48 +28,55 @@
53.Sh DESCRIPTION 28.Sh DESCRIPTION
54The 29The
55.Fn posix_openpt 30.Fn posix_openpt
56function allocates a new pseudo-terminal and establishes a connection 31function finds the next available pseudo-terminal and returns an open
57with its master device. 32file descriptor for its master device.
58After the pseudo-terminal has been allocated, the slave device should 33The path name of the slave device may be determined via the
59have the proper permissions before it can be used (see 34.Fn ptsname
60.Xr grantpt 3 ) . 35function.
61The name of the slave device can be determined by calling 36Note that the
62.Xr ptsname 3 . 37.Fn unlockpt
38and
39.Fn grantpt
40functions should be called before opening the slave device.
63.Pp 41.Pp
64The file status flags and file access modes of the open file description 42The
65shall be set according to the value of 43.Ar oflag
66.Fa oflag . 44argument is formed by bitwise-inclusive
67Values for 45.Tn OR Ns 'ing
68.Fa oflag 46the following values defined in
69are constructed by a bitwise-inclusive OR of flags from the following
70list, defined in
71.In fcntl.h : 47.In fcntl.h :
72.Bl -tag -width ".Dv O_NOCTTY" 48.Pp
49.Bl -tag -width O_NOCTTY -offset indent
73.It Dv O_RDWR 50.It Dv O_RDWR
74Open for reading and writing. 51Open for reading and writing.
75.It Dv O_NOCTTY 52.It Dv O_NOCTTY
76If set 53Prevent the device from being made the controlling terminal for the session.
77.Fn posix_openpt 54This flag has no effect on
78shall not cause the terminal device to become the controlling terminal 55.Ox
79for the process. 56and is included for compatibility with other systems.
80.El 57.El
81.Pp 58.Pp
82The 59The
83.Fn posix_openpt 60.Dv O_RDWR
84function shall fail when 61flag must be specified in
62.Fa oflag .
63If
85.Fa oflag 64.Fa oflag
86contains other values. 65contains values other than those listed above,
66.Fn posix_openpt
67will return an error.
87.Sh RETURN VALUES 68.Sh RETURN VALUES
88Upon successful completion, the 69If successful,
89.Fn posix_openpt 70.Fn posix_openpt
90function shall allocate a new pseudo-terminal device and return a 71returns a non-negative integer, the file descriptor for the
91non-negative integer representing a file descriptor, which is connected 72pseudo-terminal master device.
92to its master device. 73Otherwise, a value of \-1 is returned and
93Otherwise, -1 shall be returned and errno set to indicate the error. 74.Va errno
75is set to indicate the error.
94.Sh ERRORS 76.Sh ERRORS
95The 77The
96.Fn posix_openpt 78.Fn posix_openpt
97function shall fail if: 79function will fail if:
98.Bl -tag -width Er 80.Bl -tag -width Er
99.It Bq Er EMFILE 81.It Bq Er EMFILE
100The per-process descriptor table is full. 82The per-process descriptor table is full.
@@ -119,10 +101,3 @@ The
119.Fn posix_openpt 101.Fn posix_openpt
120function appeared in 102function appeared in
121.Ox 5.3 . 103.Ox 5.3 .
122.Sh CAVEATS
123The flag
124.Dv O_NOCTTY
125is included for compatibility; in
126.Ox ,
127opening a terminal does not cause it to become a process's controlling
128terminal.