1
0
mirror of https://github.com/golang/go synced 2024-11-19 05:44:40 -07:00

syscall: support Linux syscalls without error return on mipsx/mips64x

Like on other architectures, use rawSyscallNoError for Linux syscalls
that don't return an error and convert all applicable occurences of
RawSyscall to use it instead.

This was missed in CL 84485 because mkall.sh doesn't support
mipsx/mips64x, so add the corresponding entries as well.

Updates #22924

Change-Id: I762cbee0827140b9890c4a10830e0b4cd33de92f
Reviewed-on: https://go-review.googlesource.com/118655
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Tobias Klauser 2018-06-13 15:40:50 +02:00 committed by Tobias Klauser
parent 72ce047a6c
commit a2f72cc80d
5 changed files with 62 additions and 32 deletions

View File

@ -189,6 +189,36 @@ linux_arm64)
# API consistent between platforms.
mktypes="GOARCH=$GOARCH go tool cgo -godefs -- -fsigned-char"
;;
linux_mips)
GOOSARCH_in=syscall_linux_mipsx.go
unistd_h=/usr/include/asm/unistd.h
mksyscall="./mksyscall.pl -b32 -arm"
mkerrors="$mkerrors"
mksysnum="./mksysnum_linux.pl $unistd_h"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
linux_mipsle)
GOOSARCH_in=syscall_linux_mipsx.go
unistd_h=/usr/include/asm/unistd.h
mksyscall="./mksyscall.pl -l32 -arm"
mkerrors="$mkerrors"
mksysnum="./mksysnum_linux.pl $unistd_h"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
linux_mips64)
GOOSARCH_in=syscall_linux_mips64x.go
unistd_h=/usr/include/asm/unistd.h
mkerrors="$mkerrors -m64"
mksysnum="./mksysnum_linux.pl $unistd_h"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
linux_mips64le)
GOOSARCH_in=syscall_linux_mips64x.go
unistd_h=/usr/include/asm/unistd.h
mkerrors="$mkerrors -m64"
mksysnum="./mksysnum_linux.pl $unistd_h"
mktypes="GOARCH=$GOARCH go tool cgo -godefs"
;;
linux_ppc64)
GOOSARCH_in=syscall_linux_ppc64x.go
unistd_h=/usr/include/asm/unistd.h

View File

@ -484,7 +484,7 @@ func Getpgid(pid int) (pgid int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpid() (pid int) {
r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETPID, 0, 0, 0)
pid = int(r0)
return
}
@ -492,7 +492,7 @@ func Getpid() (pid int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getppid() (ppid int) {
r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETPPID, 0, 0, 0)
ppid = int(r0)
return
}
@ -521,7 +521,7 @@ func Getrusage(who int, rusage *Rusage) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Gettid() (tid int) {
r0, _, _ := RawSyscall(SYS_GETTID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETTID, 0, 0, 0)
tid = int(r0)
return
}
@ -928,7 +928,7 @@ func Times(tms *Tms) (ticks uintptr, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Umask(mask int) (oldmask int) {
r0, _, _ := RawSyscall(SYS_UMASK, uintptr(mask), 0, 0)
r0, _ := rawSyscallNoError(SYS_UMASK, uintptr(mask), 0, 0)
oldmask = int(r0)
return
}
@ -1169,7 +1169,7 @@ func Ftruncate(fd int, length int64) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getegid() (egid int) {
r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETEGID, 0, 0, 0)
egid = int(r0)
return
}
@ -1177,7 +1177,7 @@ func Getegid() (egid int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Geteuid() (euid int) {
r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETEUID, 0, 0, 0)
euid = int(r0)
return
}
@ -1185,7 +1185,7 @@ func Geteuid() (euid int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getgid() (gid int) {
r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETGID, 0, 0, 0)
gid = int(r0)
return
}
@ -1193,7 +1193,7 @@ func Getgid() (gid int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getuid() (uid int) {
r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETUID, 0, 0, 0)
uid = int(r0)
return
}

View File

@ -484,7 +484,7 @@ func Getpgid(pid int) (pgid int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpid() (pid int) {
r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETPID, 0, 0, 0)
pid = int(r0)
return
}
@ -492,7 +492,7 @@ func Getpid() (pid int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getppid() (ppid int) {
r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETPPID, 0, 0, 0)
ppid = int(r0)
return
}
@ -521,7 +521,7 @@ func Getrusage(who int, rusage *Rusage) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Gettid() (tid int) {
r0, _, _ := RawSyscall(SYS_GETTID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETTID, 0, 0, 0)
tid = int(r0)
return
}
@ -928,7 +928,7 @@ func Times(tms *Tms) (ticks uintptr, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Umask(mask int) (oldmask int) {
r0, _, _ := RawSyscall(SYS_UMASK, uintptr(mask), 0, 0)
r0, _ := rawSyscallNoError(SYS_UMASK, uintptr(mask), 0, 0)
oldmask = int(r0)
return
}
@ -1179,7 +1179,7 @@ func Ftruncate(fd int, length int64) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getegid() (egid int) {
r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETEGID, 0, 0, 0)
egid = int(r0)
return
}
@ -1187,7 +1187,7 @@ func Getegid() (egid int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Geteuid() (euid int) {
r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETEUID, 0, 0, 0)
euid = int(r0)
return
}
@ -1195,7 +1195,7 @@ func Geteuid() (euid int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getgid() (gid int) {
r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETGID, 0, 0, 0)
gid = int(r0)
return
}
@ -1213,7 +1213,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getuid() (uid int) {
r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETUID, 0, 0, 0)
uid = int(r0)
return
}

View File

@ -484,7 +484,7 @@ func Getpgid(pid int) (pgid int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpid() (pid int) {
r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETPID, 0, 0, 0)
pid = int(r0)
return
}
@ -492,7 +492,7 @@ func Getpid() (pid int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getppid() (ppid int) {
r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETPPID, 0, 0, 0)
ppid = int(r0)
return
}
@ -521,7 +521,7 @@ func Getrusage(who int, rusage *Rusage) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Gettid() (tid int) {
r0, _, _ := RawSyscall(SYS_GETTID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETTID, 0, 0, 0)
tid = int(r0)
return
}
@ -928,7 +928,7 @@ func Times(tms *Tms) (ticks uintptr, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Umask(mask int) (oldmask int) {
r0, _, _ := RawSyscall(SYS_UMASK, uintptr(mask), 0, 0)
r0, _ := rawSyscallNoError(SYS_UMASK, uintptr(mask), 0, 0)
oldmask = int(r0)
return
}
@ -1179,7 +1179,7 @@ func Ftruncate(fd int, length int64) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getegid() (egid int) {
r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETEGID, 0, 0, 0)
egid = int(r0)
return
}
@ -1187,7 +1187,7 @@ func Getegid() (egid int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Geteuid() (euid int) {
r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETEUID, 0, 0, 0)
euid = int(r0)
return
}
@ -1195,7 +1195,7 @@ func Geteuid() (euid int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getgid() (gid int) {
r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETGID, 0, 0, 0)
gid = int(r0)
return
}
@ -1213,7 +1213,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getuid() (uid int) {
r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETUID, 0, 0, 0)
uid = int(r0)
return
}

View File

@ -484,7 +484,7 @@ func Getpgid(pid int) (pgid int, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getpid() (pid int) {
r0, _, _ := RawSyscall(SYS_GETPID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETPID, 0, 0, 0)
pid = int(r0)
return
}
@ -492,7 +492,7 @@ func Getpid() (pid int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getppid() (ppid int) {
r0, _, _ := RawSyscall(SYS_GETPPID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETPPID, 0, 0, 0)
ppid = int(r0)
return
}
@ -521,7 +521,7 @@ func Getrusage(who int, rusage *Rusage) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Gettid() (tid int) {
r0, _, _ := RawSyscall(SYS_GETTID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETTID, 0, 0, 0)
tid = int(r0)
return
}
@ -928,7 +928,7 @@ func Times(tms *Tms) (ticks uintptr, err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Umask(mask int) (oldmask int) {
r0, _, _ := RawSyscall(SYS_UMASK, uintptr(mask), 0, 0)
r0, _ := rawSyscallNoError(SYS_UMASK, uintptr(mask), 0, 0)
oldmask = int(r0)
return
}
@ -1169,7 +1169,7 @@ func Ftruncate(fd int, length int64) (err error) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getegid() (egid int) {
r0, _, _ := RawSyscall(SYS_GETEGID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETEGID, 0, 0, 0)
egid = int(r0)
return
}
@ -1177,7 +1177,7 @@ func Getegid() (egid int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Geteuid() (euid int) {
r0, _, _ := RawSyscall(SYS_GETEUID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETEUID, 0, 0, 0)
euid = int(r0)
return
}
@ -1185,7 +1185,7 @@ func Geteuid() (euid int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getgid() (gid int) {
r0, _, _ := RawSyscall(SYS_GETGID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETGID, 0, 0, 0)
gid = int(r0)
return
}
@ -1193,7 +1193,7 @@ func Getgid() (gid int) {
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func Getuid() (uid int) {
r0, _, _ := RawSyscall(SYS_GETUID, 0, 0, 0)
r0, _ := rawSyscallNoError(SYS_GETUID, 0, 0, 0)
uid = int(r0)
return
}