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.
--- 57 unchanged lines hidden (view full) ---
66 * o Check for TS_CARR_ON being set while everything is closed and not
67 * waiting for carrier. TS_CARR_ON isn't cleared if nothing is open,
68 * so it would live until the next open even if carrier drops.
69 * o Restore TS_WOPEN since it is useful in pstat. It must be cleared
70 * only when _all_ openers leave open().
71 */
72
73#include <sys/cdefs.h>
74__FBSDID("$FreeBSD: head/sys/kern/tty.c 154018 2006-01-04 09:59:07Z phk $");
75
76#include "opt_compat.h"
77#include "opt_tty.h"
78
79#include <sys/param.h>
80#include <sys/systm.h>
81#include <sys/filio.h>
82#include <sys/lock.h>
83#include <sys/mutex.h>
84#include <sys/namei.h>
85#include <sys/sx.h>
86#ifndef BURN_BRIDGES
87#if defined(COMPAT_43)
88#include <sys/ioctl_compat.h>
89#endif
90#endif
91#include <sys/proc.h>
92#define TTYDEFCHARS
93#include <sys/tty.h>
94#undef TTYDEFCHARS
95#include <sys/fcntl.h>
96#include <sys/conf.h>
97#include <sys/poll.h>
98#include <sys/kernel.h>
--- 724 unchanged lines hidden (view full) ---
823 case TIOCSETAW:
824 case TIOCSETD:
825 case TIOCSPGRP:
826 case TIOCSTART:
827 case TIOCSTAT:
828 case TIOCSTI:
829 case TIOCSTOP:
830 case TIOCSWINSZ:
831#ifndef BURN_BRIDGES
832#if defined(COMPAT_43)
833 case TIOCLBIC:
834 case TIOCLBIS:
835 case TIOCLSET:
836 case TIOCSETC:
837 case OTIOCSETD:
838 case TIOCSETN:
839 case TIOCSETP:
840 case TIOCSLTC:
841#endif
842#endif
843 sx_slock(&proctree_lock);
844 PROC_LOCK(p);
845 while (isbackground(p, tp) && !(p->p_flag & P_PPWAIT) &&
846 !SIGISMEMBER(p->p_sigacts->ps_sigignore, SIGTTOU) &&
847 !SIGISMEMBER(td->td_sigmask, SIGTTOU)) {
848 pgrp = p->p_pgrp;
849 PROC_UNLOCK(p);
850 if (pgrp->pg_jobc == 0) {
--- 399 unchanged lines hidden (view full) ---
1250 case TIOCGDRAINWAIT:
1251 *(int *)data = tp->t_timeout / hz;
1252 break;
1253 case TIOCSBRK:
1254 return (tt_break(tp, 1));
1255 case TIOCCBRK:
1256 return (tt_break(tp, 0));
1257 default:
1258#if defined(COMPAT_43)
1259#ifndef BURN_BRIDGES
1260 return (ttcompat(tp, cmd, data, flag));
1261#else
1262 return (ENOIOCTL);
1263#endif
1264#else
1265 return (ENOIOCTL);
1266#endif
1267 }
1268 return (0);
1269}
1270
1271int
1272ttypoll(struct cdev *dev, int events, struct thread *td)
1273{
1274 int s;
--- 2134 unchanged lines hidden ---
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.
--- 57 unchanged lines hidden (view full) ---
66 * o Check for TS_CARR_ON being set while everything is closed and not
67 * waiting for carrier. TS_CARR_ON isn't cleared if nothing is open,
68 * so it would live until the next open even if carrier drops.
69 * o Restore TS_WOPEN since it is useful in pstat. It must be cleared
70 * only when _all_ openers leave open().
71 */
72
73#include <sys/cdefs.h>
74__FBSDID("$FreeBSD: head/sys/kern/tty.c 154018 2006-01-04 09:59:07Z phk $");
75
76#include "opt_compat.h"
77#include "opt_tty.h"
78
79#include <sys/param.h>
80#include <sys/systm.h>
81#include <sys/filio.h>
82#include <sys/lock.h>
83#include <sys/mutex.h>
84#include <sys/namei.h>
85#include <sys/sx.h>
86#ifndef BURN_BRIDGES
87#if defined(COMPAT_43)
88#include <sys/ioctl_compat.h>
89#endif
90#endif
91#include <sys/proc.h>
92#define TTYDEFCHARS
93#include <sys/tty.h>
94#undef TTYDEFCHARS
95#include <sys/fcntl.h>
96#include <sys/conf.h>
97#include <sys/poll.h>
98#include <sys/kernel.h>
--- 724 unchanged lines hidden (view full) ---
823 case TIOCSETAW:
824 case TIOCSETD:
825 case TIOCSPGRP:
826 case TIOCSTART:
827 case TIOCSTAT:
828 case TIOCSTI:
829 case TIOCSTOP:
830 case TIOCSWINSZ:
831#ifndef BURN_BRIDGES
832#if defined(COMPAT_43)
833 case TIOCLBIC:
834 case TIOCLBIS:
835 case TIOCLSET:
836 case TIOCSETC:
837 case OTIOCSETD:
838 case TIOCSETN:
839 case TIOCSETP:
840 case TIOCSLTC:
841#endif
842#endif
843 sx_slock(&proctree_lock);
844 PROC_LOCK(p);
845 while (isbackground(p, tp) && !(p->p_flag & P_PPWAIT) &&
846 !SIGISMEMBER(p->p_sigacts->ps_sigignore, SIGTTOU) &&
847 !SIGISMEMBER(td->td_sigmask, SIGTTOU)) {
848 pgrp = p->p_pgrp;
849 PROC_UNLOCK(p);
850 if (pgrp->pg_jobc == 0) {
--- 399 unchanged lines hidden (view full) ---
1250 case TIOCGDRAINWAIT:
1251 *(int *)data = tp->t_timeout / hz;
1252 break;
1253 case TIOCSBRK:
1254 return (tt_break(tp, 1));
1255 case TIOCCBRK:
1256 return (tt_break(tp, 0));
1257 default:
1258#if defined(COMPAT_43)
1259#ifndef BURN_BRIDGES
1260 return (ttcompat(tp, cmd, data, flag));
1261#else
1262 return (ENOIOCTL);
1263#endif
1264#else
1265 return (ENOIOCTL);
1266#endif
1267 }
1268 return (0);
1269}
1270
1271int
1272ttypoll(struct cdev *dev, int events, struct thread *td)
1273{
1274 int s;
--- 2134 unchanged lines hidden ---