MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ttydev_write

Function ttydev_write

freebsd/kern/tty.c:524–559  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

522}
523
524static int
525ttydev_write(struct cdev *dev, struct uio *uio, int ioflag)
526{
527 struct tty *tp = dev->si_drv1;
528 int error;
529
530 error = ttydev_enter(tp);
531 if (error)
532 return (error);
533
534 if (tp->t_termios.c_lflag & TOSTOP) {
535 error = tty_wait_background(tp, curthread, SIGTTOU);
536 if (error)
537 goto done;
538 }
539
540 if (ioflag & IO_NDELAY && tp->t_flags & TF_BUSY_OUT) {
541 /* Allow non-blocking writes to bypass serialization. */
542 error = ttydisc_write(tp, uio, ioflag);
543 } else {
544 /* Serialize write() calls. */
545 while (tp->t_flags & TF_BUSY_OUT) {
546 error = tty_wait(tp, &tp->t_outserwait);
547 if (error)
548 goto done;
549 }
550
551 tp->t_flags |= TF_BUSY_OUT;
552 error = ttydisc_write(tp, uio, ioflag);
553 tp->t_flags &= ~TF_BUSY_OUT;
554 cv_signal(&tp->t_outserwait);
555 }
556
557done: tty_unlock(tp);
558 return (error);
559}
560
561static int
562ttydev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag,

Callers 1

ttyconsdev_writeFunction · 0.85

Calls 5

ttydev_enterFunction · 0.85
tty_wait_backgroundFunction · 0.85
ttydisc_writeFunction · 0.85
tty_waitFunction · 0.85
cv_signalFunction · 0.70

Tested by

no test coverage detected