Re: [PATCH] alternative^2 to sys_indirect: socket, socketpair

From: Alan Cox
Date: Thu Apr 24 2008 - 12:32:11 EST


Comments all come down to implementation details and it basically looks
sound and fairly small clean change (especially when the various wrappers
and _flags changes were replaced by just fixing up the callers to
functions in a final implementation.

Add a new accept() and it looks good to me

> - fd = get_unused_fd();
> + fd = get_unused_fd_flags(flags);

Better to fix up the existing users who don't pass flags (and check why
they need not to), Implementation detail

> -int sock_map_fd(struct socket *sock)
> +static int sock_map_fd_flags(struct socket *sock, int flags)

No need to rename these, the compiler errors will let us quickly
find/fix any users.

> +int sock_map_fd(struct socket *sock)
> +{
> + return sock_map_fd_flags(sock, 0);
> +}

Ditto

> + /* Extract the close-on-exec flag. */
> + if ((type & SOCK_CLOEXEC) != 0) {
> + fflags = O_CLOEXEC;
> + type &= ~SOCK_CLOEXEC;

> + /* Extract the close-on-exec flag. */
> + if ((type & SOCK_CLOEXEC) != 0) {
> + fflags = O_CLOEXEC;
> + type &= ~SOCK_CLOEXEC;
> + }

Should probably be done once in one place in case we ever add future flags



--
--
"Alan, I'm getting a bit worried about you."
-- Linus Torvalds
--
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/