aboutsummaryrefslogtreecommitdiffstats
path: root/fs/select.c
diff options
context:
space:
mode:
authorJosh Boyer <jwboyer@redhat.com>2012-07-25 10:40:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-07-26 16:36:43 -0400
commit8ded2bbc1845e19c771eb55209aab166ef011243 (patch)
tree9ab400cdd407a9426fdfcc3432d7c0e19a0607ed /fs/select.c
parent4cb38750d49010ae72e718d46605ac9ba5a851b4 (diff)
posix_types.h: Cleanup stale __NFDBITS and related definitions
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 <law@redhat.com> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org> CC: <stable@vger.kernel.org> Signed-off-by: Josh Boyer <jwboyer@redhat.com> [ .. and fix up whitespace as per akpm ] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/select.c')
-rw-r--r--fs/select.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/select.c b/fs/select.c
index bae321569dfa..db14c781335e 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)
345 struct fdtable *fdt; 345 struct fdtable *fdt;
346 346
347 /* handle last in-complete long-word first */ 347 /* handle last in-complete long-word first */
348 set = ~(~0UL << (n & (__NFDBITS-1))); 348 set = ~(~0UL << (n & (BITS_PER_LONG-1)));
349 n /= __NFDBITS; 349 n /= BITS_PER_LONG;
350 fdt = files_fdtable(current->files); 350 fdt = files_fdtable(current->files);
351 open_fds = fdt->open_fds + n; 351 open_fds = fdt->open_fds + n;
352 max = 0; 352 max = 0;
@@ -373,7 +373,7 @@ get_max:
373 max++; 373 max++;
374 set >>= 1; 374 set >>= 1;
375 } while (set); 375 } while (set);
376 max += n * __NFDBITS; 376 max += n * BITS_PER_LONG;
377 } 377 }
378 378
379 return max; 379 return max;
@@ -435,11 +435,11 @@ int do_select(int n, fd_set_bits *fds, struct timespec *end_time)
435 in = *inp++; out = *outp++; ex = *exp++; 435 in = *inp++; out = *outp++; ex = *exp++;
436 all_bits = in | out | ex; 436 all_bits = in | out | ex;
437 if (all_bits == 0) { 437 if (all_bits == 0) {
438 i += __NFDBITS; 438 i += BITS_PER_LONG;
439 continue; 439 continue;
440 } 440 }
441 441
442 for (j = 0; j < __NFDBITS; ++j, ++i, bit <<= 1) { 442 for (j = 0; j < BITS_PER_LONG; ++j, ++i, bit <<= 1) {
443 int fput_needed; 443 int fput_needed;
444 if (i >= n) 444 if (i >= n)
445 break; 445 break;