Skip to content

Commit

Permalink
Merge pull request #4399 from kolyshkin/endian
Browse files Browse the repository at this point in the history
libct/seccomp/patchbpf: use binary.NativeEndian
  • Loading branch information
AkihiroSuda authored Sep 12, 2024
2 parents a447f5b + 80f1def commit b1bc3bf
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions libcontainer/utils/utils.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package utils

import (
"encoding/binary"
"encoding/json"
"io"
"os"
"path/filepath"
"strings"
"unsafe"

"golang.org/x/sys/unix"
)
Expand All @@ -16,20 +14,6 @@ const (
exitSignalOffset = 128
)

// NativeEndian is the native byte order of the host system.
var NativeEndian binary.ByteOrder

func init() {
// Copied from <golang.org/x/net/internal/socket/sys.go>.
i := uint32(1)
b := (*[4]byte)(unsafe.Pointer(&i))
if b[0] == 1 {
NativeEndian = binary.LittleEndian
} else {
NativeEndian = binary.BigEndian
}
}

// ExitStatus returns the correct exit status for a process based on if it
// was signaled or exited cleanly
func ExitStatus(status unix.WaitStatus) int {
Expand Down

0 comments on commit b1bc3bf

Please sign in to comment.