Re: [PATCH][COMPAT] compat_sys_futex 1/7 generic

From: Linus Torvalds (torvalds@transmeta.com)
Date: Wed Feb 12 2003 - 00:26:54 EST


On Wed, 12 Feb 2003, Stephen Rothwell wrote:
>
> This patch creates compat_sys_futex and changes the 64 bit architextures
> to use it. This also changes sys_futex to take a "u32 *" as its first
> argument as discussed with Rusty and yourself.

I'd prefer this much more if it just passed the timout around as jiffies
(unconditionally), instead of converting them from one type of timespec to
another, and then converting that other timespec to jiffies, and having
multiple tests for NULL because of all that conversion confusion.

In other words, make the do_futex() prototype be

        extern long do_futex(u32 *, int, int, unsigned long);

and let all the callers simply do something like

        unsigned long timeout = MAX_SCHEDULE_TIMEOUT;

        if (utime) {
                struct timespec ts;
                if (copy_from_user(&ts, utime, sizeof(ts))
                        return -EFAULT;
                timeout = timespec_to_jiffies(ts)+1;
        }
        do_futex(.. timeout);

instead. It's kind of silly to convert to kernel mode and carry around a
whole timespec, when the single actual _user_ doesn't even want one
anyway.

Hmm?

                Linus

-
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/



This archive was generated by hypermail 2b29 : Sat Feb 15 2003 - 22:00:38 EST