mirror of
https://github.com/golang/sys.git
synced 2026-02-08 19:56:04 +03:00
use bytes instead of string, switch instead of slices
This commit is contained in:
@@ -8,11 +8,11 @@ package main
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"regexp"
|
||||
"slices"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
@@ -127,16 +127,17 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
if slices.Contains([]string{"riscv64", "loong64", "arm64"}, goarch) {
|
||||
// Kernel linux v6.11 removed some __NR_* constants that only
|
||||
switch goarch {
|
||||
case "riscv64", "loong64", "arm64":
|
||||
// Kernel linux v6.11 removed some __NR_* macros that only
|
||||
// existed on some architectures as an implementation detail. In
|
||||
// order to keep backwards compatibility we add them back.
|
||||
//
|
||||
// See https://lkml.org/lkml/2024/8/5/1283
|
||||
if !strings.Contains(string(cmd), "#define __NR_arch_specific_syscall") {
|
||||
// See https://lkml.org/lkml/2024/8/5/1283.
|
||||
if !bytes.Contains(cmd, []byte("#define __NR_arch_specific_syscall")) {
|
||||
cmd = append(cmd, []byte("#define __NR_arch_specific_syscall 244\n")...)
|
||||
}
|
||||
if !strings.Contains(string(cmd), "#define __NR_fstatat") {
|
||||
if !bytes.Contains(cmd, []byte("#define __NR_fstatat")) {
|
||||
cmd = append(cmd, []byte("#define __NR_fstatat 79\n")...)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user