From 2dbe90c248cead9181188fae018773b1ab6eafca Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 7 Mar 2015 10:29:54 -0800 Subject: 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 Reviewed-by: Rafael Roquetto Reviewed-by: Thiago Macieira --- src/corelib/io/qprocess_unix.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/corelib/io/qprocess_unix.cpp') 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 -- cgit v1.2.3