1
0
mirror of https://github.com/golang/go synced 2024-11-05 12:06:15 -07:00

syscall: (*Proc).Call should return nil error when no error occurs

Fixes #4686.

R=alex.brainman, rsc
CC=golang-dev
https://golang.org/cl/7174047
This commit is contained in:
Shenghou Ma 2013-02-03 01:42:17 +08:00
parent 8047e8e95a
commit dcf16bd83d

View File

@ -114,8 +114,14 @@ func (p *Proc) Addr() uintptr {
return p.addr return p.addr
} }
// Call executes procedure p with arguments a. // Call executes procedure p with arguments a. It will panic, if more then 15 arguments
func (p *Proc) Call(a ...uintptr) (r1, r2 uintptr, err error) { // are supplied.
//
// The returned error is always non-nil, constructed from the result of GetLastError.
// Callers must inspect the primary return value to decide whether an error occurred
// (according to the semantics of the specific function being called) before consulting
// the error. The error will be guaranteed to contain syscall.Errno.
func (p *Proc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) {
switch len(a) { switch len(a) {
case 0: case 0:
return Syscall(p.Addr(), uintptr(len(a)), 0, 0, 0) return Syscall(p.Addr(), uintptr(len(a)), 0, 0, 0)
@ -260,8 +266,14 @@ func (p *LazyProc) Addr() uintptr {
return p.proc.Addr() return p.proc.Addr()
} }
// Call executes procedure p with arguments a. // Call executes procedure p with arguments a. It will panic, if more then 15 arguments
func (p *LazyProc) Call(a ...uintptr) (r1, r2 uintptr, err error) { // are supplied.
//
// The returned error is always non-nil, constructed from the result of GetLastError.
// Callers must inspect the primary return value to decide whether an error occurred
// (according to the semantics of the specific function being called) before consulting
// the error. The error will be guaranteed to contain syscall.Errno.
func (p *LazyProc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) {
p.mustFind() p.mustFind()
return p.proc.Call(a...) return p.proc.Call(a...)
} }