Re: [PATCH] posix_types.h: make __NFDBITS match glibc definition

From: Linus Torvalds
Date: Tue Jul 24 2012 - 16:13:35 EST


On Tue, Jul 24, 2012 at 12:59 PM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> And I suspect (but it must be before even the old bitkeeper tree) that
> we *used* to implement __FD_ISSET() long ago. We removed it, and
> nobody used it, so nobody even noticed that we removed it - but left
> some now unused stuff behind.

Nope, I found it. It was in the arch-specific header files, and then
moved to asm-generic, and then removed entirely by commit 8b3d1cda4f5f
("posix_types: Remove fd_set macros"). Fairly recently, in fact
(February).

But even before they were removed, they were inside #ifdef __KERNEL__
protection, so it wasn't available to user code.

And to be *really* crazy, it turns out that by the time we removed
those __FD_ISSET() etc macros, they didn't even use the helper macros
any more. So instead of using

#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))

(like the original arch-specific ones had done), we had already
implicitly stopped using those macros inside the kernel when we moved
to the generic version (that did all this by hand in inline
functions).

So the only users of __FDELT/__FDMASK seem to have gone away many
moons ago. I really don't think that any sane user space could be
using those left-over helpers.

Of course, the magic word there is "sane". I'm sure there are insane
users somewhere. But I don't think we should care.

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