mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-27 03:44:04 +00:00
Update cadvisor and hcsshim versions
Signed-off-by: Kirtana Ashok <kiashok@microsoft.com>
This commit is contained in:
44
vendor/github.com/cilium/ebpf/internal/errors.go
generated
vendored
44
vendor/github.com/cilium/ebpf/internal/errors.go
generated
vendored
@@ -7,32 +7,25 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ErrorWithLog returns an error which includes logs from the kernel verifier.
|
||||
// ErrorWithLog wraps err in a VerifierError that includes the parsed verifier
|
||||
// log buffer.
|
||||
//
|
||||
// The default error output is a summary of the full log. The latter can be
|
||||
// accessed via VerifierError.Log or by formatting the error, see Format.
|
||||
//
|
||||
// A set of heuristics is used to determine whether the log has been truncated.
|
||||
func ErrorWithLog(err error, log []byte) *VerifierError {
|
||||
func ErrorWithLog(source string, err error, log []byte, truncated bool) *VerifierError {
|
||||
const whitespace = "\t\r\v\n "
|
||||
|
||||
// Convert verifier log C string by truncating it on the first 0 byte
|
||||
// and trimming trailing whitespace before interpreting as a Go string.
|
||||
truncated := false
|
||||
if i := bytes.IndexByte(log, 0); i != -1 {
|
||||
if i == len(log)-1 && !bytes.HasSuffix(log[:i], []byte{'\n'}) {
|
||||
// The null byte is at the end of the buffer and it's not preceded
|
||||
// by a newline character. Most likely the buffer was too short.
|
||||
truncated = true
|
||||
}
|
||||
|
||||
log = log[:i]
|
||||
} else if len(log) > 0 {
|
||||
// No null byte? Dodgy!
|
||||
truncated = true
|
||||
}
|
||||
|
||||
log = bytes.Trim(log, whitespace)
|
||||
if len(log) == 0 {
|
||||
return &VerifierError{source, err, nil, truncated}
|
||||
}
|
||||
|
||||
logLines := bytes.Split(log, []byte{'\n'})
|
||||
lines := make([]string, 0, len(logLines))
|
||||
for _, line := range logLines {
|
||||
@@ -41,13 +34,14 @@ func ErrorWithLog(err error, log []byte) *VerifierError {
|
||||
lines = append(lines, string(bytes.TrimRight(line, whitespace)))
|
||||
}
|
||||
|
||||
return &VerifierError{err, lines, truncated}
|
||||
return &VerifierError{source, err, lines, truncated}
|
||||
}
|
||||
|
||||
// VerifierError includes information from the eBPF verifier.
|
||||
//
|
||||
// It summarises the log output, see Format if you want to output the full contents.
|
||||
type VerifierError struct {
|
||||
source string
|
||||
// The error which caused this error.
|
||||
Cause error
|
||||
// The verifier output split into lines.
|
||||
@@ -67,9 +61,12 @@ func (le *VerifierError) Error() string {
|
||||
log = log[:n-1]
|
||||
}
|
||||
|
||||
var b strings.Builder
|
||||
fmt.Fprintf(&b, "%s: %s", le.source, le.Cause.Error())
|
||||
|
||||
n := len(log)
|
||||
if n == 0 {
|
||||
return le.Cause.Error()
|
||||
return b.String()
|
||||
}
|
||||
|
||||
lines := log[n-1:]
|
||||
@@ -78,14 +75,9 @@ func (le *VerifierError) Error() string {
|
||||
lines = log[n-2:]
|
||||
}
|
||||
|
||||
var b strings.Builder
|
||||
fmt.Fprintf(&b, "%s: ", le.Cause.Error())
|
||||
|
||||
for i, line := range lines {
|
||||
for _, line := range lines {
|
||||
b.WriteString(": ")
|
||||
b.WriteString(strings.TrimSpace(line))
|
||||
if i != len(lines)-1 {
|
||||
b.WriteString(": ")
|
||||
}
|
||||
}
|
||||
|
||||
omitted := len(le.Log) - len(lines)
|
||||
@@ -143,8 +135,8 @@ func includePreviousLine(line string) bool {
|
||||
// Understood verbs are %s and %v, which are equivalent to calling Error(). %v
|
||||
// allows outputting additional information using the following flags:
|
||||
//
|
||||
// + Output the first <width> lines, or all lines if no width is given.
|
||||
// - Output the last <width> lines, or all lines if no width is given.
|
||||
// %+<width>v: Output the first <width> lines, or all lines if no width is given.
|
||||
// %-<width>v: Output the last <width> lines, or all lines if no width is given.
|
||||
//
|
||||
// Use width to specify how many lines to output. Use the '-' flag to output
|
||||
// lines from the end of the log instead of the beginning.
|
||||
@@ -174,7 +166,7 @@ func (le *VerifierError) Format(f fmt.State, verb rune) {
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Fprintf(f, "%s:", le.Cause.Error())
|
||||
fmt.Fprintf(f, "%s: %s:", le.source, le.Cause.Error())
|
||||
|
||||
omitted := len(le.Log) - n
|
||||
lines := le.Log[:n]
|
||||
|
||||
Reference in New Issue
Block a user