Re: [PATCH] posix_types.h: Cleanup stale __NFDBITS and related definitions

2012-07-25 Thread Jonathan Nieder
Josh Boyer wrote:

> That should be the question, yes.  The answer is:
>
> However far back people wish to use older stable kernel-headers to build
> applications against newer glibc.
>
> It isn't a clear answer.

Thanks for explaining.

>   Some people stick with older kernels while
> they update their userspace.  I was thinking along the lines of the 3.0
> kernel being the oldest I'd check for but if people think we shouldn't
> bother than that's fine by me.

Based on your explanation, I think 3.0 makes sense, while older
kernels like 2.6.32 are less likely to benefit.  Even when you are
stuck with an old kernel, it is possible to use newer kernel headers.

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


Re: [PATCH] posix_types.h: Cleanup stale __NFDBITS and related definitions

2012-07-25 Thread Ben Hutchings
On Wed, 2012-07-25 at 21:27 -0400, Josh Boyer wrote:
> On Thu, Jul 26, 2012 at 12:26:36AM +0100, Ben Hutchings wrote:
> > On Wed, 2012-07-25 at 10:40 -0400, Josh Boyer wrote:
> > > Recently, glibc made a change to suppress sign-conversion warnings in 
> > > FD_SET
> > > (glibc commit ceb9e56b3d1).  This uncovered an issue with the kernel's
> > > definition of __NFDBITS if applications #include  after
> > > including .  A build failure would be seen when passing the
> > > -Werror=sign-compare and -D_FORTIFY_SOURCE=2 flags to gcc.
> > > 
> > > It was suggested that the kernel should either match the glibc definition 
> > > of
> > > __NFDBITS or remove that entirely.  The current in-kernel uses of 
> > > __NFDBITS
> > > can be replaced with BITS_PER_LONG, and there are no uses of the related
> > > __FDELT and __FDMASK defines.  Given that, we'll continue the cleanup that
> > > was started with commit 8b3d1cda4f5f ("posix_types: Remove fd_set macros")
> > > and drop the remaining unused macros.
> > > 
> > > Additionally, linux/time.h has similar macros defined that expand to 
> > > nothing
> > > so we'll remove those at the same time.
> > > 
> > > Reported-by: Jeff Law 
> > > Suggested-by: Linus Torvalds 
> > > CC: 
> > 
> > # v3.4+
> > 
> > (as 8b3d1cda4f5f went into 3.4)
> >
> 
> Indeed.  However, I believe Linus pointed out that even before
> 8b3d1cda4f5f the macros that were removed weren't actually used.
> It's likely safe to go back further than just 3.4.
> 
> I'll verify again in the morning and include the furthest back we could
> remove these.  For now, let's go with what you suggest to be safe.

Yes, on reflection, this is mostly independent of commit 8b3d1cda4f5f.

The problem is that userland might accidentally be depending on getting
the definitions of NFDBITS and FD_SETSIZE from .  But,
having now read Linus's history of the rotting of these particular bits
, I agree this is
very unlikely.  So, I withdraw my request to restrict the target stable
versions.

Ben.

-- 
Ben Hutchings
Humans are not rational beings; they are rationalising beings.


signature.asc
Description: This is a digitally signed message part


Re: [PATCH] posix_types.h: Cleanup stale __NFDBITS and related definitions

2012-07-25 Thread Josh Boyer
On Wed, Jul 25, 2012 at 08:33:22PM -0500, Jonathan Nieder wrote:
> Hi,
> 
> Josh Boyer wrote:
> 
> > Indeed.  However, I believe Linus pointed out that even before
> > 8b3d1cda4f5f the macros that were removed weren't actually used.
> > It's likely safe to go back further than just 3.4.
> >
> > I'll verify again in the morning and include the furthest back we could
> > remove these.  For now, let's go with what you suggest to be safe.
> 
> I may be in the minority in having this view or missing a subtlety,
> but shouldn't the question be the furthest back we need to remove
> these rather than the furthest back we could?

That should be the question, yes.  The answer is:

However far back people wish to use older stable kernel-headers to build
applications against newer glibc.

It isn't a clear answer.  Some people stick with older kernels while
they update their userspace.  I was thinking along the lines of the 3.0
kernel being the oldest I'd check for but if people think we shouldn't
bother than that's fine by me.

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


Re: [PATCH] posix_types.h: Cleanup stale __NFDBITS and related definitions

2012-07-25 Thread Jonathan Nieder
Hi,

Josh Boyer wrote:

> Indeed.  However, I believe Linus pointed out that even before
> 8b3d1cda4f5f the macros that were removed weren't actually used.
> It's likely safe to go back further than just 3.4.
>
> I'll verify again in the morning and include the furthest back we could
> remove these.  For now, let's go with what you suggest to be safe.

I may be in the minority in having this view or missing a subtlety,
but shouldn't the question be the furthest back we need to remove
these rather than the furthest back we could?

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


Re: [PATCH] posix_types.h: Cleanup stale __NFDBITS and related definitions

2012-07-25 Thread Josh Boyer
On Thu, Jul 26, 2012 at 12:26:36AM +0100, Ben Hutchings wrote:
> On Wed, 2012-07-25 at 10:40 -0400, Josh Boyer wrote:
> > Recently, glibc made a change to suppress sign-conversion warnings in FD_SET
> > (glibc commit ceb9e56b3d1).  This uncovered an issue with the kernel's
> > definition of __NFDBITS if applications #include  after
> > including .  A build failure would be seen when passing the
> > -Werror=sign-compare and -D_FORTIFY_SOURCE=2 flags to gcc.
> > 
> > It was suggested that the kernel should either match the glibc definition of
> > __NFDBITS or remove that entirely.  The current in-kernel uses of __NFDBITS
> > can be replaced with BITS_PER_LONG, and there are no uses of the related
> > __FDELT and __FDMASK defines.  Given that, we'll continue the cleanup that
> > was started with commit 8b3d1cda4f5f ("posix_types: Remove fd_set macros")
> > and drop the remaining unused macros.
> > 
> > Additionally, linux/time.h has similar macros defined that expand to nothing
> > so we'll remove those at the same time.
> > 
> > Reported-by: Jeff Law 
> > Suggested-by: Linus Torvalds 
> > CC: 
> 
> # v3.4+
> 
> (as 8b3d1cda4f5f went into 3.4)
>

Indeed.  However, I believe Linus pointed out that even before
8b3d1cda4f5f the macros that were removed weren't actually used.
It's likely safe to go back further than just 3.4.

I'll verify again in the morning and include the furthest back we could
remove these.  For now, let's go with what you suggest to be safe.

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


Re: [PATCH] posix_types.h: Cleanup stale __NFDBITS and related definitions

2012-07-25 Thread Ben Hutchings
On Wed, 2012-07-25 at 10:40 -0400, Josh Boyer wrote:
> Recently, glibc made a change to suppress sign-conversion warnings in FD_SET
> (glibc commit ceb9e56b3d1).  This uncovered an issue with the kernel's
> definition of __NFDBITS if applications #include  after
> including .  A build failure would be seen when passing the
> -Werror=sign-compare and -D_FORTIFY_SOURCE=2 flags to gcc.
> 
> It was suggested that the kernel should either match the glibc definition of
> __NFDBITS or remove that entirely.  The current in-kernel uses of __NFDBITS
> can be replaced with BITS_PER_LONG, and there are no uses of the related
> __FDELT and __FDMASK defines.  Given that, we'll continue the cleanup that
> was started with commit 8b3d1cda4f5f ("posix_types: Remove fd_set macros")
> and drop the remaining unused macros.
> 
> Additionally, linux/time.h has similar macros defined that expand to nothing
> so we'll remove those at the same time.
> 
> Reported-by: Jeff Law 
> Suggested-by: Linus Torvalds 
> CC: 

# v3.4+

(as 8b3d1cda4f5f went into 3.4)

> Signed-off-by: Josh Boyer 
[...]

-- 
Ben Hutchings
Humans are not rational beings; they are rationalising beings.


signature.asc
Description: This is a digitally signed message part


[PATCH] posix_types.h: Cleanup stale __NFDBITS and related definitions

2012-07-25 Thread Josh Boyer
Recently, glibc made a change to suppress sign-conversion warnings in FD_SET
(glibc commit ceb9e56b3d1).  This uncovered an issue with the kernel's
definition of __NFDBITS if applications #include  after
including .  A build failure would be seen when passing the
-Werror=sign-compare and -D_FORTIFY_SOURCE=2 flags to gcc.

It was suggested that the kernel should either match the glibc definition of
__NFDBITS or remove that entirely.  The current in-kernel uses of __NFDBITS
can be replaced with BITS_PER_LONG, and there are no uses of the related
__FDELT and __FDMASK defines.  Given that, we'll continue the cleanup that
was started with commit 8b3d1cda4f5f ("posix_types: Remove fd_set macros")
and drop the remaining unused macros.

Additionally, linux/time.h has similar macros defined that expand to nothing
so we'll remove those at the same time.

Reported-by: Jeff Law 
Suggested-by: Linus Torvalds 
CC: 
Signed-off-by: Josh Boyer 
---
 arch/mips/kernel/kspd.c |  2 +-
 fs/exec.c   |  2 +-
 fs/select.c | 10 +-
 include/linux/posix_types.h | 18 +++---
 include/linux/time.h|  8 
 kernel/exit.c   |  2 +-
 security/selinux/hooks.c|  2 +-
 7 files changed, 12 insertions(+), 32 deletions(-)

diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index 84d0639..b77f56b 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -323,7 +323,7 @@ static void sp_cleanup(void)
fdt = files_fdtable(files);
for (;;) {
unsigned long set;
-   i = j * __NFDBITS;
+   i = j * BITS_PER_LONG;
if (i >= fdt->max_fds)
break;
set = fdt->open_fds[j++];
diff --git a/fs/exec.c b/fs/exec.c
index da27b91..e95aeed 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1020,7 +1020,7 @@ static void flush_old_files(struct files_struct * files)
unsigned long set, i;
 
j++;
-   i = j * __NFDBITS;
+   i = j * BITS_PER_LONG;
fdt = files_fdtable(files);
if (i >= fdt->max_fds)
break;
diff --git a/fs/select.c b/fs/select.c
index bae3215..db14c78 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -345,8 +345,8 @@ static int max_select_fd(unsigned long n, fd_set_bits *fds)
struct fdtable *fdt;
 
/* handle last in-complete long-word first */
-   set = ~(~0UL << (n & (__NFDBITS-1)));
-   n /= __NFDBITS;
+   set = ~(~0UL << (n & (BITS_PER_LONG-1)));
+   n /= BITS_PER_LONG;
fdt = files_fdtable(current->files);
open_fds = fdt->open_fds + n;
max = 0;
@@ -373,7 +373,7 @@ get_max:
max++;
set >>= 1;
} while (set);
-   max += n * __NFDBITS;
+   max += n * BITS_PER_LONG;
}
 
return max;
@@ -435,11 +435,11 @@ int do_select(int n, fd_set_bits *fds, struct timespec 
*end_time)
in = *inp++; out = *outp++; ex = *exp++;
all_bits = in | out | ex;
if (all_bits == 0) {
-   i += __NFDBITS;
+   i += BITS_PER_LONG;
continue;
}
 
-   for (j = 0; j < __NFDBITS; ++j, ++i, bit <<= 1) {
+   for (j = 0; j < BITS_PER_LONG; ++j, ++i, bit <<= 1) {
int fput_needed;
if (i >= n)
break;
diff --git a/include/linux/posix_types.h b/include/linux/posix_types.h
index f04c98c..0eb4b4b 100644
--- a/include/linux/posix_types.h
+++ b/include/linux/posix_types.h
@@ -15,26 +15,14 @@
  */
 
 /*
- * Those macros may have been defined in . But we always
- * use the ones here. 
+ * This macro may have been defined in . But we always
+ * use the one here. 
  */
-#undef __NFDBITS
-#define __NFDBITS  (8 * sizeof(unsigned long))
-
 #undef __FD_SETSIZE
 #define __FD_SETSIZE   1024
 
-#undef __FDSET_LONGS
-#define __FDSET_LONGS  (__FD_SETSIZE/__NFDBITS)
-
-#undef __FDELT
-#define__FDELT(d)  ((d) / __NFDBITS)
-
-#undef __FDMASK
-#define__FDMASK(d) (1UL << ((d) % __NFDBITS))
-
 typedef struct {
-   unsigned long fds_bits [__FDSET_LONGS];
+   unsigned long fds_bits [__FD_SETSIZE / (8 * sizeof(long))];
 } __kernel_fd_set;
 
 /* Type of a signal handler.  */
diff --git a/include/linux/time.h b/include/linux/time.h
index 179f4d6..c81c5e4 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -257,14 +257,6 @@ static __always_inline void timespec_add_ns(struct 
timespec *a, u64 ns)
 
 #endif /* __KERNEL__ */
 
-#define NFDBITS__NFDBITS
-
-#define FD_SETSIZE __FD_SETSIZE
-#define FD_SET(fd,fdsetp)  __FD_SET(fd,fdsetp)
-#define FD_CLR(fd,fdsetp)   

Re: [PATCH] posix_types.h: Cleanup stale __NFDBITS and related definitions

2012-07-25 Thread Ben Hutchings
On Wed, 2012-07-25 at 10:40 -0400, Josh Boyer wrote:
 Recently, glibc made a change to suppress sign-conversion warnings in FD_SET
 (glibc commit ceb9e56b3d1).  This uncovered an issue with the kernel's
 definition of __NFDBITS if applications #include linux/types.h after
 including sys/select.h.  A build failure would be seen when passing the
 -Werror=sign-compare and -D_FORTIFY_SOURCE=2 flags to gcc.
 
 It was suggested that the kernel should either match the glibc definition of
 __NFDBITS or remove that entirely.  The current in-kernel uses of __NFDBITS
 can be replaced with BITS_PER_LONG, and there are no uses of the related
 __FDELT and __FDMASK defines.  Given that, we'll continue the cleanup that
 was started with commit 8b3d1cda4f5f (posix_types: Remove fd_set macros)
 and drop the remaining unused macros.
 
 Additionally, linux/time.h has similar macros defined that expand to nothing
 so we'll remove those at the same time.
 
 Reported-by: Jeff Law l...@redhat.com
 Suggested-by: Linus Torvalds torva...@linux-foundation.org
 CC: sta...@vger.kernel.org

# v3.4+

(as 8b3d1cda4f5f went into 3.4)

 Signed-off-by: Josh Boyer jwbo...@redhat.com
[...]

-- 
Ben Hutchings
Humans are not rational beings; they are rationalising beings.


signature.asc
Description: This is a digitally signed message part


Re: [PATCH] posix_types.h: Cleanup stale __NFDBITS and related definitions

2012-07-25 Thread Josh Boyer
On Thu, Jul 26, 2012 at 12:26:36AM +0100, Ben Hutchings wrote:
 On Wed, 2012-07-25 at 10:40 -0400, Josh Boyer wrote:
  Recently, glibc made a change to suppress sign-conversion warnings in FD_SET
  (glibc commit ceb9e56b3d1).  This uncovered an issue with the kernel's
  definition of __NFDBITS if applications #include linux/types.h after
  including sys/select.h.  A build failure would be seen when passing the
  -Werror=sign-compare and -D_FORTIFY_SOURCE=2 flags to gcc.
  
  It was suggested that the kernel should either match the glibc definition of
  __NFDBITS or remove that entirely.  The current in-kernel uses of __NFDBITS
  can be replaced with BITS_PER_LONG, and there are no uses of the related
  __FDELT and __FDMASK defines.  Given that, we'll continue the cleanup that
  was started with commit 8b3d1cda4f5f (posix_types: Remove fd_set macros)
  and drop the remaining unused macros.
  
  Additionally, linux/time.h has similar macros defined that expand to nothing
  so we'll remove those at the same time.
  
  Reported-by: Jeff Law l...@redhat.com
  Suggested-by: Linus Torvalds torva...@linux-foundation.org
  CC: sta...@vger.kernel.org
 
 # v3.4+
 
 (as 8b3d1cda4f5f went into 3.4)


Indeed.  However, I believe Linus pointed out that even before
8b3d1cda4f5f the macros that were removed weren't actually used.
It's likely safe to go back further than just 3.4.

I'll verify again in the morning and include the furthest back we could
remove these.  For now, let's go with what you suggest to be safe.

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


Re: [PATCH] posix_types.h: Cleanup stale __NFDBITS and related definitions

2012-07-25 Thread Jonathan Nieder
Hi,

Josh Boyer wrote:

 Indeed.  However, I believe Linus pointed out that even before
 8b3d1cda4f5f the macros that were removed weren't actually used.
 It's likely safe to go back further than just 3.4.

 I'll verify again in the morning and include the furthest back we could
 remove these.  For now, let's go with what you suggest to be safe.

I may be in the minority in having this view or missing a subtlety,
but shouldn't the question be the furthest back we need to remove
these rather than the furthest back we could?

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


Re: [PATCH] posix_types.h: Cleanup stale __NFDBITS and related definitions

2012-07-25 Thread Josh Boyer
On Wed, Jul 25, 2012 at 08:33:22PM -0500, Jonathan Nieder wrote:
 Hi,
 
 Josh Boyer wrote:
 
  Indeed.  However, I believe Linus pointed out that even before
  8b3d1cda4f5f the macros that were removed weren't actually used.
  It's likely safe to go back further than just 3.4.
 
  I'll verify again in the morning and include the furthest back we could
  remove these.  For now, let's go with what you suggest to be safe.
 
 I may be in the minority in having this view or missing a subtlety,
 but shouldn't the question be the furthest back we need to remove
 these rather than the furthest back we could?

That should be the question, yes.  The answer is:

However far back people wish to use older stable kernel-headers to build
applications against newer glibc.

It isn't a clear answer.  Some people stick with older kernels while
they update their userspace.  I was thinking along the lines of the 3.0
kernel being the oldest I'd check for but if people think we shouldn't
bother than that's fine by me.

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


Re: [PATCH] posix_types.h: Cleanup stale __NFDBITS and related definitions

2012-07-25 Thread Ben Hutchings
On Wed, 2012-07-25 at 21:27 -0400, Josh Boyer wrote:
 On Thu, Jul 26, 2012 at 12:26:36AM +0100, Ben Hutchings wrote:
  On Wed, 2012-07-25 at 10:40 -0400, Josh Boyer wrote:
   Recently, glibc made a change to suppress sign-conversion warnings in 
   FD_SET
   (glibc commit ceb9e56b3d1).  This uncovered an issue with the kernel's
   definition of __NFDBITS if applications #include linux/types.h after
   including sys/select.h.  A build failure would be seen when passing the
   -Werror=sign-compare and -D_FORTIFY_SOURCE=2 flags to gcc.
   
   It was suggested that the kernel should either match the glibc definition 
   of
   __NFDBITS or remove that entirely.  The current in-kernel uses of 
   __NFDBITS
   can be replaced with BITS_PER_LONG, and there are no uses of the related
   __FDELT and __FDMASK defines.  Given that, we'll continue the cleanup that
   was started with commit 8b3d1cda4f5f (posix_types: Remove fd_set macros)
   and drop the remaining unused macros.
   
   Additionally, linux/time.h has similar macros defined that expand to 
   nothing
   so we'll remove those at the same time.
   
   Reported-by: Jeff Law l...@redhat.com
   Suggested-by: Linus Torvalds torva...@linux-foundation.org
   CC: sta...@vger.kernel.org
  
  # v3.4+
  
  (as 8b3d1cda4f5f went into 3.4)
 
 
 Indeed.  However, I believe Linus pointed out that even before
 8b3d1cda4f5f the macros that were removed weren't actually used.
 It's likely safe to go back further than just 3.4.
 
 I'll verify again in the morning and include the furthest back we could
 remove these.  For now, let's go with what you suggest to be safe.

Yes, on reflection, this is mostly independent of commit 8b3d1cda4f5f.

The problem is that userland might accidentally be depending on getting
the definitions of NFDBITS and FD_SETSIZE from linux/time.h.  But,
having now read Linus's history of the rotting of these particular bits
http://article.gmane.org/gmane.linux.kernel/1332560, I agree this is
very unlikely.  So, I withdraw my request to restrict the target stable
versions.

Ben.

-- 
Ben Hutchings
Humans are not rational beings; they are rationalising beings.


signature.asc
Description: This is a digitally signed message part


Re: [PATCH] posix_types.h: Cleanup stale __NFDBITS and related definitions

2012-07-25 Thread Jonathan Nieder
Josh Boyer wrote:

 That should be the question, yes.  The answer is:

 However far back people wish to use older stable kernel-headers to build
 applications against newer glibc.

 It isn't a clear answer.

Thanks for explaining.

   Some people stick with older kernels while
 they update their userspace.  I was thinking along the lines of the 3.0
 kernel being the oldest I'd check for but if people think we shouldn't
 bother than that's fine by me.

Based on your explanation, I think 3.0 makes sense, while older
kernels like 2.6.32 are less likely to benefit.  Even when you are
stuck with an old kernel, it is possible to use newer kernel headers.

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


[PATCH] posix_types.h: Cleanup stale __NFDBITS and related definitions

2012-07-25 Thread Josh Boyer
Recently, glibc made a change to suppress sign-conversion warnings in FD_SET
(glibc commit ceb9e56b3d1).  This uncovered an issue with the kernel's
definition of __NFDBITS if applications #include linux/types.h after
including sys/select.h.  A build failure would be seen when passing the
-Werror=sign-compare and -D_FORTIFY_SOURCE=2 flags to gcc.

It was suggested that the kernel should either match the glibc definition of
__NFDBITS or remove that entirely.  The current in-kernel uses of __NFDBITS
can be replaced with BITS_PER_LONG, and there are no uses of the related
__FDELT and __FDMASK defines.  Given that, we'll continue the cleanup that
was started with commit 8b3d1cda4f5f (posix_types: Remove fd_set macros)
and drop the remaining unused macros.

Additionally, linux/time.h has similar macros defined that expand to nothing
so we'll remove those at the same time.

Reported-by: Jeff Law l...@redhat.com
Suggested-by: Linus Torvalds torva...@linux-foundation.org
CC: sta...@vger.kernel.org
Signed-off-by: Josh Boyer jwbo...@redhat.com
---
 arch/mips/kernel/kspd.c |  2 +-
 fs/exec.c   |  2 +-
 fs/select.c | 10 +-
 include/linux/posix_types.h | 18 +++---
 include/linux/time.h|  8 
 kernel/exit.c   |  2 +-
 security/selinux/hooks.c|  2 +-
 7 files changed, 12 insertions(+), 32 deletions(-)

diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index 84d0639..b77f56b 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -323,7 +323,7 @@ static void sp_cleanup(void)
fdt = files_fdtable(files);
for (;;) {
unsigned long set;
-   i = j * __NFDBITS;
+   i = j * BITS_PER_LONG;
if (i = fdt-max_fds)
break;
set = fdt-open_fds[j++];
diff --git a/fs/exec.c b/fs/exec.c
index da27b91..e95aeed 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1020,7 +1020,7 @@ static void flush_old_files(struct files_struct * files)
unsigned long set, i;
 
j++;
-   i = j * __NFDBITS;
+   i = j * BITS_PER_LONG;
fdt = files_fdtable(files);
if (i = fdt-max_fds)
break;
diff --git a/fs/select.c b/fs/select.c
index bae3215..db14c78 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -345,8 +345,8 @@ static int max_select_fd(unsigned long n, fd_set_bits *fds)
struct fdtable *fdt;
 
/* handle last in-complete long-word first */
-   set = ~(~0UL  (n  (__NFDBITS-1)));
-   n /= __NFDBITS;
+   set = ~(~0UL  (n  (BITS_PER_LONG-1)));
+   n /= BITS_PER_LONG;
fdt = files_fdtable(current-files);
open_fds = fdt-open_fds + n;
max = 0;
@@ -373,7 +373,7 @@ get_max:
max++;
set = 1;
} while (set);
-   max += n * __NFDBITS;
+   max += n * BITS_PER_LONG;
}
 
return max;
@@ -435,11 +435,11 @@ int do_select(int n, fd_set_bits *fds, struct timespec 
*end_time)
in = *inp++; out = *outp++; ex = *exp++;
all_bits = in | out | ex;
if (all_bits == 0) {
-   i += __NFDBITS;
+   i += BITS_PER_LONG;
continue;
}
 
-   for (j = 0; j  __NFDBITS; ++j, ++i, bit = 1) {
+   for (j = 0; j  BITS_PER_LONG; ++j, ++i, bit = 1) {
int fput_needed;
if (i = n)
break;
diff --git a/include/linux/posix_types.h b/include/linux/posix_types.h
index f04c98c..0eb4b4b 100644
--- a/include/linux/posix_types.h
+++ b/include/linux/posix_types.h
@@ -15,26 +15,14 @@
  */
 
 /*
- * Those macros may have been defined in gnu/types.h. But we always
- * use the ones here. 
+ * This macro may have been defined in gnu/types.h. But we always
+ * use the one here. 
  */
-#undef __NFDBITS
-#define __NFDBITS  (8 * sizeof(unsigned long))
-
 #undef __FD_SETSIZE
 #define __FD_SETSIZE   1024
 
-#undef __FDSET_LONGS
-#define __FDSET_LONGS  (__FD_SETSIZE/__NFDBITS)
-
-#undef __FDELT
-#define__FDELT(d)  ((d) / __NFDBITS)
-
-#undef __FDMASK
-#define__FDMASK(d) (1UL  ((d) % __NFDBITS))
-
 typedef struct {
-   unsigned long fds_bits [__FDSET_LONGS];
+   unsigned long fds_bits [__FD_SETSIZE / (8 * sizeof(long))];
 } __kernel_fd_set;
 
 /* Type of a signal handler.  */
diff --git a/include/linux/time.h b/include/linux/time.h
index 179f4d6..c81c5e4 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -257,14 +257,6 @@ static __always_inline void timespec_add_ns(struct 
timespec *a, u64 ns)
 
 #endif /* __KERNEL__ */
 
-#define NFDBITS__NFDBITS
-
-#define FD_SETSIZE