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 |
} |