47 #if defined QPROCESS_DEBUG 56 static QByteArray qt_prettyDebug(
const char *
data,
int len,
int maxSize)
58 if (!data)
return "(null)";
60 for (
int i = 0; i < len; ++i) {
65 case '\n': out +=
"\\n";
break;
66 case '\r': out +=
"\\r";
break;
67 case '\t': out +=
"\\t";
break;
83 #include "qplatformdefs.h" 87 #include "private/qcore_unix_p.h" 90 #include <private/qcore_mac_p.h> 93 #include <private/qcoreapplication_p.h> 94 #include <private/qthread_p.h> 112 #include <sys/neutrino.h> 122 #ifdef Q_OS_INTEGRITY 123 static inline char *strdup(
const char *data)
141 #if defined (QPROCESS_DEBUG) 142 fprintf(stderr,
"*** SIGCHLD\n");
149 void (*oldAction)(int, siginfo_t *,
void *) = vsa->sa_sigaction;
152 oldAction(signum, info, context);
154 void (*oldAction)(int) = vsa->sa_handler;
156 if (oldAction && oldAction != SIG_IGN)
161 static inline void add_fd(
int &nfds,
int fd, fd_set *fdset)
184 void catchDeadChildren();
201 QMutex *mutex = processManagerGlobalMutex();
209 #if defined (QPROCESS_DEBUG) 210 qDebug() <<
"QProcessManager::QProcessManager()";
228 action.sa_flags = SA_NOCLDSTOP | SA_SIGINFO;
243 qt_qprocess_deadChild_pipe[0] = -1;
244 qt_qprocess_deadChild_pipe[1] = -1;
261 FD_SET(qt_qprocess_deadChild_pipe[0], &readset);
263 #if defined (QPROCESS_DEBUG) 264 qDebug() <<
"QProcessManager::run() waiting for children to die";
270 int nselect =
select(qt_qprocess_deadChild_pipe[0] + 1, &readset, 0, 0, 0);
281 if (
qt_safe_read(qt_qprocess_deadChild_pipe[0], &c, 1) < 0 || c ==
'@')
296 while (it != children.end()) {
302 #if defined (QPROCESS_DEBUG) 303 qDebug() <<
"QProcessManager::run() sending death notice to" << info->
process;
313 #if defined (QPROCESS_DEBUG) 314 qDebug() <<
"QProcessManager::add() adding pid" << pid <<
"process" <<
process;
320 info->
deathPipe = process->d_func()->deathPipe[1];
325 process->d_func()->serial = serial;
326 children.insert(serial, info);
333 int serial = process->d_func()->serial;
335 #if defined (QPROCESS_DEBUG) 337 qDebug() <<
"QProcessManager::remove() removing pid" << info->
pid <<
"process" << info->
process;
360 qWarning(
"QProcessPrivate::createPipe: Cannot create pipe %p: %s",
388 channel.
pipe[0] = -1;
389 channel.
pipe[1] = -1;
393 if (channel.
type == Channel::Normal) {
399 if (threadData->eventDispatcher) {
400 if (&channel == &stdinChannel) {
405 q,
SLOT(_q_canWrite()));
409 const char *receiver;
410 if (&channel == &stdoutChannel)
411 receiver =
SLOT(_q_canReadStandardOutput());
413 receiver =
SLOT(_q_canReadStandardError());
420 }
else if (channel.
type == Channel::Redirect) {
424 if (&channel == &stdinChannel) {
426 channel.
pipe[1] = -1;
430 q->setErrorString(
QProcess::tr(
"Could not open input redirection for reading"));
438 channel.
pipe[0] = -1;
442 q->setErrorString(
QProcess::tr(
"Could not open output redirection for writing"));
447 emit q->error(processError);
456 if (channel.
type == Channel::PipeSource) {
479 Q_PIPE pipe[2] = { -1, -1 };
482 sink->
pipe[0] = pipe[0];
483 source->
pipe[1] = pipe[1];
491 #if defined(Q_OS_MAC) && !defined(Q_OS_IOS) 492 # include <crt_externs.h> 493 # define environ (*_NSGetEnviron()) 502 #if !defined(Q_OS_IOS) 504 for (
int count = 0; (entry = environ[count]); ++count) {
505 const char *
equal = strchr(entry,
'=');
527 #if defined(Q_OS_MAC) 528 static const char libraryPath[] =
"DYLD_LIBRARY_PATH";
530 static const char libraryPath[] =
"LD_LIBRARY_PATH";
533 bool needToAddLibraryPath = !envLibraryPath.
isEmpty() &&
536 char **envp =
new char *[environment.
count() + 2];
537 envp[environment.
count()] = 0;
538 envp[environment.
count() + 1] = 0;
542 for ( ; it !=
end; ++
it) {
549 envp[(*envc)++] = ::strdup(key.
constData());
552 if (needToAddLibraryPath)
554 envLibraryPath).constData());
566 #if defined (QPROCESS_DEBUG) 567 qDebug(
"QProcessPrivate::startProcess()");
573 if (!createChannel(stdinChannel) ||
574 !createChannel(stdoutChannel) ||
575 !createChannel(stderrChannel) ||
580 emit q->error(processError);
585 if (threadData->eventDispatcher) {
589 q,
SLOT(_q_startupNotification()));
593 q,
SLOT(_q_processDied()));
601 char **argv =
new char *[arguments.count() + 2];
602 argv[arguments.count() + 1] = 0;
609 if (encodedProgramName.
endsWith(
".app") && fileInfo.
isDir()) {
612 kCFURLPOSIXPathStyle,
true);
618 url = CFBundleCopyExecutableURL(bundle);
621 QCFString str = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);
622 encodedProgramName +=
"/Contents/MacOS/" +
static_cast<QString>(str).toUtf8();
628 char *dupProgramName = ::strdup(encodedProgramName.
constData());
629 argv[0] = dupProgramName;
632 for (
int i = 0; i < arguments.count(); ++i) {
645 if (environment.d.constData()) {
651 const char *workingDirPtr = 0;
653 if (!workingDirectory.isEmpty()) {
655 workingDirPtr = encodedWorkingDirectory.
constData();
667 pathc = pathEntries.
size();
668 path =
new char *[pathc + 1];
671 for (
int k = 0; k < pathEntries.
size(); ++k) {
674 tmp += encodedProgramName;
683 #if defined(Q_OS_QNX) 684 pid_t childPid = spawnChild(workingDirPtr, argv, envp);
686 pid_t childPid = fork();
687 int lastForkErrno =
errno;
691 free(dupProgramName);
692 for (
int i = 1; i <= arguments.count(); ++i)
694 for (
int i = 0; i < envc; ++i)
696 for (
int i = 0; i < pathc; ++i)
713 #if !defined(Q_OS_QNX) 716 #if defined (QPROCESS_DEBUG) 723 emit q->error(processError);
730 execChild(workingDirPtr, path, argv, envp);
745 childStartedPipe[1] = -1;
747 if (stdinChannel.pipe[0] != -1) {
749 stdinChannel.pipe[0] = -1;
751 if (stdinChannel.pipe[1] != -1)
752 ::fcntl(stdinChannel.pipe[1], F_SETFL, ::
fcntl(stdinChannel.pipe[1], F_GETFL) | O_NONBLOCK);
754 if (stdoutChannel.pipe[1] != -1) {
756 stdoutChannel.pipe[1] = -1;
758 if (stdoutChannel.pipe[0] != -1)
759 ::fcntl(stdoutChannel.pipe[0], F_SETFL, ::
fcntl(stdoutChannel.pipe[0], F_GETFL) | O_NONBLOCK);
761 if (stderrChannel.pipe[1] != -1) {
763 stderrChannel.pipe[1] = -1;
765 if (stderrChannel.pipe[0] != -1)
766 ::fcntl(stderrChannel.pipe[0], F_SETFL, ::
fcntl(stderrChannel.pipe[0], F_GETFL) | O_NONBLOCK);
769 #if !defined(Q_OS_QNX) 772 ::signal(SIGPIPE, SIG_DFL);
796 QT_CHDIR(workingDir);
799 q->setupChildProcess();
809 #if defined (QPROCESS_DEBUG) 810 fprintf(stderr,
"QProcessPrivate::execChild() searching / starting %s\n", argv[0]);
816 #if defined (QPROCESS_DEBUG) 817 fprintf(stderr,
"QProcessPrivate::execChild() starting %s\n", argv[0]);
825 #if defined (QPROCESS_DEBUG) 826 fprintf(stderr,
"QProcessPrivate::execChild() failed (%s), notifying parent process\n",
qPrintable(error));
830 childStartedPipe[1] = -1;
838 int i =
qt_safe_read(childStartedPipe[0], &buf,
sizeof buf);
839 if (startupSocketNotifier) {
840 startupSocketNotifier->setEnabled(
false);
841 startupSocketNotifier->deleteLater();
842 startupSocketNotifier = 0;
845 childStartedPipe[0] = -1;
847 #if defined (QPROCESS_DEBUG) 848 qDebug(
"QProcessPrivate::processStarted() == %s", i <= 0 ?
"true" :
"false");
858 #if defined(Q_OS_QNX) 859 static pid_t doSpawn(
int fd_count,
int fd_map[],
char **argv,
char **envp,
860 const char *workingDir,
bool spawn_detached)
864 struct inheritance inherit;
865 memset(&inherit, 0,
sizeof(inherit));
866 inherit.flags |= SPAWN_SETSID;
867 inherit.flags |= SPAWN_CHECK_SCRIPT;
869 inherit.flags |= SPAWN_NOZOMBIE;
870 inherit.flags |= SPAWN_SETSIGDEF;
871 sigaddset(&inherit.sigdefault, SIGPIPE);
874 const char *oldWorkingDir = 0;
879 if (ThreadCtl(_NTO_TCTL_THREADS_HOLD, 0) == -1)
882 oldWorkingDir = QT_GETCWD(buff,
PATH_MAX + 1);
883 QT_CHDIR(workingDir);
887 EINTR_LOOP(childPid, ::spawn(argv[0], fd_count, fd_map, &inherit, argv, envp));
888 if (childPid == -1) {
889 inherit.flags |= SPAWN_SEARCH_PATH;
890 EINTR_LOOP(childPid, ::spawn(argv[0], fd_count, fd_map, &inherit, argv, envp));
894 QT_CHDIR(oldWorkingDir);
896 if (ThreadCtl(_NTO_TCTL_THREADS_CONT, 0) == -1)
903 pid_t QProcessPrivate::spawnChild(
const char *workingDir,
char **argv,
char **envp)
908 const int fd_count = sysconf(_SC_OPEN_MAX);
911 for (
int i = 3; i < fd_count; ++i) {
914 const int flags =
::fcntl(i, F_GETFD);
916 fd_map[i] = ((flags >= 0) && !(flags & FD_CLOEXEC))
917 ? i : SPAWN_FDCLOSED;
920 switch (processChannelMode) {
922 fd_map[0] = stdinChannel.pipe[0];
923 fd_map[1] = QT_FILENO(stdout);
924 fd_map[2] = QT_FILENO(stderr);
927 fd_map[0] = stdinChannel.pipe[0];
928 fd_map[1] = stdoutChannel.pipe[1];
929 fd_map[2] = stdoutChannel.pipe[1];
932 fd_map[0] = stdinChannel.pipe[0];
933 fd_map[1] = stdoutChannel.pipe[1];
934 fd_map[2] = stderrChannel.pipe[1];
938 pid_t childPid = doSpawn(fd_count, fd_map.
data(), argv, envp, workingDir,
false);
940 if (childPid == -1) {
944 childStartedPipe[1] = -1;
955 if (::ioctl(stdoutChannel.pipe[0], FIONREAD, (
char *) &nbytes) >= 0)
956 available = (
qint64) nbytes;
957 #if defined (QPROCESS_DEBUG) 958 qDebug(
"QProcessPrivate::bytesAvailableFromStdout() == %lld", available);
967 if (::ioctl(stderrChannel.pipe[0], FIONREAD, (
char *) &nbytes) >= 0)
968 available = (
qint64) nbytes;
969 #if defined (QPROCESS_DEBUG) 970 qDebug(
"QProcessPrivate::bytesAvailableFromStderr() == %lld", available);
978 #if defined QPROCESS_DEBUG 979 qDebug(
"QProcessPrivate::readFromStdout(%p \"%s\", %lld) == %lld",
980 data, qt_prettyDebug(data, bytesRead, 16).constData(), maxlen, bytesRead);
988 #if defined QPROCESS_DEBUG 989 qDebug(
"QProcessPrivate::readFromStderr(%p \"%s\", %lld) == %lld",
990 data, qt_prettyDebug(data, bytesRead, 16).constData(), maxlen, bytesRead);
998 #if defined QPROCESS_DEBUG 999 qDebug(
"QProcessPrivate::writeToStdin(%p \"%s\", %lld) == %lld",
1000 data, qt_prettyDebug(data, maxlen, 16).constData(), maxlen, written);
1007 if (written == -1 &&
errno == EAGAIN)
1014 #if defined (QPROCESS_DEBUG) 1015 qDebug(
"QProcessPrivate::killProcess()");
1018 ::kill(pid_t(
pid), SIGTERM);
1023 #if defined (QPROCESS_DEBUG) 1024 qDebug(
"QProcessPrivate::killProcess()");
1027 ::kill(pid_t(
pid), SIGKILL);
1030 static int select_msecs(
int nfds, fd_set *fdread, fd_set *fdwrite,
int timeout)
1036 tv.tv_sec = timeout / 1000;
1037 tv.tv_usec = (timeout % 1000) * 1000;
1050 int timeout = msecs -
elapsed;
1051 return timeout < 0 ? 0 : timeout;
1058 #if defined (QPROCESS_DEBUG) 1059 qDebug(
"QProcessPrivate::waitForStarted(%d) waiting for child to start (fd = %d)", msecs,
1060 childStartedPipe[0]);
1065 FD_SET(childStartedPipe[0], &fds);
1066 if (
select_msecs(childStartedPipe[0] + 1, &fds, 0, msecs) == 0) {
1068 q->setErrorString(
QProcess::tr(
"Process operation timed out"));
1069 #if defined (QPROCESS_DEBUG) 1070 qDebug(
"QProcessPrivate::waitForStarted(%d) == false (timed out)", msecs);
1075 bool startedEmitted = _q_startupNotification();
1076 #if defined (QPROCESS_DEBUG) 1077 qDebug(
"QProcessPrivate::waitForStarted() == %s", startedEmitted ?
"true" :
"false");
1079 return startedEmitted;
1085 #if defined (QPROCESS_DEBUG) 1086 qDebug(
"QProcessPrivate::waitForReadyRead(%d)", msecs);
1103 add_fd(nfds, childStartedPipe[0], &fdread);
1105 if (stdoutChannel.pipe[0] != -1)
1106 add_fd(nfds, stdoutChannel.pipe[0], &fdread);
1107 if (stderrChannel.pipe[0] != -1)
1108 add_fd(nfds, stderrChannel.pipe[0], &fdread);
1110 if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
1111 add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
1114 int ret =
select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
1120 q->setErrorString(
QProcess::tr(
"Process operation timed out"));
1124 if (childStartedPipe[0] != -1 && FD_ISSET(childStartedPipe[0], &fdread)) {
1125 if (!_q_startupNotification())
1129 bool readyReadEmitted =
false;
1130 if (stdoutChannel.pipe[0] != -1 && FD_ISSET(stdoutChannel.pipe[0], &fdread)) {
1131 bool canRead = _q_canReadStandardOutput();
1133 readyReadEmitted =
true;
1135 if (stderrChannel.pipe[0] != -1 && FD_ISSET(stderrChannel.pipe[0], &fdread)) {
1136 bool canRead = _q_canReadStandardError();
1138 readyReadEmitted =
true;
1140 if (readyReadEmitted)
1143 if (stdinChannel.pipe[1] != -1 && FD_ISSET(stdinChannel.pipe[1], &fdwrite))
1147 if (_q_processDied())
1157 #if defined (QPROCESS_DEBUG) 1158 qDebug(
"QProcessPrivate::waitForBytesWritten(%d)", msecs);
1164 while (!writeBuffer.isEmpty()) {
1175 add_fd(nfds, childStartedPipe[0], &fdread);
1177 if (stdoutChannel.pipe[0] != -1)
1178 add_fd(nfds, stdoutChannel.pipe[0], &fdread);
1179 if (stderrChannel.pipe[0] != -1)
1180 add_fd(nfds, stderrChannel.pipe[0], &fdread);
1183 if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
1184 add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
1187 int ret =
select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
1194 q->setErrorString(
QProcess::tr(
"Process operation timed out"));
1198 if (childStartedPipe[0] != -1 && FD_ISSET(childStartedPipe[0], &fdread)) {
1199 if (!_q_startupNotification())
1203 if (stdinChannel.pipe[1] != -1 && FD_ISSET(stdinChannel.pipe[1], &fdwrite))
1204 return _q_canWrite();
1206 if (stdoutChannel.pipe[0] != -1 && FD_ISSET(stdoutChannel.pipe[0], &fdread))
1207 _q_canReadStandardOutput();
1209 if (stderrChannel.pipe[0] != -1 && FD_ISSET(stderrChannel.pipe[0], &fdread))
1210 _q_canReadStandardError();
1213 if (_q_processDied())
1224 #if defined (QPROCESS_DEBUG) 1225 qDebug(
"QProcessPrivate::waitForFinished(%d)", msecs);
1240 add_fd(nfds, childStartedPipe[0], &fdread);
1242 if (stdoutChannel.pipe[0] != -1)
1243 add_fd(nfds, stdoutChannel.pipe[0], &fdread);
1244 if (stderrChannel.pipe[0] != -1)
1245 add_fd(nfds, stderrChannel.pipe[0], &fdread);
1250 if (!writeBuffer.isEmpty() && stdinChannel.pipe[1] != -1)
1251 add_fd(nfds, stdinChannel.pipe[1], &fdwrite);
1254 int ret =
select_msecs(nfds + 1, &fdread, &fdwrite, timeout);
1260 q->setErrorString(
QProcess::tr(
"Process operation timed out"));
1264 if (childStartedPipe[0] != -1 && FD_ISSET(childStartedPipe[0], &fdread)) {
1265 if (!_q_startupNotification())
1268 if (stdinChannel.pipe[1] != -1 && FD_ISSET(stdinChannel.pipe[1], &fdwrite))
1271 if (stdoutChannel.pipe[0] != -1 && FD_ISSET(stdoutChannel.pipe[0], &fdread))
1272 _q_canReadStandardOutput();
1274 if (stderrChannel.pipe[0] != -1 && FD_ISSET(stderrChannel.pipe[0], &fdread))
1275 _q_canReadStandardError();
1278 if (_q_processDied())
1289 FD_SET(stdinChannel.pipe[1], &fdwrite);
1290 return select_msecs(stdinChannel.pipe[1] + 1, 0, &fdwrite, msecs < 0 ? 0 : msecs) == 1;
1311 crashed = !WIFEXITED(exitStatus);
1312 exitCode = WEXITSTATUS(exitStatus);
1313 #if defined QPROCESS_DEBUG 1314 qDebug() <<
"QProcessPrivate::waitForDeadChild() dead with exitCode" 1315 << exitCode <<
", crashed?" << crashed;
1319 #if defined QPROCESS_DEBUG 1320 qDebug() <<
"QProcessPrivate::waitForDeadChild() not dead!";
1329 #if defined(Q_OS_QNX) 1332 const int fd_count = 3;
1333 int fd_map[fd_count] = { QT_FILENO(stdin), QT_FILENO(stdout), QT_FILENO(stderr) };
1337 for (
int i = 0; i < arguments.
size(); ++i)
1340 const int argc = enc_args.
size();
1342 for (
int i = 0; i < argc; ++i)
1343 raw_argv[i] = const_cast<char *>(enc_args.
at(i).
data());
1349 const char *workingDirPtr = 0;
1351 if (!workingDirectory.
isEmpty()) {
1353 workingDirPtr = encodedWorkingDirectory.
constData();
1356 pid_t childPid = doSpawn(fd_count, fd_map, raw_argv.
data(), envp, workingDirPtr,
true);
1357 if (pid && childPid != -1)
1360 return childPid != -1;
1383 pid_t childPid = fork();
1384 if (childPid == 0) {
1386 memset(&noaction, 0,
sizeof(noaction));
1387 noaction.sa_handler = SIG_IGN;
1395 pid_t doubleForkPid = fork();
1396 if (doubleForkPid == 0) {
1399 if (!encodedWorkingDirectory.
isEmpty())
1400 QT_CHDIR(encodedWorkingDirectory.
constData());
1402 char **argv =
new char *[arguments.
size() + 2];
1403 for (
int i = 0; i < arguments.
size(); ++i) {
1410 argv[arguments.
size() + 1] = 0;
1416 for (
int k = 0; k < pathEntries.
size(); ++k) {
1418 if (!tmp.
endsWith(
'/')) tmp +=
'/';
1420 argv[0] = tmp.
data();
1426 argv[0] = tmp.
data();
1431 memset(&noaction, 0,
sizeof(noaction));
1432 noaction.sa_handler = SIG_IGN;
1440 }
else if (doubleForkPid == -1) {
1442 memset(&noaction, 0,
sizeof(noaction));
1443 noaction.sa_handler = SIG_IGN;
1452 qt_safe_write(pidPipe[1], (
const char *)&doubleForkPid,
sizeof(pid_t));
1460 if (childPid == -1) {
1467 int startResult =
qt_safe_read(startedPipe[0], &reply, 1);
1471 bool success = (startResult != -1 && reply ==
'\0');
1472 if (success && pid) {
1473 pid_t actualPid = 0;
1474 if (
qt_safe_read(pidPipe[0], (
char *)&actualPid,
sizeof(pid_t)) ==
sizeof(pid_t)) {
1492 #include "qprocess_unix.moc" 1494 #endif // QT_NO_PROCESS The QProcessEnvironment class holds the environment variables that can be passed to a program...
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString qt_error_string(int errorCode)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
QString & sprintf(const char *format,...)
Safely builds a formatted string from the format string cformat and an arbitrary list of arguments...
static int qt_qprocess_deadChild_pipe[2]
static QString fromLocal8Bit(const char *, int size=-1)
Returns a QString initialized with the first size characters of the 8-bit string str.
static mach_timebase_info_data_t info
static double elapsed(qint64 after, qint64 before)
#define QT_END_NAMESPACE
This macro expands to.
The QMutex class provides access serialization between threads.
char * data()
Returns a pointer to the data stored in the byte array.
const QChar at(int i) const
Returns the character at the given index position in the string.
#define EINTR_LOOP(var, cmd)
T * data() const
Returns the value of the pointer referenced by this object.
#define it(className, varName)
QByteArray & append(char c)
Appends the character ch to this byte array.
QByteArray toUtf8() const Q_REQUIRED_RESULT
Returns a UTF-8 representation of the string as a QByteArray.
static struct sigaction qt_sa_old_sigchld_handler
The QByteArray class provides an array of bytes.
static int qt_safe_execvp(const char *file, char *const argv[])
qint64 bytesAvailableFromStdout() const
int length() const
Returns the number of characters in this string.
const_iterator ConstIterator
Qt-style synonym for QHash::const_iterator.
static const int errorBufferMax
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *)
static bool startDetached(const QString &program, const QStringList &arguments, const QString &workingDirectory=QString(), qint64 *pid=0)
QString absoluteFilePath() const
Returns an absolute path including the file name.
#define QT_END_INCLUDE_NAMESPACE
This macro is equivalent to QT_BEGIN_NAMESPACE.
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
T & value() const
Returns a modifiable reference to the current item's value.
QSharedDataPointer< QProcessEnvironmentPrivate > d
static int qt_safe_close(int fd)
void run()
The starting point for the thread.
The QString class provides a Unicode character string.
The QHash class is a template class that provides a hash-table-based dictionary.
Q_GLOBAL_STATIC(QMutex, cfbundleMutex)
#define Q_BASIC_ATOMIC_INITIALIZER(a)
qint64 bytesAvailableFromStderr() const
qint64 writeToStdin(const char *data, qint64 maxlen)
The QElapsedTimer class provides a fast way to calculate elapsed times.
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
The QChar class provides a 16-bit Unicode character.
QChar * data()
Returns a pointer to the data stored in the QString.
qint64 elapsed() const
Returns the number of milliseconds since this QElapsedTimer was last started.
static int qt_timeout_value(int msecs, int elapsed)
bool waitForReadyRead(int msecs=30000)
bool waitForWrite(int msecs=30000)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
QSocketNotifier * notifier
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
The QSocketNotifier class provides support for monitoring activity on a file descriptor.
Q_CORE_EXPORT void qDebug(const char *,...)
static int qt_safe_execve(const char *filename, char *const argv[], char *const envp[])
static char ** _q_dupEnvironment(const QProcessEnvironmentPrivate::Hash &environment, int *envc)
void append(const T &t)
Inserts value at the end of the list.
qint64 readFromStdout(char *data, qint64 maxlen)
#define QT_BEGIN_NAMESPACE
This macro expands to.
static void initializeProcessManager()
static int qt_safe_open(const char *pathname, int flags, mode_t mode=0777)
bool waitForStarted(int msecs=30000)
bool isDir() const
Returns true if this object points to a directory or to a symbolic link to a directory; otherwise ret...
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
const T & at(int i) const
Returns the item at index position i in the list.
The QStringList class provides a list of strings.
static QString fromUtf8(const char *, int size=-1)
Returns a QString initialized with the first size bytes of the UTF-8 string str.
bool isEmpty() const
Returns true if the hash contains no items; otherwise returns false.
Q_CORE_EXPORT void qWarning(const char *,...)
QHash< int, QProcessInfo * > children
static int qt_safe_dup2(int oldfd, int newfd, int flags=FD_CLOEXEC)
static const char * data(const QByteArray &arr)
static int qt_safe_pipe(int pipefd[2], int flags=0)
static QProcessEnvironment systemEnvironment()
The systemEnvironment function returns the environment of the calling process.
void add(pid_t pid, QProcess *process)
static int qt_safe_execv(const char *path, char *const argv[])
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
qint64 readFromStderr(char *data, qint64 maxlen)
static int qt_create_pipe(int *pipe)
The QScopedArrayPointer class stores a pointer to a dynamically allocated array of objects...
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
static QBasicAtomicInt idCounter
QProcessPrivate * process
int length() const
Same as size().
const char * constData() const
Returns a pointer to the data stored in the byte array.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the hash.
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the hash...
Q_CORE_EXPORT void qFatal(const char *,...)
#define Q_ASSERT_X(cond, where, what)
The QMutexLocker class is a convenience class that simplifies locking and unlocking mutexes...
static int select_msecs(int nfds, fd_set *fdread, fd_set *fdwrite, int timeout)
int qt_safe_select(int nfds, fd_set *fdread, fd_set *fdwrite, fd_set *fdexcept, const struct timeval *orig_timeout)
bool waitForBytesWritten(int msecs=30000)
static void qt_sa_sigchld_sigaction(int signum, siginfo_t *info, void *context)
void start(Priority=InheritPriority)
Begins execution of the thread by calling run().
int sigaction(int, const struct sigaction *, struct sigaction *)
bool waitForFinished(int msecs=30000)
The QHash::iterator class provides an STL-style non-const iterator for QHash and QMultiHash.
int size() const
Returns the number of items in the list.
void setEnabled(bool)
If enable is true, the notifier is enabled; otherwise the notifier is disabled.
static QReadWriteLock lock
if(void) toggleToolbarShown
int fetchAndAddRelaxed(int valueToAdd)
QFuture< T > run(Function function,...)
#define QT_BEGIN_INCLUDE_NAMESPACE
This macro is equivalent to QT_END_NAMESPACE.
char * qstrdup(const char *src)
Returns a duplicate string.
bool createChannel(Channel &channel)
int count(const Key &key) const
Returns the number of items associated with the key.
static QByteArray encodeName(const QString &fileName)
By default, this function converts fileName to the local 8-bit encoding determined by the user's loca...
bool isEmpty() const
Returns true if the byte array has size 0; otherwise returns false.
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
static QProcessManager * processManager()
The QFileInfo class provides system-independent file information.
void reserve(int size)
Attempts to allocate memory for at least size bytes.
void destroyPipe(Q_PIPE pipe[2])
static const KeyPair *const end
static qint64 qt_safe_write_nosignal(int fd, const void *data, qint64 len)
void remove(QProcess *process)
#define qPrintable(string)
The QThread class provides a platform-independent way to manage threads.
Q_OUTOFLINE_TEMPLATE void qDeleteAll(ForwardIterator begin, ForwardIterator end)
void start()
Starts this timer.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
static pid_t qt_safe_waitpid(pid_t pid, int *status, int options)
void execChild(const char *workingDirectory, char **path, char **argv, char **envp)
The QProcess class is used to start external programs and to communicate with them.
static qint64 qt_safe_write(int fd, const void *data, qint64 len)
static qint64 qt_safe_read(int fd, void *data, qint64 maxlen)
static bool equal(const QChar *a, int l, const char *b)
bool endsWith(const QByteArray &a) const
Returns true if this byte array ends with byte array ba; otherwise returns false. ...
static void add_fd(int &nfds, int fd, fd_set *fdset)
#define forever
This macro is provided for convenience for writing infinite loops.