linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] posix_types.h: make __NFDBITS match glibc definition
@ 2012-07-24 18:12 Josh Boyer
  2012-07-24 18:20 ` Linus Torvalds
  0 siblings, 1 reply; 24+ messages in thread
From: Josh Boyer @ 2012-07-24 18:12 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: law, linux-kernel

Recent glibc made a change to suppress sign-conversion warnings from FD_SET
(glibc commit ceb9e56b3d1).  That patch solved the particular error it was
aiming to, however applications that #include <linux/types.h> after
including <sys/select.h> can now hit a build failure if -Werror=sign-compare
and -D_FORTIFY_SOURCE=2 is passed to gcc.  This can be seen when building
this trivial application against a recent enough glibc:

| #include <sys/select.h>
| #include <linux/types.h>
|
| int main(int argc, char **argv)
| {
|   fd_set fds;
|   FD_ZERO(&fds);
|   FD_SET(0, &fds);
|   return FD_ISSET(0, &fds);
| }

It was suggested the kernel should either match the glibc definition of
__NFDBITS in linux/posix_types.h or remove it entirely.  Given that we
don't know what applications may be relying on the header having a
definition, we opt for the former.

This resolves https://bugzilla.redhat.com/show_bug.cgi?id=837641

Reported-by: Jeff Law <law@redhat.com>
Signed-off-by: Josh Boyer <jwboyer@redhat.com>
---
 include/linux/posix_types.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/posix_types.h b/include/linux/posix_types.h
index f04c98c..cc8530e 100644
--- a/include/linux/posix_types.h
+++ b/include/linux/posix_types.h
@@ -19,7 +19,7 @@
  * use the ones here. 
  */
 #undef __NFDBITS
-#define __NFDBITS	(8 * sizeof(unsigned long))
+#define __NFDBITS	(8 * (int) sizeof(long int))
 
 #undef __FD_SETSIZE
 #define __FD_SETSIZE	1024
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2012-07-24 20:52 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-24 18:12 [PATCH] posix_types.h: make __NFDBITS match glibc definition Josh Boyer
2012-07-24 18:20 ` Linus Torvalds
2012-07-24 18:24   ` Josh Boyer
2012-07-24 18:32     ` [PATCH v2] posix_types.h: make __NFDBITS compatible with " Josh Boyer
2012-07-24 18:46       ` Linus Torvalds
2012-07-24 19:03         ` Josh Boyer
2012-07-24 19:09           ` Linus Torvalds
2012-07-24 19:15             ` Jeff Law
2012-07-24 19:24               ` Linus Torvalds
2012-07-24 19:26                 ` Jeff Law
2012-07-24 19:43                   ` Josh Boyer
2012-07-24 19:55                     ` Linus Torvalds
2012-07-24 20:10                       ` Josh Boyer
2012-07-24 20:13                         ` Linus Torvalds
2012-07-24 20:02                     ` Andreas Schwab
2012-07-24 19:43                   ` Linus Torvalds
2012-07-24 20:01                     ` Jeff Law
2012-07-24 19:19     ` [PATCH] posix_types.h: make __NFDBITS match " Jeff Law
2012-07-24 19:37       ` Linus Torvalds
2012-07-24 19:39         ` Linus Torvalds
2012-07-24 19:41         ` Josh Boyer
2012-07-24 19:59           ` Linus Torvalds
2012-07-24 20:11             ` Linus Torvalds
2012-07-24 20:52               ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).