summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qprocess_unix.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-03-07 10:29:54 -0800
committerThiago Macieira <thiago.macieira@intel.com>2015-07-17 00:55:45 +0000
commit2dbe90c248cead9181188fae018773b1ab6eafca (patch)
tree0f96e54c8a3757be3a016379fd4e8132c434e1c1 /src/corelib/io/qprocess_unix.cpp
parent8485fe9af8582e1f1a8b83f5865ccaaf409eb103 (diff)
forkfd: update the API to add a reading and closing function
Right now the two functions being added are just wrappers, but this will allow us in the future to support FreeBSD and Linux's system calls that do the equivalent of forkfd, but have slightly different semantics in the actual getting of the information from the file descriptor. See-Also: https://lkml.org/lkml/2015/3/12/1044 See-Also: http://www.freebsd.org/cgi/man.cgi?query=pdfork Change-Id: Ia0aac2f09e9245339951ffff13c94acb5f4ff204 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qprocess_unix.cpp')
-rw-r--r--src/corelib/io/qprocess_unix.cpp15
1 files changed, 6 insertions, 9 deletions
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index 0fc9464f52..7b6da90b04 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -1091,20 +1091,17 @@ bool QProcessPrivate::waitForDeadChild()
return true; // child has already exited
// read the process information from our fd
- siginfo_t info;
- qint64 ret = qt_safe_read(forkfd, &info, sizeof info);
- Q_ASSERT(ret == sizeof info);
- Q_UNUSED(ret);
+ forkfd_info info;
+ int ret;
+ EINTR_LOOP(ret, forkfd_wait(forkfd, &info, Q_NULLPTR));
- Q_ASSERT(info.si_pid == pid_t(pid));
-
- exitCode = info.si_status;
- crashed = info.si_code != CLD_EXITED;
+ exitCode = info.status;
+ crashed = info.code != CLD_EXITED;
delete deathNotifier;
deathNotifier = 0;
- qt_safe_close(forkfd);
+ EINTR_LOOP(ret, forkfd_close(forkfd));
forkfd = -1; // Child is dead, don't try to kill it anymore
#if defined QPROCESS_DEBUG