diff options
author | Imre Deak <imre.deak@intel.com> | 2017-10-13 14:30:08 +0300 |
---|---|---|
committer | Imre Deak <imre.deak@intel.com> | 2017-10-16 13:35:36 +0300 |
commit | 40d6f19ff9c1d052c860365a98a8a074d5671142 (patch) | |
tree | c1d67948079af574a9546597e51a303dc94380d4 /lib/igt_core.c | |
parent | fb3bdfff0e90c6d8b20b6b7b3e044d19efeab38f (diff) |
aux: Suspend signal helper for shell commands
The clone() system call with a larger executable (like /bin/sh) may have
difficulty to make progress on some platforms if interrupted frequently.
So suspend the signal helper process for the duration of the syscall.
This is needed to solve an actual problem by the next patch.
v2:
- Clarify/fix code comments. (Chris)
- Update igt_system_quiet() as well accordingly.
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@intel.com>
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> (v1)
Diffstat (limited to 'lib/igt_core.c')
-rw-r--r-- | lib/igt_core.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c index 950ea9b0..538a4472 100644 --- a/lib/igt_core.c +++ b/lib/igt_core.c @@ -2282,6 +2282,13 @@ int igt_system(const char *command) if (pipe(errpipe) < 0) goto err; + /* + * The clone() system call called from a largish executable has + * difficulty to make progress if interrupted too frequently, so + * suspend the signal helper for the time of the syscall. + */ + igt_suspend_signal_helper(); + igt_fork_helper(&process) { close(outpipe[0]); close(errpipe[0]); @@ -2298,6 +2305,8 @@ int igt_system(const char *command) exit(EXIT_FAILURE); } + igt_resume_signal_helper(); + close(outpipe[1]); close(errpipe[1]); @@ -2340,9 +2349,14 @@ int igt_system_quiet(const char *command) if (dup2(nullfd, STDERR_FILENO) == -1) goto err; + /* See igt_system() for the reason for suspending the signal helper. */ + igt_suspend_signal_helper(); + if ((status = system(command)) == -1) goto err; + igt_resume_signal_helper(); + /* restore */ if (dup2(stdout_fd_copy, STDOUT_FILENO) == -1) goto err; @@ -2355,6 +2369,8 @@ int igt_system_quiet(const char *command) return WEXITSTATUS(status); err: + igt_resume_signal_helper(); + close(stderr_fd_copy); close(stdout_fd_copy); close(nullfd); |