lkml.org 
[lkml]   [2000]   [Feb]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] Fix poll bug

    Hi Alan,

    I just found a poll() bug. poll currently returns -EINTR when
    a signal occurs, which causes the system call to be restarted. Unfortunately
    the timeout is not decreased, so when you have a periodic SA_RESTART timer
    with just the right period and no other event occurs poll hangs forever.

    select does it correctly, it always returns EINTR and is never restarted.

    I found it because syslogd's 30s "mark" timer can trigger it in the
    dns resolver when syslogd does forwarding.

    This patch fixes the problem. I also fixed an outdated comment.

    Please add for 2.2.15. Thanks.

    -Andi

    --- linux/fs/select.c-o Thu Aug 26 02:29:49 1999
    +++ linux/fs/select.c Sun Feb 13 12:52:00 2000
    @@ -230,12 +230,8 @@
    }

    /*
    - * We can actually return ERESTARTSYS instead of EINTR, but I'd
    - * like to be certain this leads to no problems. So I return
    - * EINTR just for safety.
    - *
    - * Update: ERESTARTSYS breaks at least the xview clock binary, so
    - * I'm trying ERESTARTNOHAND which restart only when you want to.
    + * On interrupts return ERESTARTNOHAND, because automatic restart
    + * is not handled properly (the timeout is not decreased).
    */
    #define MAX_SELECT_SECONDS \
    ((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
    @@ -434,7 +430,7 @@

    err = fdcount;
    if (!fdcount && signal_pending(current))
    - err = -EINTR;
    + err = -ERESTARTNOHAND;

    out_fds:
    kfree(fds);

    --
    This is like TV. I don't like TV.

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/

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