tty.c (c3328b2ab87a66753fdb4651e98e26f735f70093) | tty.c (c0086bf20280407ccd3ed5a4ef984ce90f56b9ab) |
---|---|
1/*- 2 * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Portions of this software were developed under sponsorship from Snow 6 * B.V., the Netherlands. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 424 unchanged lines hidden (view full) --- 433 int error; 434 435 error = ttydev_enter(tp); 436 if (error) 437 return (error); 438 439 if (tp->t_termios.c_lflag & TOSTOP) { 440 error = tty_wait_background(tp, curthread, SIGTTOU); | 1/*- 2 * Copyright (c) 2008 Ed Schouten <ed@FreeBSD.org> 3 * All rights reserved. 4 * 5 * Portions of this software were developed under sponsorship from Snow 6 * B.V., the Netherlands. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 424 unchanged lines hidden (view full) --- 433 int error; 434 435 error = ttydev_enter(tp); 436 if (error) 437 return (error); 438 439 if (tp->t_termios.c_lflag & TOSTOP) { 440 error = tty_wait_background(tp, curthread, SIGTTOU); |
441 if (error) { 442 tty_unlock(tp); 443 return (error); | 441 if (error) 442 goto done; 443 } 444 445 if (ioflag & IO_NDELAY && tp->t_flags & TF_BUSY_OUT) { 446 /* Allow non-blocking writes to bypass serialization. */ 447 error = ttydisc_write(tp, uio, ioflag); 448 } else { 449 /* Serialize write() calls. */ 450 while (tp->t_flags & TF_BUSY_OUT) { 451 error = tty_wait(tp, &tp->t_bgwait); 452 if (error) 453 goto done; |
444 } | 454 } |
455 456 tp->t_flags |= TF_BUSY_OUT; 457 error = ttydisc_write(tp, uio, ioflag); 458 tp->t_flags &= ~TF_BUSY_OUT; 459 cv_broadcast(&tp->t_bgwait); |
|
445 } 446 | 460 } 461 |
447 error = ttydisc_write(tp, uio, ioflag); 448 tty_unlock(tp); 449 | 462done: tty_unlock(tp); |
450 return (error); 451} 452 453static int 454ttydev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, 455 struct thread *td) 456{ 457 struct tty *tp = dev->si_drv1; --- 1417 unchanged lines hidden (view full) --- 1875 { TF_HIWAT_OUT, 'o' }, 1876 1877 { TF_STOPPED, 'S' }, 1878 { TF_EXCLUDE, 'X' }, 1879 { TF_BYPASS, 'l' }, 1880 { TF_ZOMBIE, 'Z' }, 1881 { TF_HOOK, 's' }, 1882 | 463 return (error); 464} 465 466static int 467ttydev_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int fflag, 468 struct thread *td) 469{ 470 struct tty *tp = dev->si_drv1; --- 1417 unchanged lines hidden (view full) --- 1888 { TF_HIWAT_OUT, 'o' }, 1889 1890 { TF_STOPPED, 'S' }, 1891 { TF_EXCLUDE, 'X' }, 1892 { TF_BYPASS, 'l' }, 1893 { TF_ZOMBIE, 'Z' }, 1894 { TF_HOOK, 's' }, 1895 |
1896 /* Keep these together -> 'bi' and 'bo'. */ 1897 { TF_BUSY, 'b' }, 1898 { TF_BUSY_IN, 'i' }, 1899 { TF_BUSY_OUT, 'o' }, 1900 |
|
1883 { 0, '\0'}, 1884}; 1885 1886#define TTY_FLAG_BITS \ 1887 "\20\1NOPREFIX\2INITLOCK\3CALLOUT\4OPENED_IN\5OPENED_OUT\6GONE" \ 1888 "\7OPENCLOSE\10ASYNC\11LITERAL\12HIWAT_IN\13HIWAT_OUT\14STOPPED" \ 1889 "\15EXCLUDE\16BYPASS\17ZOMBIE\20HOOK" 1890 --- 156 unchanged lines hidden --- | 1901 { 0, '\0'}, 1902}; 1903 1904#define TTY_FLAG_BITS \ 1905 "\20\1NOPREFIX\2INITLOCK\3CALLOUT\4OPENED_IN\5OPENED_OUT\6GONE" \ 1906 "\7OPENCLOSE\10ASYNC\11LITERAL\12HIWAT_IN\13HIWAT_OUT\14STOPPED" \ 1907 "\15EXCLUDE\16BYPASS\17ZOMBIE\20HOOK" 1908 --- 156 unchanged lines hidden --- |