Re: A better interface, perhaps: a timed signal flag

From: Theodore Tso
Date: Fri Jul 28 2006 - 10:54:19 EST

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@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at