diff --git a/unix/linux/mksysnum.go b/unix/linux/mksysnum.go index 60d7e235..2b5a6bf7 100644 --- a/unix/linux/mksysnum.go +++ b/unix/linux/mksysnum.go @@ -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")...) } }