Skip to content

Commit e8502b9

Browse files
committed
fixes for removed syscalls
1 parent ccac3ed commit e8502b9

File tree

4 files changed

+22
-0
lines changed

4 files changed

+22
-0
lines changed

unix/linux/mksysnum.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"os"
1313
"os/exec"
1414
"regexp"
15+
"slices"
1516
"sort"
1617
"strconv"
1718
"strings"
@@ -125,6 +126,21 @@ func main() {
125126
fmt.Fprintf(os.Stderr, "can't run %s", cc)
126127
os.Exit(1)
127128
}
129+
130+
if slices.Contains([]string{"riscv64", "loong64", "arm64"}, goarch) {
131+
// Kernel linux v6.11 removed some __NR_* constants that only
132+
// existed on some architectures as an implementation detail. In
133+
// order to keep backwards compatibility we add them back.
134+
//
135+
// See https://lkml.org/lkml/2024/8/5/1283
136+
if !strings.Contains(string(cmd), "#define __NR_arch_specific_syscall") {
137+
cmd = append(cmd, []byte("#define __NR_arch_specific_syscall 244\n")...)
138+
}
139+
if !strings.Contains(string(cmd), "#define __NR_fstatat") {
140+
cmd = append(cmd, []byte("#define __NR_fstatat 79\n")...)
141+
}
142+
}
143+
128144
s := bufio.NewScanner(strings.NewReader(string(cmd)))
129145
var offset, prev, asOffset int
130146
var nums syscallNums

unix/zsysnum_linux_arm64.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unix/zsysnum_linux_loong64.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

unix/zsysnum_linux_riscv64.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)