aboutsummaryrefslogtreecommitdiff
path: root/compiler_wrapper/kernel_bug.go
diff options
context:
space:
mode:
Diffstat (limited to 'compiler_wrapper/kernel_bug.go')
-rw-r--r--compiler_wrapper/kernel_bug.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/compiler_wrapper/kernel_bug.go b/compiler_wrapper/kernel_bug.go
new file mode 100644
index 00000000..55817cb6
--- /dev/null
+++ b/compiler_wrapper/kernel_bug.go
@@ -0,0 +1,25 @@
+// Copyright 2021 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+package main
+
+import (
+ "bytes"
+ "strings"
+)
+
+// crbug.com/1166017
+
+const kernelBugRetryLimit = 25
+
+// GCC will sometimes fail to wait on subprocesses due to this kernel bug. It always fails the
+// compilation and prints "Unknown error 512" in that case.
+func containsTracesOfKernelBug(buf []byte) bool {
+ return bytes.Contains(buf, []byte("Unknown error 512"))
+}
+
+func errorContainsTracesOfKernelBug(err error) bool {
+ // We'll get errors that look like "waitid: errno 512." Presumably, this isn't specific to
+ // waitid, so just try to match the "errno 512" ending.
+ return err != nil && strings.HasSuffix(err.Error(), "errno 512")
+}