Subject: lib/6560: openpty() too restrictive about what you can do
To: None <gnats-bugs@gnats.netbsd.org>
From: None <tv@pobox.com>
List: netbsd-bugs
Date: 12/10/1998 09:51:03
>Number:         6560
>Category:       lib
>Synopsis:       openpty() too restrictive about what you can do
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people (Library Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 10 07:05:01 1998
>Last-Modified:
>Originator:     Todd Vierling
>Organization:
	DuhNet: Pointing out the obvious since 1994.

>Release:        -current "post-1.3 or so"
>Environment:
System: NetBSD duhnet.net 1.3I NetBSD 1.3I (DUH) #0: Wed Nov 25 14:19:32 EST 1998 tv@alpha.home.duh.org:/usr/SRC/netbsd/src/sys/arch/alpha/compile/DUH alpha

>Description:

The openpty() function exists to abstract the functions of
(1) finding a free tty/pty pair,
(2) opening the master pty and checking whether the slave side is free, and
(3) opening the slave tty.

These functions in the current implementation are indivisible.
Unfortunately, programs which need the ability to do (1) and (2) at one
point and (3) later cannot be converted to use openpty(), as the program
would need to hold the slave side open as returned by openpty() (once the
last slave side fd closes, the master goes away).

>How-To-Repeat:

Attempt to convert, say, screen to use openpty().

>Fix:

IMHO, openpty() should accept a NULL pointer to its `aslave' argument,
which should mean `do not open the slave device'.  Since the `name'
pointer will return the device to open as slave, this should be a rather
trivial functionality addition.

`Comments?'
>Audit-Trail:
>Unformatted: