1 diff -up qt-everywhere-opensource-src-4.8.6/src/corelib/io/qprocess_unix.cpp.poll qt-everywhere-opensource-src-4.8.6/src/corelib/io/qprocess_unix.cpp
2 --- qt-everywhere-opensource-src-4.8.6/src/corelib/io/qprocess_unix.cpp.poll 2014-03-30 15:36:48.000000000 -0500
3 +++ qt-everywhere-opensource-src-4.8.6/src/corelib/io/qprocess_unix.cpp 2014-03-31 18:04:05.958260978 -0500
4 @@ -158,13 +158,6 @@ static void qt_sa_sigchld_sigaction(int
8 -static inline void add_fd(int &nfds, int fd, fd_set *fdset)
18 @@ -256,9 +249,9 @@ QProcessManager::~QProcessManager()
19 void QProcessManager::run()
24 - FD_SET(qt_qprocess_deadChild_pipe[0], &readset);
26 + fd.fd = qt_qprocess_deadChild_pipe[0];
29 #if defined (QPROCESS_DEBUG)
30 qDebug() << "QProcessManager::run() waiting for children to die";
31 @@ -267,8 +260,8 @@ void QProcessManager::run()
32 // block forever, or until activity is detected on the dead child
33 // pipe. the only other peers are the SIGCHLD signal handler, and the
34 // QProcessManager destructor.
35 - int nselect = select(qt_qprocess_deadChild_pipe[0] + 1, &readset, 0, 0, 0);
37 + int ret = qt_safe_poll(&fd, 1, -1, /* retry_eintr */ false);
42 @@ -1027,17 +1020,6 @@ void QProcessPrivate::killProcess()
43 ::kill(pid_t(pid), SIGKILL);
46 -static int select_msecs(int nfds, fd_set *fdread, fd_set *fdwrite, int timeout)
49 - return qt_safe_select(nfds, fdread, fdwrite, 0, 0);
52 - tv.tv_sec = timeout / 1000;
53 - tv.tv_usec = (timeout % 1000) * 1000;
54 - return qt_safe_select(nfds, fdread, fdwrite, 0, &tv);
58 Returns the difference between msecs and elapsed. If msecs is -1,
59 however, -1 is returned.
60 @@ -1060,10 +1042,10 @@ bool QProcessPrivate::waitForStarted(int
66 - FD_SET(childStartedPipe[0], &fds);
67 - if (select_msecs(childStartedPipe[0] + 1, &fds, 0, msecs) == 0) {
69 + fd.fd = childStartedPipe[0];
71 + if (qt_safe_poll(&fd, 1, msecs) == 0) {
72 processError = QProcess::Timedout;
73 q->setErrorString(QProcess::tr("Process operation timed out"));
74 #if defined (QPROCESS_DEBUG)
75 @@ -1079,6 +1061,47 @@ bool QProcessPrivate::waitForStarted(int
76 return startedEmitted;
79 +class QProcessFDSet {
82 + static size_t size()
84 + return sizeof(fds)/sizeof(fds[0]);
88 + QProcessFDSet(QProcessPrivate &proc)
90 + for (size_t i = 0; i < size(); ++i) {
92 + fds[i].events = POLLIN;
94 + death().fd = proc.deathPipe[0];
96 + if (proc.processState == QProcess::Starting)
97 + started().fd = proc.childStartedPipe[0];
99 + stdout().fd = proc.stdoutChannel.pipe[0];
100 + stderr().fd = proc.stderrChannel.pipe[0];
102 + if (!proc.writeBuffer.isEmpty()) {
103 + stdin().fd = proc.stdinChannel.pipe[1];
104 + stdin().events = POLLOUT;
108 + int poll(int timeout)
110 + return qt_safe_poll(fds, size(), timeout);
113 + pollfd &death() { return fds[0]; }
114 + pollfd &started() { return fds[1]; }
115 + pollfd &stdout() { return fds[2]; }
116 + pollfd &stderr() { return fds[3]; }
117 + pollfd &stdin() { return fds[4]; }
120 bool QProcessPrivate::waitForReadyRead(int msecs)
123 @@ -1090,28 +1113,9 @@ bool QProcessPrivate::waitForReadyRead(i
133 - int nfds = deathPipe[0];
134 - FD_SET(deathPipe[0], &fdread);
136 - if (processState == QProcess::Starting)
137 - add_fd(nfds, childStartedPipe[0], &fdread);
139 - if (stdoutChannel.pipe[0] != -1)
140 - add_fd(nfds, stdoutChannel.pipe[0], &fdread);
141 - if (stderrChannel.pipe[0] != -1)
142 - add_fd(nfds, stderrChannel.pipe[0], &fdread);
144 - if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
145 - add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
147 + QProcessFDSet fdset(*this);
148 int timeout = qt_timeout_value(msecs, stopWatch.elapsed());
149 - int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
150 + int ret = fdset.poll(timeout);
154 @@ -1121,18 +1125,18 @@ bool QProcessPrivate::waitForReadyRead(i
158 - if (childStartedPipe[0] != -1 && FD_ISSET(childStartedPipe[0], &fdread)) {
159 + if (qt_readable(fdset.started())) {
160 if (!_q_startupNotification())
164 bool readyReadEmitted = false;
165 - if (stdoutChannel.pipe[0] != -1 && FD_ISSET(stdoutChannel.pipe[0], &fdread)) {
166 + if (qt_readable(fdset.stdout())) {
167 bool canRead = _q_canReadStandardOutput();
168 if (processChannel == QProcess::StandardOutput && canRead)
169 readyReadEmitted = true;
171 - if (stderrChannel.pipe[0] != -1 && FD_ISSET(stderrChannel.pipe[0], &fdread)) {
172 + if (qt_readable(fdset.stderr())) {
173 bool canRead = _q_canReadStandardError();
174 if (processChannel == QProcess::StandardError && canRead)
175 readyReadEmitted = true;
176 @@ -1140,13 +1144,13 @@ bool QProcessPrivate::waitForReadyRead(i
177 if (readyReadEmitted)
180 - if (stdinChannel.pipe[1] != -1 && FD_ISSET(stdinChannel.pipe[1], &fdwrite))
181 + if (qt_writable(fdset.stdin()))
184 - if (deathPipe[0] == -1 || FD_ISSET(deathPipe[0], &fdread)) {
185 + if (qt_readable(fdset.death())) {
186 if (_q_processDied())
193 @@ -1162,29 +1166,9 @@ bool QProcessPrivate::waitForBytesWritte
196 while (!writeBuffer.isEmpty()) {
203 - int nfds = deathPipe[0];
204 - FD_SET(deathPipe[0], &fdread);
206 - if (processState == QProcess::Starting)
207 - add_fd(nfds, childStartedPipe[0], &fdread);
209 - if (stdoutChannel.pipe[0] != -1)
210 - add_fd(nfds, stdoutChannel.pipe[0], &fdread);
211 - if (stderrChannel.pipe[0] != -1)
212 - add_fd(nfds, stderrChannel.pipe[0], &fdread);
215 - if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
216 - add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
218 + QProcessFDSet fdset(*this);
219 int timeout = qt_timeout_value(msecs, stopWatch.elapsed());
220 - int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
221 + int ret = fdset.poll(timeout);
225 @@ -1195,24 +1179,24 @@ bool QProcessPrivate::waitForBytesWritte
229 - if (childStartedPipe[0] != -1 && FD_ISSET(childStartedPipe[0], &fdread)) {
230 + if (qt_readable(fdset.started())) {
231 if (!_q_startupNotification())
235 - if (stdinChannel.pipe[1] != -1 && FD_ISSET(stdinChannel.pipe[1], &fdwrite))
236 + if (qt_writable(fdset.stdin()))
237 return _q_canWrite();
239 - if (stdoutChannel.pipe[0] != -1 && FD_ISSET(stdoutChannel.pipe[0], &fdread))
240 + if (qt_readable(fdset.stdout()))
241 _q_canReadStandardOutput();
243 - if (stderrChannel.pipe[0] != -1 && FD_ISSET(stderrChannel.pipe[0], &fdread))
244 + if (qt_readable(fdset.stderr()))
245 _q_canReadStandardError();
247 - if (deathPipe[0] == -1 || FD_ISSET(deathPipe[0], &fdread)) {
248 - if (_q_processDied())
251 + if (qt_readable(fdset.death())) {
252 + if (_q_processDied())
258 @@ -1229,29 +1213,9 @@ bool QProcessPrivate::waitForFinished(in
269 - if (processState == QProcess::Starting)
270 - add_fd(nfds, childStartedPipe[0], &fdread);
272 - if (stdoutChannel.pipe[0] != -1)
273 - add_fd(nfds, stdoutChannel.pipe[0], &fdread);
274 - if (stderrChannel.pipe[0] != -1)
275 - add_fd(nfds, stderrChannel.pipe[0], &fdread);
277 - if (processState == QProcess::Running)
278 - add_fd(nfds, deathPipe[0], &fdread);
280 - if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
281 - add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
283 + QProcessFDSet fdset(*this);
284 int timeout = qt_timeout_value(msecs, stopWatch.elapsed());
285 - int ret = select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
286 + int ret = fdset.poll(timeout);
290 @@ -1261,20 +1225,20 @@ bool QProcessPrivate::waitForFinished(in
294 - if (childStartedPipe[0] != -1 && FD_ISSET(childStartedPipe[0], &fdread)) {
295 + if (qt_readable(fdset.started())) {
296 if (!_q_startupNotification())
299 - if (stdinChannel.pipe[1] != -1 && FD_ISSET(stdinChannel.pipe[1], &fdwrite))
300 + if (qt_writable(fdset.stdin()))
303 - if (stdoutChannel.pipe[0] != -1 && FD_ISSET(stdoutChannel.pipe[0], &fdread))
304 + if (qt_readable(fdset.stdout()))
305 _q_canReadStandardOutput();
307 - if (stderrChannel.pipe[0] != -1 && FD_ISSET(stderrChannel.pipe[0], &fdread))
308 + if (qt_readable(fdset.stderr()))
309 _q_canReadStandardError();
311 - if (deathPipe[0] == -1 || FD_ISSET(deathPipe[0], &fdread)) {
312 + if (qt_readable(fdset.death())) {
313 if (_q_processDied())
316 @@ -1284,10 +1248,10 @@ bool QProcessPrivate::waitForFinished(in
318 bool QProcessPrivate::waitForWrite(int msecs)
322 - FD_SET(stdinChannel.pipe[1], &fdwrite);
323 - return select_msecs(stdinChannel.pipe[1] + 1, 0, &fdwrite, msecs < 0 ? 0 : msecs) == 1;
325 + fd.fd = stdinChannel.pipe[1];
326 + fd.events = POLLIN;
327 + return qt_safe_poll(&fd, 1, msecs);
330 void QProcessPrivate::findExitCode()
331 diff -up qt-everywhere-opensource-src-4.8.6/src/corelib/kernel/qcore_unix.cpp.poll qt-everywhere-opensource-src-4.8.6/src/corelib/kernel/qcore_unix.cpp
332 --- qt-everywhere-opensource-src-4.8.6/src/corelib/kernel/qcore_unix.cpp.poll 2014-03-30 15:36:48.000000000 -0500
333 +++ qt-everywhere-opensource-src-4.8.6/src/corelib/kernel/qcore_unix.cpp 2014-03-31 18:01:59.369715403 -0500
334 @@ -99,4 +99,165 @@ int qt_safe_select(int nfds, fd_set *fdr
338 +#ifndef Q_OS_VXWORKS
340 +int qt_safe_poll(struct pollfd *fds, int nfds, int timeout_ms, bool retry_eintr)
349 + // Retry on ret == 0 if the deadline has not yet passed because
350 + // Linux can return early from the syscall, without setting EINTR.
351 + if (timeout_ms < 0) {
353 + int ret = ::poll(fds, nfds, -1);
357 + if (ret == 0 || ret == -1 && errno == EINTR) {
371 + timeval previous = qt_gettime();
372 + timeval deadline = previous;
373 + deadline.tv_sec += timeout_ms / 1000;
374 + deadline.tv_usec += (timeout_ms % 1000) * 1000;
375 + if (deadline.tv_usec >= 1000000) {
377 + deadline.tv_usec -= 1000000;
379 + int remaining = timeout_ms;
382 + int ret = ::poll(fds, nfds, remaining);
385 + timeval now = qt_gettime();
386 + if ((now.tv_sec > deadline.tv_sec // past deadline
387 + || (now.tv_sec == deadline.tv_sec
388 + && now.tv_usec >= deadline.tv_usec))
389 + || (now.tv_sec < previous.tv_sec // time warp
390 + || (now.tv_sec == previous.tv_sec
391 + && now.tv_usec < previous.tv_usec))
392 + || (ret < 0 && (errno != EINTR || !retry_eintr))) // other error
394 + if (ret == 0 && !retry_eintr) {
398 + remaining = (deadline.tv_sec - now.tv_sec) * 1000
399 + + (deadline.tv_usec - now.tv_usec) / 1000;
406 +// Poll emulation for VxWorks.
408 +static int mark_bad_descriptors(pollfd *fds, int nfds)
417 + // Check each descriptor invidually for badness.
418 + for (int i = 0; i < nfds; ++i) {
419 + pollfd &fd(fds[i]);
422 + int ret = qt_safe_select(fd.fd + 1, &r, NULL, NULL, &tv);
424 + if (ret < 0 && errno == EBADF) {
425 + fd.revents = POLLNVAL;
434 +int qt_safe_poll(pollfd *fds, int nfds, int timeout, bool retry_eintr)
441 + // Extract the watched descriptors.
442 + for (int i = 0; i < nfds; ++i) {
443 + pollfd &fd(fds[i]);
444 + if (fd.fd >= 0 && fd.fd < FD_SETSIZE) {
445 + if (fd.events & POLLIN) {
450 + if (fd.events & POLLOUT) {
458 + // If timeout is negative, wait indefinitely for activity.
461 + if (timeout >= 0) {
462 + tv.tv_sec = timeout / 1000;
463 + tv.tv_usec = (timeout % 1000) * 1000;
470 + ret = qt_safe_select(maxfd + 1, &r, &w, NULL, ptv);
472 + ret = ::select(maxfd + 1, &r, &w, NULL, ptv);
473 + if (ret < 0 && errno == EBADF) {
474 + return mark_bad_descriptors(fds, nfds);
479 + // Set the revents flags.
481 + for (int i = 0; i < nfds; ++i) {
482 + pollfd &fd(fds[i]);
484 + if (fd.fd >= 0 && fd.fd < FD_SETSIZE) {
485 + if ((fd.events & POLLIN) && FD_ISSET(fd.fd, &r))
486 + fd.revents |= POLLIN;
487 + if ((fd.events & POLLOUT) && FD_ISSET(fd.fd, &w))
488 + fd.revents |= POLLOUT;
500 diff -up qt-everywhere-opensource-src-4.8.6/src/corelib/kernel/qcore_unix_p.h.poll qt-everywhere-opensource-src-4.8.6/src/corelib/kernel/qcore_unix_p.h
501 --- qt-everywhere-opensource-src-4.8.6/src/corelib/kernel/qcore_unix_p.h.poll 2014-03-30 15:36:48.000000000 -0500
502 +++ qt-everywhere-opensource-src-4.8.6/src/corelib/kernel/qcore_unix_p.h 2014-03-31 18:01:59.370715392 -0500
503 @@ -345,9 +345,42 @@ static inline pid_t qt_safe_waitpid(pid_
505 timeval qt_gettime(); // in qelapsedtimer_mac.cpp or qtimestamp_unix.cpp
507 +// Deprecated due to FD_SETSIZE limitation, use qt_safe_poll instead.
508 Q_CORE_EXPORT int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept,
509 const struct timeval *tv);
511 +#ifndef Q_OS_VXWORKS
515 +// Poll emulation for VxWorks.
530 +inline bool qt_readable(const pollfd &fd)
532 + return fd.fd >= 0 && (fd.revents & (POLLIN | POLLHUP | POLLERR | POLLNVAL)) != 0;
535 +inline bool qt_writable(const pollfd &fd)
537 + return fd.fd >= 0 && (fd.revents & (POLLOUT | POLLHUP | POLLERR | POLLNVAL)) != 0;
540 +Q_CORE_EXPORT int qt_safe_poll(pollfd *fds, int nfds, int timeout,
541 + bool retry_eintr = true);
543 // according to X/OPEN we have to define semun ourselves
544 // we use prefix as on some systems sem.h will have it
546 diff -up qt-everywhere-opensource-src-4.8.6/src/network/socket/qlocalserver_unix.cpp.poll qt-everywhere-opensource-src-4.8.6/src/network/socket/qlocalserver_unix.cpp
547 --- qt-everywhere-opensource-src-4.8.6/src/network/socket/qlocalserver_unix.cpp.poll 2014-03-30 15:36:49.000000000 -0500
548 +++ qt-everywhere-opensource-src-4.8.6/src/network/socket/qlocalserver_unix.cpp 2014-03-31 18:01:59.370715392 -0500
549 @@ -208,16 +208,11 @@ void QLocalServerPrivate::_q_onNewConnec
551 void QLocalServerPrivate::waitForNewConnection(int msec, bool *timedOut)
555 - FD_SET(listenSocket, &readfds);
557 + fd.fd = listenSocket;
558 + fd.events = POLLIN;
561 - timeout.tv_sec = msec / 1000;
562 - timeout.tv_usec = (msec % 1000) * 1000;
565 - result = qt_safe_select(listenSocket + 1, &readfds, 0, 0, (msec == -1) ? 0 : &timeout);
566 + int result = qt_safe_poll(&fd, 1, msec);
568 setError(QLatin1String("QLocalServer::waitForNewConnection"));
570 diff -up qt-everywhere-opensource-src-4.8.6/src/network/socket/qlocalsocket_unix.cpp.poll qt-everywhere-opensource-src-4.8.6/src/network/socket/qlocalsocket_unix.cpp
571 --- qt-everywhere-opensource-src-4.8.6/src/network/socket/qlocalsocket_unix.cpp.poll 2014-03-30 15:36:49.000000000 -0500
572 +++ qt-everywhere-opensource-src-4.8.6/src/network/socket/qlocalsocket_unix.cpp 2014-03-31 18:01:59.370715392 -0500
575 #include <qelapsedtimer.h>
578 -# include <selectLib.h>
581 #define QT_CONNECT_TIMEOUT 30000
584 @@ -520,32 +516,17 @@ bool QLocalSocket::waitForConnected(int
585 if (state() != ConnectingState)
586 return (state() == ConnectedState);
590 - FD_SET(d->connectingSocket, &fds);
593 - timeout.tv_sec = msec / 1000;
594 - timeout.tv_usec = (msec % 1000) * 1000;
596 - // timeout can not be 0 or else select will return an error.
598 - timeout.tv_usec = 1000;
600 + fd.fd = d->connectingSocket;
601 + fd.events = POLLIN | POLLOUT;
604 // on Linux timeout will be updated by select, but _not_ on other systems.
606 + int remaining = msec;
608 - while (state() == ConnectingState
609 - && (-1 == msec || timer.elapsed() < msec)) {
611 - // On Symbian, ready-to-write is signaled when non-blocking socket
612 - // connect is finised. Is ready-to-read really used on other
613 - // UNIX paltforms when using non-blocking AF_UNIX socket?
614 - result = ::select(d->connectingSocket + 1, 0, &fds, 0, &timeout);
616 - result = ::select(d->connectingSocket + 1, &fds, 0, 0, &timeout);
618 + while (state() == ConnectingState) {
619 + result = qt_safe_poll(&fd, 1, remaining, /* retry_eintr */ false);
620 if (-1 == result && errno != EINTR) {
621 d->errorOccurred( QLocalSocket::UnknownSocketError,
622 QLatin1String("QLocalSocket::waitForConnected"));
623 @@ -553,6 +534,11 @@ bool QLocalSocket::waitForConnected(int
626 d->_q_connectToSocket();
628 + remaining = timer.elapsed() - msec;
634 return (state() == ConnectedState);
635 diff -up qt-everywhere-opensource-src-4.8.6/src/network/socket/qnativesocketengine_unix.cpp.poll qt-everywhere-opensource-src-4.8.6/src/network/socket/qnativesocketengine_unix.cpp
636 --- qt-everywhere-opensource-src-4.8.6/src/network/socket/qnativesocketengine_unix.cpp.poll 2014-03-30 15:36:49.000000000 -0500
637 +++ qt-everywhere-opensource-src-4.8.6/src/network/socket/qnativesocketengine_unix.cpp 2014-03-31 18:01:59.371715381 -0500
638 @@ -1068,48 +1068,40 @@ qint64 QNativeSocketEnginePrivate::nativ
640 int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool selectForRead) const
644 - FD_SET(socketDescriptor, &fds);
647 - tv.tv_sec = timeout / 1000;
648 - tv.tv_usec = (timeout % 1000) * 1000;
652 - retval = qt_safe_select(socketDescriptor + 1, &fds, 0, 0, timeout < 0 ? 0 : &tv);
654 - retval = qt_safe_select(socketDescriptor + 1, 0, &fds, 0, timeout < 0 ? 0 : &tv);
658 + fd.fd = socketDescriptor;
659 + if (selectForRead) {
660 + fd.events = POLLIN;
662 + fd.events = POLLOUT;
664 + return qt_safe_poll(&fd, 1, timeout);
667 int QNativeSocketEnginePrivate::nativeSelect(int timeout, bool checkRead, bool checkWrite,
668 bool *selectForRead, bool *selectForWrite) const
673 + fd.fd = socketDescriptor;
675 - FD_SET(socketDescriptor, &fdread);
679 + fd.events = POLLIN;
683 - FD_SET(socketDescriptor, &fdwrite);
686 - tv.tv_sec = timeout / 1000;
687 - tv.tv_usec = (timeout % 1000) * 1000;
690 - ret = qt_safe_select(socketDescriptor + 1, &fdread, &fdwrite, 0, timeout < 0 ? 0 : &tv);
692 + fd.events |= POLLOUT;
693 + int ret = qt_safe_poll(&fd, 1, timeout);
696 - *selectForRead = FD_ISSET(socketDescriptor, &fdread);
697 - *selectForWrite = FD_ISSET(socketDescriptor, &fdwrite);
700 + bool r = (fd.revents & (POLLIN | POLLHUP | POLLERR)) != 0;
701 + bool w = (fd.revents & (POLLOUT | POLLHUP | POLLERR)) != 0;
702 + // Emulate the return value from select(2).
708 + *selectForRead = r;
709 + *selectForWrite = w;
713 diff -up qt-everywhere-opensource-src-4.8.6/src/qt3support/network/q3socketdevice_unix.cpp.poll qt-everywhere-opensource-src-4.8.6/src/qt3support/network/q3socketdevice_unix.cpp
714 --- qt-everywhere-opensource-src-4.8.6/src/qt3support/network/q3socketdevice_unix.cpp.poll 2014-03-30 15:36:49.000000000 -0500
715 +++ qt-everywhere-opensource-src-4.8.6/src/qt3support/network/q3socketdevice_unix.cpp 2014-03-31 18:01:59.371715381 -0500
716 @@ -68,6 +68,7 @@ static inline int qt_socket_socket(int d
719 #include "q3socketdevice.h"
720 +#include "private/qcore_unix_p.h"
722 #ifndef QT_NO_NETWORK
724 @@ -588,19 +589,10 @@ Q_LONG Q3SocketDevice::waitForMore( int
728 - if ( fd >= FD_SETSIZE )
735 - FD_SET( fd, &fds );
737 - tv.tv_sec = msecs / 1000;
738 - tv.tv_usec = (msecs % 1000) * 1000;
740 - int rv = select( fd+1, &fds, 0, 0, msecs < 0 ? 0 : &tv );
743 + int rv = qt_safe_poll(&pfd, 1, msecs, /* retry_eintr */ false);
747 diff -up qt-everywhere-opensource-src-4.8.6/src/qt3support/other/q3process_unix.cpp.poll qt-everywhere-opensource-src-4.8.6/src/qt3support/other/q3process_unix.cpp
748 --- qt-everywhere-opensource-src-4.8.6/src/qt3support/other/q3process_unix.cpp.poll 2014-03-30 15:36:49.000000000 -0500
749 +++ qt-everywhere-opensource-src-4.8.6/src/qt3support/other/q3process_unix.cpp 2014-03-31 18:01:59.372715370 -0500
750 @@ -981,13 +981,10 @@ bool Q3Process::isRunning() const
751 // On heavy processing, the socket notifier for the sigchild might not
752 // have found time to fire yet.
753 if ( d->procManager && d->procManager->sigchldFd[1] < FD_SETSIZE ) {
757 - FD_SET( d->procManager->sigchldFd[1], &fds );
760 - if ( ::select( d->procManager->sigchldFd[1]+1, &fds, 0, 0, &tv ) > 0 )
762 + fd.fd = d->procManager->sigchldFd[1];
763 + fd.events = POLLIN;
764 + if ( qt_safe_poll(&fd, 1, 0, /* retry_eintr */ false) > 0 )
765 d->procManager->sigchldHnd( d->procManager->sigchldFd[1] );
768 @@ -1124,29 +1121,21 @@ void Q3Process::socketRead( int fd )
772 - if ( fd < FD_SETSIZE ) {
776 - FD_SET( fd, &fds );
779 - while ( ::select( fd+1, &fds, 0, 0, &tv ) > 0 ) {
780 - // prepare for the next round
782 - FD_SET( fd, &fds );
784 - ba = new QByteArray( basize );
785 - n = ::read( fd, ba->data(), basize );
788 - buffer->append( ba );
797 + pfd.events = POLLIN;
798 + while (qt_safe_poll(&pfd, 1, 0)) {
800 + ba = new QByteArray( basize );
801 + n = ::read( fd, ba->data(), basize );
804 + buffer->append( ba );