lkml.org 
[lkml]   [2003]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] [2.5] Non-blocking write can block
    Non-blocking writes to a tty will block if there is a blocking write
    waiting for the atomic_write semaphore.

    Peter

    --- linux-2.5.70/drivers/char/tty_io.c.orig 2003-06-03 21:34:42.000000000 +0100
    +++ linux-2.5.70/drivers/char/tty_io.c 2003-06-04 01:40:33.000000000 +0100
    @@ -687,8 +687,13 @@
    {
    ssize_t ret = 0, written = 0;

    - if (down_interruptible(&tty->atomic_write)) {
    - return -ERESTARTSYS;
    + if (file->f_flags & O_NONBLOCK) {
    + if (down_trylock(&tty->atomic_write))
    + return -EAGAIN;
    + }
    + else {
    + if (down_interruptible(&tty->atomic_write))
    + return -ERESTARTSYS;
    }
    if ( test_bit(TTY_NO_WRITE_SPLIT, &tty->flags) ) {
    lock_kernel();
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2005-03-22 13:36    [W:0.034 / U:5.196 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site