lkml.org 
[lkml]   [2006]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: A better interface, perhaps: a timed signal flag
    On Fri, Jul 28, 2006 at 09:33:26AM -0400, Steven Rostedt wrote:
    > What you could have is this:
    >
    > volatile int *flag;
    >
    > register_timeout(&time_val, &flag);
    > while (work_to_do()) {
    > do_a_bit_of_work();
    > if (*flag)
    > break;
    > }
    >
    > Where the kernel would register a location to set a timeout with, and
    > the kernel would setup a flag for you and then map it into userspace.
    > Perhaps only allow one flag per task and place it as a field of the task
    > structure. There's no reason that the tasks own task sturct cant be
    > mapped read only to user space, is there?

    Good point, and limiting this facility to one such timeout per
    task_struct seems like a reasonable restriction. The downsides I can
    see about about mapping the tasks' own task struct would be (a) a
    potential security leak either now or in the future if some field in
    the task_struct shouldn't be visible to a non-privileged userspace
    program, and (b) exposing the task_struct might cause some (stupid)
    programs to depend on the task_struct layout. Allocating an otherwise
    empty 4k page just for this purpose wouldn't be all that horrible,
    though, and would avoid these potential problems.

    - Ted
    -
    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: 2006-07-28 16:59    [W:0.050 / U:0.876 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site