diff options
author | philwo <philwo@google.com> | 2017-04-25 19:42:06 +0200 |
---|---|---|
committer | Vladimir Moskva <vladmos@google.com> | 2017-04-25 20:39:15 +0200 |
commit | ec073fceca1e597a3b6735b434e72e595a5191f6 (patch) | |
tree | 7779f746b7dcff0eb109c8fcaf537d2b6a8662f9 /src/main/tools | |
parent | 1a5c63c6a4f465c3ca3825c8979898d174b44bf8 (diff) |
Check for definition of PR_SET_CHILD_SUBREAPER and don't die when it fails in order to degrade gracefully on older Linux versions that don't support this feature yet.
Fixes broken Bazel CI:
http://ci.bazel.io/job/bazel-docker-tests/532/BAZEL_VERSION=latest,PLATFORM_NAME=docker/console
PiperOrigin-RevId: 154190829
Diffstat (limited to 'src/main/tools')
-rw-r--r-- | src/main/tools/process-tools.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/main/tools/process-tools.cc b/src/main/tools/process-tools.cc index 7dfb6a7e42..a51d8516d5 100644 --- a/src/main/tools/process-tools.cc +++ b/src/main/tools/process-tools.cc @@ -177,10 +177,10 @@ void BecomeSubreaper() { DIE("procctl"); } #endif -#if defined(__linux__) - if (prctl(PR_SET_CHILD_SUBREAPER, 1) < 0) { - DIE("prctl"); - } +#if defined(PR_SET_CHILD_SUBREAPER) + // The "child subreaper" feature needs Linux 3.4 or higher. + // TODO(philwo) print a warning when this fails. + prctl(PR_SET_CHILD_SUBREAPER, 1); #endif } |