windows/mkwinsyscall: use syscall.SyscallN instead of syscall.Syscall{6,9,12,15}

Replace syscall.Syscall6, Syscall9, Syscall12, and Syscall15 with syscall.SyscallN for Go 1.18+. This simplifies system calls by allowing the exact number of arguments needed, eliminating zero padding and reducing potential errors.

Updated TestSyscallXGeneration to TestSyscallNGeneration to verify correct SyscallN generation for different argument counts.

Change-Id: Icd6662b591d7548e367b88f34243f5529e177eab
GitHub-Last-Rev: c06fca1aa4e8dfa514cff2c652f21719f396bafc
GitHub-Pull-Request: golang/sys#219
Reviewed-on: https://go-review.googlesource.com/c/sys/+/614082
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
This commit is contained in:
mertakman
2024-10-21 13:42:39 +00:00
committed by Gopher Robot
parent a57fdb8507
commit adbb8bbcaf
4 changed files with 496 additions and 532 deletions
+4 -4
View File
@@ -50,7 +50,7 @@ func TestDLLFilenameEscaping(t *testing.T) {
}
}
func TestSyscallXGeneration(t *testing.T) {
func TestSyscallNGeneration(t *testing.T) {
tests := []struct {
name string
wantsysfunc string
@@ -58,17 +58,17 @@ func TestSyscallXGeneration(t *testing.T) {
}{
{
name: "syscall with 2 params",
wantsysfunc: "syscall.Syscall",
wantsysfunc: "syscall.SyscallN",
sig: "Example(a1 *uint16, a2 *uint16) = ",
},
{
name: "syscall with 6 params",
wantsysfunc: "syscall.Syscall6",
wantsysfunc: "syscall.SyscallN",
sig: "Example(a1 *uint, a2 *uint, a3 *uint, a4 *uint, a5 *uint, a6 *uint) = ",
},
{
name: "syscall with 15 params",
wantsysfunc: "syscall.Syscall15",
wantsysfunc: "syscall.SyscallN",
sig: strings.ReplaceAll(`Example(a1 *uint, a2 *uint, a3 *uint, a4 *uint, a5 *uint, a6 *uint,
a7 *uint, a8 *uint, a9 *uint, a10 *uint, a11 *uint, a12 *uint,
a13 *uint, a14 *uint, a15 *uint) = `, "\n", ""),