Deleted Added
full compact
pty.c (90831) pty.c (91140)
1/*
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95
1/*
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95
34 * $FreeBSD: head/sys/kern/tty_pty.c 90831 2002-02-18 06:07:11Z dillon $
34 * $FreeBSD: head/sys/kern/tty_pty.c 91140 2002-02-23 11:12:57Z tanimura $
35 */
36
37/*
38 * Pseudo-teletype Driver
39 * (Actually two drivers, requiring two entries in 'cdevsw')
40 */
41#include "opt_compat.h"
42#include <sys/param.h>
43#include <sys/systm.h>
35 */
36
37/*
38 * Pseudo-teletype Driver
39 * (Actually two drivers, requiring two entries in 'cdevsw')
40 */
41#include "opt_compat.h"
42#include <sys/param.h>
43#include <sys/systm.h>
44#include <sys/lock.h>
45#include <sys/mutex.h>
46#include <sys/sx.h>
44#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
45#include <sys/ioctl_compat.h>
46#endif
47#include <sys/proc.h>
48#include <sys/tty.h>
49#include <sys/conf.h>
50#include <sys/fcntl.h>
51#include <sys/poll.h>

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

232 struct proc *p = td->td_proc;
233 register struct tty *tp = dev->si_tty;
234 register struct pt_ioctl *pti = dev->si_drv1;
235 int error = 0;
236
237again:
238 if (pti->pt_flags & PF_REMOTE) {
239 while (isbackground(p, tp)) {
47#if defined(COMPAT_43) || defined(COMPAT_SUNOS)
48#include <sys/ioctl_compat.h>
49#endif
50#include <sys/proc.h>
51#include <sys/tty.h>
52#include <sys/conf.h>
53#include <sys/fcntl.h>
54#include <sys/poll.h>

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

235 struct proc *p = td->td_proc;
236 register struct tty *tp = dev->si_tty;
237 register struct pt_ioctl *pti = dev->si_drv1;
238 int error = 0;
239
240again:
241 if (pti->pt_flags & PF_REMOTE) {
242 while (isbackground(p, tp)) {
243 PGRPSESS_SLOCK();
244 PROC_LOCK(p);
240 if (SIGISMEMBER(p->p_sigignore, SIGTTIN) ||
241 SIGISMEMBER(p->p_sigmask, SIGTTIN) ||
245 if (SIGISMEMBER(p->p_sigignore, SIGTTIN) ||
246 SIGISMEMBER(p->p_sigmask, SIGTTIN) ||
242 p->p_pgrp->pg_jobc == 0 || p->p_flag & P_PPWAIT)
247 p->p_pgrp->pg_jobc == 0 || p->p_flag & P_PPWAIT) {
248 PROC_UNLOCK(p);
243 return (EIO);
249 return (EIO);
250 }
251 PROC_UNLOCK(p);
252 PGRP_LOCK(p->p_pgrp);
253 PGRPSESS_SUNLOCK();
244 pgsignal(p->p_pgrp, SIGTTIN, 1);
254 pgsignal(p->p_pgrp, SIGTTIN, 1);
255 PGRP_UNLOCK(p->p_pgrp);
245 error = ttysleep(tp, &lbolt, TTIPRI | PCATCH, "ptsbg",
246 0);
247 if (error)
248 return (error);
249 }
250 if (tp->t_canq.c_cc == 0) {
251 if (flag & IO_NDELAY)
252 return (EWOULDBLOCK);

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

710 break;
711
712 case TIOCSIG:
713 if (*(unsigned int *)data >= NSIG ||
714 *(unsigned int *)data == 0)
715 return(EINVAL);
716 if ((tp->t_lflag&NOFLSH) == 0)
717 ttyflush(tp, FREAD|FWRITE);
256 error = ttysleep(tp, &lbolt, TTIPRI | PCATCH, "ptsbg",
257 0);
258 if (error)
259 return (error);
260 }
261 if (tp->t_canq.c_cc == 0) {
262 if (flag & IO_NDELAY)
263 return (EWOULDBLOCK);

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

721 break;
722
723 case TIOCSIG:
724 if (*(unsigned int *)data >= NSIG ||
725 *(unsigned int *)data == 0)
726 return(EINVAL);
727 if ((tp->t_lflag&NOFLSH) == 0)
728 ttyflush(tp, FREAD|FWRITE);
718 pgsignal(tp->t_pgrp, *(unsigned int *)data, 1);
729 if (tp->t_pgrp != NULL) {
730 PGRP_LOCK(tp->t_pgrp);
731 pgsignal(tp->t_pgrp, *(unsigned int *)data, 1);
732 PGRP_UNLOCK(tp->t_pgrp);
733 }
719 if ((*(unsigned int *)data == SIGINFO) &&
720 ((tp->t_lflag&NOKERNINFO) == 0))
721 ttyinfo(tp);
722 return(0);
723 }
724 }
725 if (cmd == TIOCEXT) {
726 /*

--- 132 unchanged lines hidden ---
734 if ((*(unsigned int *)data == SIGINFO) &&
735 ((tp->t_lflag&NOKERNINFO) == 0))
736 ttyinfo(tp);
737 return(0);
738 }
739 }
740 if (cmd == TIOCEXT) {
741 /*

--- 132 unchanged lines hidden ---