Re: [patch 2/2] ufd v1 - use unsequential O(1) fdmap

From: Ingo Molnar
Date: Sun Jun 03 2007 - 02:43:43 EST



* Davide Libenzi <davidel@xxxxxxxxxxxxxxx> wrote:

> This patch plugs the extended fdmap into the kernel. At the moment, this
> is done only through sys_dup2() and F_DUPFD.
> The base value for the unsequential file descriptor allocation is (at the
> moment) set to FD_UNSEQ_BASE (defined in asm-generic/fcntl.h):

really nice stuff! :-)

> #define FD_UNSEQ_BASE (1U << 28)
> #define FD_UNSEQ_ALLOC (1U << 30)

i'm wondering, why not use (1 << 30) both as the base and as the flag?
That would make integration of the new fd space 'seemless' in terms of
dup2() use.

> It'd be possible to add a new O_UNSEQFD flag to open(2) and make
> sys_open() to allocate the new descriptor inside the unsequential map.

yeah, please do that now - lets not leave any incomplete areas. We've
too often made the mistake of not pushing through new APIs consistently
enough.

I'd also suggest a new sys_socket2() call that takes a 'flags' parameter
as well - because one primary user of this facility will be networking
servers. (O_UNSEQFD would make sense for it and O_NDELAY - currently
network apps that want to set O_NDELAY need to do it with an extra
fcntl() - while they could already indicate this in the sys_socket()
call, if it were closer to sys_open() semantics)

in any case, your patch is looking really good and already deserves an
ack!

Acked-by: Ingo Molnar <mingo@xxxxxxx>

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