lkml.org 
[lkml]   [2005]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subjectselect() for delay.
    Date
    From
    Hi all,

    This is regarding select() system call.

    Linux select() man page mentions " Some code calls select with all
    three sets empty, n zero, and a non-null timeout as a fairly portable
    way to sleep with subsecond precision".

    This patch improves the sys_select() execution when used for delay.

    Kindly suggest.


    --- linux-2.4.22/fs/select.c 2003-06-13 20:21:37.000000000 +0530
    +++ linux/fs/select.c 2005-10-20 15:01:38.000000000 +0530
    @@ -286,6 +286,29 @@ sys_select(int n, fd_set *inp, fd_set *o
    if (n < 0)
    goto out_nofds;


    + if ((n == 0) && (inp == NULL) && (outp == NULL) && (exp ==
    NULL)) {
    + set_current_state(TASK_INTERRUPTIBLE);
    + ret = 0;
    + timeout = schedule_timeout(timeout);
    +

    + if (signal_pending(current))
    + ret = -ERESTARTNOHAND;
    +

    + if (tvp && !(current->personality & STICKY_TIMEOUTS)) {
    + time_t sec = 0, usec = 0;
    + if (timeout) {
    + sec = timeout / HZ;
    + usec = timeout % HZ;
    + usec *= (1000000 / HZ);
    + }
    + put_user(sec, &tvp->tv_sec);
    + put_user(usec, &tvp->tv_usec);
    + }
    +
    + current->state = TASK_RUNNING;
    + goto out_nofds;
    + }
    +
    /* max_fdset can increase, so grab it once to avoid race */
    max_fdset = current->files->max_fdset;
    if (n > max_fdset)
    Thanks,
    Madhu K.S.
    -
    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-10-24 12:58    [W:0.024 / U:30.328 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site