Commit dcf16bd8 authored by Shenghou Ma's avatar Shenghou Ma

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
parent 8047e8e9
......@@ -114,8 +114,14 @@ func (p *Proc) Addr() uintptr {
return p.addr
}
// Call executes procedure p with arguments a.
func (p *Proc) Call(a ...uintptr) (r1, r2 uintptr, err error) {
// Call executes procedure p with arguments a. It will panic, if more then 15 arguments
// 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) {
case 0:
return Syscall(p.Addr(), uintptr(len(a)), 0, 0, 0)
......@@ -260,8 +266,14 @@ func (p *LazyProc) Addr() uintptr {
return p.proc.Addr()
}
// Call executes procedure p with arguments a.
func (p *LazyProc) Call(a ...uintptr) (r1, r2 uintptr, err error) {
// Call executes procedure p with arguments a. It will panic, if more then 15 arguments
// 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()
return p.proc.Call(a...)
}
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