Bug#511700: libqtcore4: Sockets > 1024 cause warning flood
Package: libqtcore4
Version: 4.4.3-1
Severity: normal
Tags: patch
If you use sockets > 1024, QSocketNotifier prints out
QSocketNotifier: Socket descriptor too large for select()
However, if Qt is compiled with Glib support, glib uses poll() and not
select, so this warning is wrong.
Programs still work fine, but the output gets filled with these warnings.
The attached patch disables the warning when running with the glib event
loop.
-- System Information:
Debian Release: 5.0
APT prefers testing
APT policy: (500, 'testing')
Architecture: i386 (i686)
Kernel: Linux 2.6.26-1-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages libqtcore4 depends on:
ii libc6 2.7-16 GNU C Library: Shared libraries
ii libgcc1 1:4.3.2-1.1 GCC support library
ii libglib2.0-0 2.16.6-1 The GLib library of C routines
ii libstdc++6 4.3.2-1.1 The GNU Standard C++ Library v3
ii zlib1g 1:1.2.3.3.dfsg-12 compression library - runtime
libqtcore4 recommends no packages.
libqtcore4 suggests no packages.
-- no debconf information
--- qt-x11-opensource-src-4.4.3/src/corelib/kernel/qsocketnotifier.cpp 2008-09-27 10:58:47.000000000 +0200
+++ qt-x11-4.4.3/src/corelib/kernel/qsocketnotifier.cpp 2009-01-12 16:50:55.000000000 +0100
@@ -168,10 +168,6 @@
{
if (socket < 0)
qWarning("QSocketNotifier: Invalid socket specified");
-#if defined(Q_OS_UNIX)
- if (socket >= FD_SETSIZE)
- qWarning("QSocketNotifier: Socket descriptor too large for select()");
-#endif
sockfd = socket;
sntype = type;
snenabled = true;
@@ -180,6 +176,14 @@
if (!d->threadData->eventDispatcher) {
qWarning("QSocketNotifier: Can only be used with threads started with QThread");
} else {
+#if defined(Q_OS_UNIX)
+#ifdef QT_NO_GLIB
+ if (socket >= FD_SETSIZE)
+#else
+ if ((socket >= FD_SETSIZE) && (QLatin1String(d->threadData->eventDispatcher->metaObject()->className()) != QLatin1String("QEventDispatcherGlib")))
+#endif
+ qWarning("QSocketNotifier: Socket descriptor too large for select()");
+#endif
d->threadData->eventDispatcher->registerSocketNotifier(this);
}
}
@@ -206,10 +210,6 @@
setObjectName(QString::fromAscii(name));
if (socket < 0)
qWarning("QSocketNotifier: Invalid socket specified");
-#if defined(Q_OS_UNIX)
- if (socket >= FD_SETSIZE)
- qWarning("QSocketNotifier: Socket descriptor too large for select()");
-#endif
sockfd = socket;
sntype = type;
snenabled = true;
@@ -218,6 +218,14 @@
if (!d->threadData->eventDispatcher) {
qWarning("QSocketNotifier: Can only be used with threads started with QThread");
} else {
+#if defined(Q_OS_UNIX)
+#ifdef QT_NO_GLIB
+ if (socket >= FD_SETSIZE)
+#else
+ if ((socket >= FD_SETSIZE) && (QLatin1String(d->threadData->eventDispatcher->metaObject()->className()) != QLatin1String("QEventDispatcherGlib")))
+#endif
+ qWarning("QSocketNotifier: Socket descriptor too large for select()");
+#endif
d->threadData->eventDispatcher->registerSocketNotifier(this);
}
}
Reply to: