QT_BEGIN_NAMESPACE
+#ifndef QT_NO_DEBUG
+static const long maxOpenFiles = sysconf(_SC_OPEN_MAX);
+#endif
+
QEventDispatcherUNIXPrivate::QEventDispatcherUNIXPrivate()
: sn_highest(-1),
interrupt(false)
int sockfd = notifier->socket();
int type = notifier->type();
#ifndef QT_NO_DEBUG
- if (sockfd < 0
- || unsigned(sockfd) >= FD_SETSIZE) {
+ if (Q_UNLIKELY(sockfd < 0 || sockfd >= maxOpenFiles)) {
qWarning("QSocketNotifier: Internal error");
return;
- } else if (notifier->thread() != thread()
- || thread() != QThread::currentThread()) {
+ } else if (Q_UNLIKELY(notifier->thread() != thread() || thread() != QThread::currentThread())) {
qWarning("QSocketNotifier: socket notifiers cannot be enabled from another thread");
return;
}
int sockfd = notifier->socket();
int type = notifier->type();
#ifndef QT_NO_DEBUG
- if (sockfd < 0
- || unsigned(sockfd) >= FD_SETSIZE) {
+ if (Q_UNLIKELY(sockfd < 0 || sockfd >= maxOpenFiles)) {
qWarning("QSocketNotifier: Internal error");
return;
- } else if (notifier->thread() != thread()
- || thread() != QThread::currentThread()) {
+ } else if (Q_UNLIKELY(notifier->thread() != thread() || thread() != QThread::currentThread())) {
qWarning("QSocketNotifier: socket notifiers cannot be disabled from another thread");
return;
}
int sockfd = notifier->socket();
int type = notifier->type();
#ifndef QT_NO_DEBUG
- if (sockfd < 0
- || unsigned(sockfd) >= FD_SETSIZE) {
+ if (Q_UNLIKELY(sockfd < 0 || sockfd >= maxOpenFiles)) {
qWarning("QSocketNotifier: Internal error");
return;
}