Commit 8ec32e8d authored by Lucio De Re's avatar Lucio De Re Committed by Russ Cox

syscall: fix for Plan 9 build

exec_plan9.go:
. Adjusted return argument to match other changes.
#mksyscall.pl:
. Replaced "err = e1" with "err = NewError(e1)".
* Change abandoned, Russ made a better suggestion involving
  syscall_plan9.go.
syscall_plan9.go:
. Removed redundant "err = nil" lines.
. Adjusted //sys lines for mksyscall.pl.
* Replaced "err string" with "err ErrorString" in return arguments.
zsyscall_plan9_386.go:
. This module ought to be generated, but as it exists in the
  repository, I rebuilt it and checked that it matched expectations.
  Anybody is welcome to remove this from the repository if
  they feel it should go, but remember that not all Plan 9
  installations have a working Perl.

R=rsc
CC=ality, golang-dev
https://golang.org/cl/5411046
parent 2e9d7a6d
...@@ -516,10 +516,10 @@ func Exec(argv0 string, argv []string, envv []string) (err error) { ...@@ -516,10 +516,10 @@ func Exec(argv0 string, argv []string, envv []string) (err error) {
} }
} }
_, _, e := Syscall(SYS_EXEC, _, _, e1 := Syscall(SYS_EXEC,
uintptr(unsafe.Pointer(StringBytePtr(argv0))), uintptr(unsafe.Pointer(StringBytePtr(argv0))),
uintptr(unsafe.Pointer(&StringSlicePtr(argv)[0])), uintptr(unsafe.Pointer(&StringSlicePtr(argv)[0])),
0) 0)
return NewError(e) return e1
} }
...@@ -38,8 +38,8 @@ var ( ...@@ -38,8 +38,8 @@ var (
// creation of IPv6 sockets to return EAFNOSUPPORT. // creation of IPv6 sockets to return EAFNOSUPPORT.
var SocketDisableIPv6 bool var SocketDisableIPv6 bool
func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err string) func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err ErrorString)
func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err string) func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err ErrorString)
func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr)
func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) func RawSyscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr)
...@@ -170,7 +170,6 @@ func seek(placeholder uintptr, fd int, offset int64, whence int) (newoffset int6 ...@@ -170,7 +170,6 @@ func seek(placeholder uintptr, fd int, offset int64, whence int) (newoffset int6
func Seek(fd int, offset int64, whence int) (newoffset int64, err error) { func Seek(fd int, offset int64, whence int) (newoffset int64, err error) {
newoffset, e := seek(0, fd, offset, whence) newoffset, e := seek(0, fd, offset, whence)
err = nil
if newoffset == -1 { if newoffset == -1 {
err = NewError(e) err = NewError(e)
} }
...@@ -246,7 +245,7 @@ func Unmount(name, old string) (err error) { ...@@ -246,7 +245,7 @@ func Unmount(name, old string) (err error) {
oldp := uintptr(unsafe.Pointer(StringBytePtr(old))) oldp := uintptr(unsafe.Pointer(StringBytePtr(old)))
var r0 uintptr var r0 uintptr
var e string var e ErrorString
// bind(2) man page: If name is zero, everything bound or mounted upon old is unbound or unmounted. // bind(2) man page: If name is zero, everything bound or mounted upon old is unbound or unmounted.
if name == "" { if name == "" {
...@@ -255,9 +254,8 @@ func Unmount(name, old string) (err error) { ...@@ -255,9 +254,8 @@ func Unmount(name, old string) (err error) {
r0, _, e = Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(StringBytePtr(name))), oldp, 0) r0, _, e = Syscall(SYS_UNMOUNT, uintptr(unsafe.Pointer(StringBytePtr(name))), oldp, 0)
} }
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e) err = e
} }
return return
} }
...@@ -288,7 +286,6 @@ func DecodeBintime(b []byte) (nsec int64, err error) { ...@@ -288,7 +286,6 @@ func DecodeBintime(b []byte) (nsec int64, err error) {
if len(b) != 8 { if len(b) != 8 {
return -1, NewError("bad /dev/bintime format") return -1, NewError("bad /dev/bintime format")
} }
err = nil
nsec = int64(b[0])<<56 | nsec = int64(b[0])<<56 |
int64(b[1])<<48 | int64(b[1])<<48 |
int64(b[2])<<40 | int64(b[2])<<40 |
...@@ -335,17 +332,17 @@ func Getgroups() (gids []int, err error) { ...@@ -335,17 +332,17 @@ func Getgroups() (gids []int, err error) {
return make([]int, 0), nil return make([]int, 0), nil
} }
//sys Dup(oldfd int, newfd int) (fd int, err Error) //sys Dup(oldfd int, newfd int) (fd int, err error)
//sys Open(path string, mode int) (fd int, err Error) //sys Open(path string, mode int) (fd int, err error)
//sys Create(path string, mode int, perm uint32) (fd int, err Error) //sys Create(path string, mode int, perm uint32) (fd int, err error)
//sys Remove(path string) (err Error) //sys Remove(path string) (err error)
//sys Pread(fd int, p []byte, offset int64) (n int, err Error) //sys Pread(fd int, p []byte, offset int64) (n int, err error)
//sys Pwrite(fd int, p []byte, offset int64) (n int, err Error) //sys Pwrite(fd int, p []byte, offset int64) (n int, err error)
//sys Close(fd int) (err Error) //sys Close(fd int) (err error)
//sys Chdir(path string) (err Error) //sys Chdir(path string) (err error)
//sys Bind(name string, old string, flag int) (err Error) //sys Bind(name string, old string, flag int) (err error)
//sys Mount(fd int, afd int, old string, flag int, aname string) (err Error) //sys Mount(fd int, afd int, old string, flag int, aname string) (err error)
//sys Stat(path string, edir []byte) (n int, err Error) //sys Stat(path string, edir []byte) (n int, err error)
//sys Fstat(fd int, edir []byte) (n int, err Error) //sys Fstat(fd int, edir []byte) (n int, err error)
//sys Wstat(path string, edir []byte) (err Error) //sys Wstat(path string, edir []byte) (err error)
//sys Fwstat(fd int, edir []byte) (err Error) //sys Fwstat(fd int, edir []byte) (err error)
...@@ -22,9 +22,8 @@ func fd2path(fd int, buf []byte) (err error) { ...@@ -22,9 +22,8 @@ func fd2path(fd int, buf []byte) (err error) {
_p0 = unsafe.Pointer(&_zero) _p0 = unsafe.Pointer(&_zero)
} }
r0, _, e1 := Syscall(SYS_FD2PATH, uintptr(fd), uintptr(_p0), uintptr(len(buf))) r0, _, e1 := Syscall(SYS_FD2PATH, uintptr(fd), uintptr(_p0), uintptr(len(buf)))
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
} }
return return
} }
...@@ -33,20 +32,8 @@ func fd2path(fd int, buf []byte) (err error) { ...@@ -33,20 +32,8 @@ func fd2path(fd int, buf []byte) (err error) {
func pipe(p *[2]_C_int) (err error) { func pipe(p *[2]_C_int) (err error) {
r0, _, e1 := Syscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0) r0, _, e1 := Syscall(SYS_PIPE, uintptr(unsafe.Pointer(p)), 0, 0)
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
}
return
}
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
func sleep(millisecs int32) (err error) {
r0, _, e1 := Syscall(SYS_SLEEP, uintptr(millisecs), 0, 0)
err = nil
if int(r0) == -1 {
err = NewError(e1)
} }
return return
} }
...@@ -62,9 +49,8 @@ func await(s []byte) (n int, err error) { ...@@ -62,9 +49,8 @@ func await(s []byte) (n int, err error) {
} }
r0, _, e1 := Syscall(SYS_AWAIT, uintptr(_p0), uintptr(len(s)), 0) r0, _, e1 := Syscall(SYS_AWAIT, uintptr(_p0), uintptr(len(s)), 0)
n = int(r0) n = int(r0)
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
} }
return return
} }
...@@ -74,9 +60,8 @@ func await(s []byte) (n int, err error) { ...@@ -74,9 +60,8 @@ func await(s []byte) (n int, err error) {
func Dup(oldfd int, newfd int) (fd int, err error) { func Dup(oldfd int, newfd int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), uintptr(newfd), 0) r0, _, e1 := Syscall(SYS_DUP, uintptr(oldfd), uintptr(newfd), 0)
fd = int(r0) fd = int(r0)
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
} }
return return
} }
...@@ -86,9 +71,8 @@ func Dup(oldfd int, newfd int) (fd int, err error) { ...@@ -86,9 +71,8 @@ func Dup(oldfd int, newfd int) (fd int, err error) {
func Open(path string, mode int) (fd int, err error) { func Open(path string, mode int) (fd int, err error) {
r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0) r0, _, e1 := Syscall(SYS_OPEN, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), 0)
fd = int(r0) fd = int(r0)
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
} }
return return
} }
...@@ -98,9 +82,8 @@ func Open(path string, mode int) (fd int, err error) { ...@@ -98,9 +82,8 @@ func Open(path string, mode int) (fd int, err error) {
func Create(path string, mode int, perm uint32) (fd int, err error) { func Create(path string, mode int, perm uint32) (fd int, err error) {
r0, _, e1 := Syscall(SYS_CREATE, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm)) r0, _, e1 := Syscall(SYS_CREATE, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(mode), uintptr(perm))
fd = int(r0) fd = int(r0)
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
} }
return return
} }
...@@ -109,9 +92,8 @@ func Create(path string, mode int, perm uint32) (fd int, err error) { ...@@ -109,9 +92,8 @@ func Create(path string, mode int, perm uint32) (fd int, err error) {
func Remove(path string) (err error) { func Remove(path string) (err error) {
r0, _, e1 := Syscall(SYS_REMOVE, uintptr(unsafe.Pointer(StringBytePtr(path))), 0, 0) r0, _, e1 := Syscall(SYS_REMOVE, uintptr(unsafe.Pointer(StringBytePtr(path))), 0, 0)
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
} }
return return
} }
...@@ -127,9 +109,8 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) { ...@@ -127,9 +109,8 @@ func Pread(fd int, p []byte, offset int64) (n int, err error) {
} }
r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) r0, _, e1 := Syscall6(SYS_PREAD, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
n = int(r0) n = int(r0)
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
} }
return return
} }
...@@ -145,9 +126,8 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { ...@@ -145,9 +126,8 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
} }
r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) r0, _, e1 := Syscall6(SYS_PWRITE, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0)
n = int(r0) n = int(r0)
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
} }
return return
} }
...@@ -156,9 +136,8 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) { ...@@ -156,9 +136,8 @@ func Pwrite(fd int, p []byte, offset int64) (n int, err error) {
func Close(fd int) (err error) { func Close(fd int) (err error) {
r0, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0) r0, _, e1 := Syscall(SYS_CLOSE, uintptr(fd), 0, 0)
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
} }
return return
} }
...@@ -167,9 +146,8 @@ func Close(fd int) (err error) { ...@@ -167,9 +146,8 @@ func Close(fd int) (err error) {
func Chdir(path string) (err error) { func Chdir(path string) (err error) {
r0, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), 0, 0) r0, _, e1 := Syscall(SYS_CHDIR, uintptr(unsafe.Pointer(StringBytePtr(path))), 0, 0)
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
} }
return return
} }
...@@ -178,9 +156,8 @@ func Chdir(path string) (err error) { ...@@ -178,9 +156,8 @@ func Chdir(path string) (err error) {
func Bind(name string, old string, flag int) (err error) { func Bind(name string, old string, flag int) (err error) {
r0, _, e1 := Syscall(SYS_BIND, uintptr(unsafe.Pointer(StringBytePtr(name))), uintptr(unsafe.Pointer(StringBytePtr(old))), uintptr(flag)) r0, _, e1 := Syscall(SYS_BIND, uintptr(unsafe.Pointer(StringBytePtr(name))), uintptr(unsafe.Pointer(StringBytePtr(old))), uintptr(flag))
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
} }
return return
} }
...@@ -189,9 +166,8 @@ func Bind(name string, old string, flag int) (err error) { ...@@ -189,9 +166,8 @@ func Bind(name string, old string, flag int) (err error) {
func Mount(fd int, afd int, old string, flag int, aname string) (err error) { func Mount(fd int, afd int, old string, flag int, aname string) (err error) {
r0, _, e1 := Syscall6(SYS_MOUNT, uintptr(fd), uintptr(afd), uintptr(unsafe.Pointer(StringBytePtr(old))), uintptr(flag), uintptr(unsafe.Pointer(StringBytePtr(aname))), 0) r0, _, e1 := Syscall6(SYS_MOUNT, uintptr(fd), uintptr(afd), uintptr(unsafe.Pointer(StringBytePtr(old))), uintptr(flag), uintptr(unsafe.Pointer(StringBytePtr(aname))), 0)
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
} }
return return
} }
...@@ -207,9 +183,8 @@ func Stat(path string, edir []byte) (n int, err error) { ...@@ -207,9 +183,8 @@ func Stat(path string, edir []byte) (n int, err error) {
} }
r0, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(_p0), uintptr(len(edir))) r0, _, e1 := Syscall(SYS_STAT, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(_p0), uintptr(len(edir)))
n = int(r0) n = int(r0)
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
} }
return return
} }
...@@ -225,9 +200,8 @@ func Fstat(fd int, edir []byte) (n int, err error) { ...@@ -225,9 +200,8 @@ func Fstat(fd int, edir []byte) (n int, err error) {
} }
r0, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir))) r0, _, e1 := Syscall(SYS_FSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir)))
n = int(r0) n = int(r0)
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
} }
return return
} }
...@@ -242,9 +216,8 @@ func Wstat(path string, edir []byte) (err error) { ...@@ -242,9 +216,8 @@ func Wstat(path string, edir []byte) (err error) {
_p0 = unsafe.Pointer(&_zero) _p0 = unsafe.Pointer(&_zero)
} }
r0, _, e1 := Syscall(SYS_WSTAT, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(_p0), uintptr(len(edir))) r0, _, e1 := Syscall(SYS_WSTAT, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(_p0), uintptr(len(edir)))
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
} }
return return
} }
...@@ -259,9 +232,8 @@ func Fwstat(fd int, edir []byte) (err error) { ...@@ -259,9 +232,8 @@ func Fwstat(fd int, edir []byte) (err error) {
_p0 = unsafe.Pointer(&_zero) _p0 = unsafe.Pointer(&_zero)
} }
r0, _, e1 := Syscall(SYS_FWSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir))) r0, _, e1 := Syscall(SYS_FWSTAT, uintptr(fd), uintptr(_p0), uintptr(len(edir)))
err = nil
if int(r0) == -1 { if int(r0) == -1 {
err = NewError(e1) err = e1
} }
return return
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment