pty.c (93593) | pty.c (94860) |
---|---|
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 93593 2002-04-01 21:31:13Z jhb $ | 34 * $FreeBSD: head/sys/kern/tty_pty.c 94860 2002-04-16 17:09:22Z jhb $ |
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> --- 186 unchanged lines hidden (view full) --- 229 dev_t dev; 230 struct uio *uio; 231 int flag; 232{ 233 struct thread *td = curthread; 234 struct proc *p = td->td_proc; 235 register struct tty *tp = dev->si_tty; 236 register struct pt_ioctl *pti = dev->si_drv1; | 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> --- 186 unchanged lines hidden (view full) --- 229 dev_t dev; 230 struct uio *uio; 231 int flag; 232{ 233 struct thread *td = curthread; 234 struct proc *p = td->td_proc; 235 register struct tty *tp = dev->si_tty; 236 register struct pt_ioctl *pti = dev->si_drv1; |
237 struct pgrp *pg; |
|
237 int error = 0; 238 239again: 240 if (pti->pt_flags & PF_REMOTE) { 241 while (isbackground(p, tp)) { | 238 int error = 0; 239 240again: 241 if (pti->pt_flags & PF_REMOTE) { 242 while (isbackground(p, tp)) { |
242 PGRPSESS_SLOCK(); | 243 sx_slock(&proctree_lock); |
243 PROC_LOCK(p); 244 if (SIGISMEMBER(p->p_sigignore, SIGTTIN) || 245 SIGISMEMBER(p->p_sigmask, SIGTTIN) || 246 p->p_pgrp->pg_jobc == 0 || p->p_flag & P_PPWAIT) { 247 PROC_UNLOCK(p); | 244 PROC_LOCK(p); 245 if (SIGISMEMBER(p->p_sigignore, SIGTTIN) || 246 SIGISMEMBER(p->p_sigmask, SIGTTIN) || 247 p->p_pgrp->pg_jobc == 0 || p->p_flag & P_PPWAIT) { 248 PROC_UNLOCK(p); |
248 PGRPSESS_SUNLOCK(); | 249 sx_sunlock(&proctree_lock); |
249 return (EIO); 250 } | 250 return (EIO); 251 } |
252 pg = p->p_pgrp; |
|
251 PROC_UNLOCK(p); | 253 PROC_UNLOCK(p); |
252 PGRP_LOCK(p->p_pgrp); 253 PGRPSESS_SUNLOCK(); 254 pgsignal(p->p_pgrp, SIGTTIN, 1); 255 PGRP_UNLOCK(p->p_pgrp); | 254 PGRP_LOCK(pg); 255 sx_sunlock(&proctree_lock); 256 pgsignal(pg, SIGTTIN, 1); 257 PGRP_UNLOCK(pg); |
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); --- 609 unchanged lines hidden --- | 258 error = ttysleep(tp, &lbolt, TTIPRI | PCATCH, "ptsbg", 259 0); 260 if (error) 261 return (error); 262 } 263 if (tp->t_canq.c_cc == 0) { 264 if (flag & IO_NDELAY) 265 return (EWOULDBLOCK); --- 609 unchanged lines hidden --- |