Deleted Added
full compact
tty.c (47407) tty.c (49540)
1/*-
2 * Copyright (c) 1982, 1986, 1990, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)tty.c 8.8 (Berkeley) 1/21/94
1/*-
2 * Copyright (c) 1982, 1986, 1990, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 * (c) UNIX System Laboratories, Inc.
5 * All or some portions of this file are derived from material licensed
6 * to the University of California by American Telephone and Telegraph
7 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8 * the permission of UNIX System Laboratories, Inc.

--- 22 unchanged lines hidden (view full) ---

31 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36 * SUCH DAMAGE.
37 *
38 * @(#)tty.c 8.8 (Berkeley) 1/21/94
39 * $Id: tty.c,v 1.118 1999/05/08 06:39:42 phk Exp $
39 * $Id: tty.c,v 1.119 1999/05/22 20:10:31 dt Exp $
40 */
41
42/*-
43 * TODO:
44 * o Fix races for sending the start char in ttyflush().
45 * o Handle inter-byte timeout for "MIN > 0, TIME > 0" in ttyselect().
46 * With luck, there will be MIN chars before select() returns().
47 * o Handle CLOCAL consistently for ptys. Perhaps disallow setting it.

--- 41 unchanged lines hidden (view full) ---

89#include <sys/vnode.h>
90#include <sys/signalvar.h>
91#include <sys/resourcevar.h>
92#include <sys/malloc.h>
93#include <sys/filedesc.h>
94#if NSNP > 0
95#include <sys/snoop.h>
96#endif
40 */
41
42/*-
43 * TODO:
44 * o Fix races for sending the start char in ttyflush().
45 * o Handle inter-byte timeout for "MIN > 0, TIME > 0" in ttyselect().
46 * With luck, there will be MIN chars before select() returns().
47 * o Handle CLOCAL consistently for ptys. Perhaps disallow setting it.

--- 41 unchanged lines hidden (view full) ---

89#include <sys/vnode.h>
90#include <sys/signalvar.h>
91#include <sys/resourcevar.h>
92#include <sys/malloc.h>
93#include <sys/filedesc.h>
94#if NSNP > 0
95#include <sys/snoop.h>
96#endif
97#include <sys/sysctl.h>
97
98#include <vm/vm.h>
99#include <sys/lock.h>
100#include <vm/pmap.h>
101#include <vm/vm_map.h>
102
103MALLOC_DEFINE(M_TTYS, "ttys", "tty data structures");
104

--- 85 unchanged lines hidden (view full) ---

190#define SET(t, f) (t) |= (f)
191#define CLR(t, f) (t) &= ~(f)
192#define ISSET(t, f) ((t) & (f))
193
194#undef MAX_INPUT /* XXX wrong in <sys/syslimits.h> */
195#define MAX_INPUT TTYHOG /* XXX limit is usually larger for !ICANON */
196
197/*
98
99#include <vm/vm.h>
100#include <sys/lock.h>
101#include <vm/pmap.h>
102#include <vm/vm_map.h>
103
104MALLOC_DEFINE(M_TTYS, "ttys", "tty data structures");
105

--- 85 unchanged lines hidden (view full) ---

191#define SET(t, f) (t) |= (f)
192#define CLR(t, f) (t) &= ~(f)
193#define ISSET(t, f) ((t) & (f))
194
195#undef MAX_INPUT /* XXX wrong in <sys/syslimits.h> */
196#define MAX_INPUT TTYHOG /* XXX limit is usually larger for !ICANON */
197
198/*
199 * list of struct tty where pstat(8) can pick it up with sysctl
200 */
201static SLIST_HEAD(, tty) tty_list;
202
203/*
198 * Initial open of tty, or (re)entry to standard tty line discipline.
199 */
200int
201ttyopen(device, tp)
202 dev_t device;
203 register struct tty *tp;
204{
205 int s;

--- 2222 unchanged lines hidden (view full) ---

2428 */
2429void
2430ttyfree(tp)
2431 struct tty *tp;
2432{
2433 free(tp, M_TTYS);
2434}
2435#endif /* 0 */
204 * Initial open of tty, or (re)entry to standard tty line discipline.
205 */
206int
207ttyopen(device, tp)
208 dev_t device;
209 register struct tty *tp;
210{
211 int s;

--- 2222 unchanged lines hidden (view full) ---

2434 */
2435void
2436ttyfree(tp)
2437 struct tty *tp;
2438{
2439 free(tp, M_TTYS);
2440}
2441#endif /* 0 */
2442
2443void
2444ttyregister(tp)
2445 struct tty *tp;
2446{
2447 SLIST_INSERT_HEAD(&tty_list, tp, t_list);
2448}
2449
2450static int
2451sysctl_kern_ttys SYSCTL_HANDLER_ARGS
2452{
2453 int error;
2454 struct tty *tp, t;
2455 SLIST_FOREACH(tp, &tty_list, t_list) {
2456 t = *tp;
2457 if (t.t_dev)
2458 t.t_dev = (dev_t)dev2udev(t.t_dev);
2459 error = SYSCTL_OUT(req, (caddr_t)&t, sizeof(t));
2460 if (error)
2461 return (error);
2462 }
2463 return (0);
2464}
2465
2466SYSCTL_PROC(_kern, OID_AUTO, ttys, CTLTYPE_OPAQUE|CTLFLAG_RD,
2467 0, 0, sysctl_kern_ttys, "S,tty", "All struct ttys");