Make usage of forkfd_pidfd in QProcess a configurable feature
Our CI cross-compiling arm qemu builds have issues in tests that use QProcess, due to user-space qemu seemingly not supporting pidfds properly. Add a 'forkfd_pidfd' configure.json feature, which can be manually disabled when configuring Qt, causing QProcess to do a regular fork instead of using the new pidfd kernel feature. This will help us avoid the regression of multiple tests failing on the new Ubuntu 20.04 CI host images when they are run via qemu. Task-number: QTBUG-86285 Task-number: QTBUG-86187 Task-number: QTBUG-86198 Change-Id: Ib2209d7e95126e0fb738bf59e39070d5a62c482f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
0aa4b33b92
commit
2ed99ff5ca
@ -929,6 +929,10 @@ qt_feature("etw" PRIVATE
|
||||
ENABLE INPUT_trace STREQUAL 'etw' OR ( INPUT_trace STREQUAL 'yes' AND WIN32 )
|
||||
DISABLE INPUT_trace STREQUAL 'lttng' OR INPUT_trace STREQUAL 'no'
|
||||
)
|
||||
qt_feature("forkfd_pidfd" PRIVATE
|
||||
LABEL "pidfd support in forkfd"
|
||||
CONDITION LINUX
|
||||
)
|
||||
qt_feature("win32_system_libs"
|
||||
LABEL "Windows System Libraries"
|
||||
CONDITION WIN32 AND libs.advapi32 AND libs.gdi32 AND libs.kernel32 AND libs.netapi32 AND libs.ole32 AND libs.shell32 AND libs.uuid AND libs.user32 AND libs.winmm AND libs.ws2_32 OR FIXME
|
||||
@ -966,6 +970,10 @@ qt_configure_add_summary_entry(
|
||||
)
|
||||
qt_configure_add_summary_entry(ARGS "pcre2")
|
||||
qt_configure_add_summary_entry(ARGS "system-pcre2")
|
||||
qt_configure_add_summary_entry(
|
||||
ARGS "forkfd_pidfd"
|
||||
CONDITION LINUX
|
||||
)
|
||||
qt_configure_end_summary_section() # end of "Qt Core" section
|
||||
qt_configure_add_report_entry(
|
||||
TYPE NOTE
|
||||
|
@ -935,6 +935,10 @@ qt_feature("etw" PRIVATE
|
||||
ENABLE INPUT_trace STREQUAL 'etw' OR ( INPUT_trace STREQUAL 'yes' AND WIN32 )
|
||||
DISABLE INPUT_trace STREQUAL 'lttng' OR INPUT_trace STREQUAL 'no'
|
||||
)
|
||||
qt_feature("forkfd_pidfd" PRIVATE
|
||||
LABEL "CLONE_PIDFD support in forkfd"
|
||||
CONDITION LINUX
|
||||
)
|
||||
qt_feature("win32_system_libs"
|
||||
LABEL "Windows System Libraries"
|
||||
CONDITION WIN32 AND libs.advapi32 AND libs.gdi32 AND libs.kernel32 AND libs.netapi32 AND libs.ole32 AND libs.shell32 AND libs.uuid AND libs.user32 AND libs.winmm AND libs.ws2_32 OR FIXME
|
||||
@ -972,6 +976,10 @@ qt_configure_add_summary_entry(
|
||||
)
|
||||
qt_configure_add_summary_entry(ARGS "pcre2")
|
||||
qt_configure_add_summary_entry(ARGS "system-pcre2")
|
||||
qt_configure_add_summary_entry(
|
||||
ARGS "forkfd_pidfd"
|
||||
CONDITION LINUX
|
||||
)
|
||||
qt_configure_end_summary_section() # end of "Qt Core" section
|
||||
qt_configure_add_report_entry(
|
||||
TYPE NOTE
|
||||
|
@ -1013,6 +1013,11 @@
|
||||
"condition": "config.win32",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"forkfd_pidfd": {
|
||||
"label": "CLONE_PIDFD support in forkfd",
|
||||
"condition": "config.linux",
|
||||
"output": [ "privateFeature" ]
|
||||
},
|
||||
"win32_system_libs": {
|
||||
"label": "Windows System Libraries",
|
||||
"condition": "config.win32 && libs.advapi32 && libs.gdi32 && libs.kernel32 && libs.netapi32 && libs.ole32 && libs.shell32 && libs.uuid && libs.user32 && libs.winmm && libs.ws2_32"
|
||||
@ -1094,7 +1099,12 @@ Note that this is required for plugin loading. Qt GUI needs QPA plugins for basi
|
||||
"condition": "config.qnx"
|
||||
},
|
||||
"pcre2",
|
||||
"system-pcre2"
|
||||
"system-pcre2",
|
||||
{
|
||||
"type": "feature",
|
||||
"args": "forkfd_pidfd",
|
||||
"condition": "config.linux"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -461,6 +461,12 @@ void QProcessPrivate::startProcess()
|
||||
int ffdflags = FFD_CLOEXEC;
|
||||
if (childProcessModifier)
|
||||
ffdflags |= FFD_USE_FORK;
|
||||
|
||||
// QTBUG-86285
|
||||
#if !QT_CONFIG(forkfd_pidfd)
|
||||
ffdflags |= FFD_USE_FORK;
|
||||
#endif
|
||||
|
||||
pid_t childPid;
|
||||
forkfd = ::forkfd(ffdflags , &childPid);
|
||||
int lastForkErrno = errno;
|
||||
|
Loading…
Reference in New Issue
Block a user