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 154170 2006-01-10 09:19:10Z 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#if defined(COMPAT_43TTY)
87#include <sys/ioctl_compat.h>
88#endif
89#include <sys/proc.h>
90#define TTYDEFCHARS
91#include <sys/tty.h>
92#undef TTYDEFCHARS
93#include <sys/fcntl.h>
94#include <sys/conf.h>
95#include <sys/poll.h>
96#include <sys/kernel.h>
--- 724 unchanged lines hidden (view full) ---
821 case TIOCSETAW:
822 case TIOCSETD:
823 case TIOCSPGRP:
824 case TIOCSTART:
825 case TIOCSTAT:
826 case TIOCSTI:
827 case TIOCSTOP:
828 case TIOCSWINSZ:
829#if defined(COMPAT_43TTY)
830 case TIOCLBIC:
831 case TIOCLBIS:
832 case TIOCLSET:
833 case TIOCSETC:
834 case OTIOCSETD:
835 case TIOCSETN:
836 case TIOCSETP:
837 case TIOCSLTC:
838#endif
839 sx_slock(&proctree_lock);
840 PROC_LOCK(p);
841 while (isbackground(p, tp) && !(p->p_flag & P_PPWAIT) &&
842 !SIGISMEMBER(p->p_sigacts->ps_sigignore, SIGTTOU) &&
843 !SIGISMEMBER(td->td_sigmask, SIGTTOU)) {
844 pgrp = p->p_pgrp;
845 PROC_UNLOCK(p);
846 if (pgrp->pg_jobc == 0) {
--- 399 unchanged lines hidden (view full) ---
1246 case TIOCGDRAINWAIT:
1247 *(int *)data = tp->t_timeout / hz;
1248 break;
1249 case TIOCSBRK:
1250 return (tt_break(tp, 1));
1251 case TIOCCBRK:
1252 return (tt_break(tp, 0));
1253 default:
1254#if defined(COMPAT_43TTY)
1255 return (ttcompat(tp, cmd, data, flag));
1256#else
1257 return (ENOIOCTL);
1258#endif
1259 }
1260 return (0);
1261}
1262
1263int
1264ttypoll(struct cdev *dev, int events, struct thread *td)
1265{
1266 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 154170 2006-01-10 09:19:10Z 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#if defined(COMPAT_43TTY)
87#include <sys/ioctl_compat.h>
88#endif
89#include <sys/proc.h>
90#define TTYDEFCHARS
91#include <sys/tty.h>
92#undef TTYDEFCHARS
93#include <sys/fcntl.h>
94#include <sys/conf.h>
95#include <sys/poll.h>
96#include <sys/kernel.h>
--- 724 unchanged lines hidden (view full) ---
821 case TIOCSETAW:
822 case TIOCSETD:
823 case TIOCSPGRP:
824 case TIOCSTART:
825 case TIOCSTAT:
826 case TIOCSTI:
827 case TIOCSTOP:
828 case TIOCSWINSZ:
829#if defined(COMPAT_43TTY)
830 case TIOCLBIC:
831 case TIOCLBIS:
832 case TIOCLSET:
833 case TIOCSETC:
834 case OTIOCSETD:
835 case TIOCSETN:
836 case TIOCSETP:
837 case TIOCSLTC:
838#endif
839 sx_slock(&proctree_lock);
840 PROC_LOCK(p);
841 while (isbackground(p, tp) && !(p->p_flag & P_PPWAIT) &&
842 !SIGISMEMBER(p->p_sigacts->ps_sigignore, SIGTTOU) &&
843 !SIGISMEMBER(td->td_sigmask, SIGTTOU)) {
844 pgrp = p->p_pgrp;
845 PROC_UNLOCK(p);
846 if (pgrp->pg_jobc == 0) {
--- 399 unchanged lines hidden (view full) ---
1246 case TIOCGDRAINWAIT:
1247 *(int *)data = tp->t_timeout / hz;
1248 break;
1249 case TIOCSBRK:
1250 return (tt_break(tp, 1));
1251 case TIOCCBRK:
1252 return (tt_break(tp, 0));
1253 default:
1254#if defined(COMPAT_43TTY)
1255 return (ttcompat(tp, cmd, data, flag));
1256#else
1257 return (ENOIOCTL);
1258#endif
1259 }
1260 return (0);
1261}
1262
1263int
1264ttypoll(struct cdev *dev, int events, struct thread *td)
1265{
1266 int s;
--- 2134 unchanged lines hidden ---