View | Details | Raw Unified | Return to bug 266627 | Differences between
and this patch

Collapse All | Expand All

(-)b/sys/kern/tty.c (-3 / +11 lines)
Lines 420-431 tty_is_ctty(struct tty *tp, struct proc *p) Link Here
420
}
420
}
421
421
422
int
422
int
423
tty_wait_background(struct tty *tp, struct thread *td, int sig)
423
tty_wait_background(struct tty *tp, struct thread *td, int sigx)
424
{
424
{
425
	struct proc *p;
425
	struct proc *p;
426
	struct pgrp *pg;
426
	struct pgrp *pg;
427
	ksiginfo_t ksi;
427
	ksiginfo_t ksi;
428
	int error;
428
	int error, sig;
429
	bool nonblock;
430
431
	sig = sigx & ~TTY_WB_NONBLOCK;
432
	nonblock = (sigx & TTY_WB_NONBLOCK) != 0;
429
433
430
	MPASS(sig == SIGTTIN || sig == SIGTTOU);
434
	MPASS(sig == SIGTTIN || sig == SIGTTOU);
431
	tty_assert_locked(tp);
435
	tty_assert_locked(tp);
Lines 493-498 tty_wait_background(struct tty *tp, struct thread *td, int sig) Link Here
493
		pgsignal(pg, ksi.ksi_signo, 1, &ksi);
497
		pgsignal(pg, ksi.ksi_signo, 1, &ksi);
494
		PGRP_UNLOCK(pg);
498
		PGRP_UNLOCK(pg);
495
499
500
		if (nonblock)
501
			return (EINTR);
502
496
		error = tty_wait(tp, &tp->t_bgwait);
503
		error = tty_wait(tp, &tp->t_bgwait);
497
		if (error)
504
		if (error)
498
			return (error);
505
			return (error);
Lines 606-612 ttydev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, Link Here
606
		 * If the ioctl() causes the TTY to be modified, let it
613
		 * If the ioctl() causes the TTY to be modified, let it
607
		 * wait in the background.
614
		 * wait in the background.
608
		 */
615
		 */
609
		error = tty_wait_background(tp, curthread, SIGTTOU);
616
		error = tty_wait_background(tp, curthread, SIGTTOU |
617
		    TTY_WB_NONBLOCK);
610
		if (error)
618
		if (error)
611
			goto done;
619
			goto done;
612
	}
620
	}
(-)b/sys/sys/tty.h (+2 lines)
Lines 191-197 int tty_makedevf(struct tty *tp, struct ucred *cred, int flags, Link Here
191
/* Signalling processes. */
191
/* Signalling processes. */
192
void	tty_signal_sessleader(struct tty *tp, int signal);
192
void	tty_signal_sessleader(struct tty *tp, int signal);
193
void	tty_signal_pgrp(struct tty *tp, int signal);
193
void	tty_signal_pgrp(struct tty *tp, int signal);
194
194
/* Waking up readers/writers. */
195
/* Waking up readers/writers. */
196
#define	TTY_WB_NONBLOCK		0x80000000
195
int	tty_wait(struct tty *tp, struct cv *cv);
197
int	tty_wait(struct tty *tp, struct cv *cv);
196
int	tty_wait_background(struct tty *tp, struct thread *td, int sig);
198
int	tty_wait_background(struct tty *tp, struct thread *td, int sig);
197
int	tty_timedwait(struct tty *tp, struct cv *cv, int timo);
199
int	tty_timedwait(struct tty *tp, struct cv *cv, int timo);

Return to bug 266627