mirror of
https://github.com/golang/sys.git
synced 2026-02-08 11:46:04 +03:00
windows/mkwinsyscall: use "windows." prefix when referring to NTStatus
All references to "Errno" go through the syscalldot function, which prepends "syscall." if the generation target is not in the syscall package. Similarly so, we need a windowsdot function to prepend "windows." to NTStatus. Change-Id: I86affcf0155632ed5848ebabca97d175a041c6c3 Reviewed-on: https://go-review.googlesource.com/c/sys/+/298170 Trust: Jason A. Donenfeld <Jason@zx2c4.com> Run-TryBot: Jason A. Donenfeld <Jason@zx2c4.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
@@ -82,6 +82,13 @@ func packagename() string {
|
||||
return packageName
|
||||
}
|
||||
|
||||
func windowsdot() string {
|
||||
if packageName == "windows" {
|
||||
return ""
|
||||
}
|
||||
return "windows."
|
||||
}
|
||||
|
||||
func syscalldot() string {
|
||||
if packageName == "syscall" {
|
||||
return ""
|
||||
@@ -319,7 +326,7 @@ func (r *Rets) SetErrorCode() string {
|
||||
%s = %sErrno(r0)
|
||||
}`
|
||||
const ntstatus = `if r0 != 0 {
|
||||
ntstatus = NTStatus(r0)
|
||||
ntstatus = %sNTStatus(r0)
|
||||
}`
|
||||
if r.Name == "" && !r.ReturnsError {
|
||||
return ""
|
||||
@@ -328,7 +335,7 @@ func (r *Rets) SetErrorCode() string {
|
||||
return r.useLongHandleErrorCode("r1")
|
||||
}
|
||||
if r.Type == "error" && r.Name == "ntstatus" {
|
||||
return ntstatus
|
||||
return fmt.Sprintf(ntstatus, windowsdot())
|
||||
}
|
||||
if r.Type == "error" {
|
||||
return fmt.Sprintf(code, r.Name, syscalldot())
|
||||
|
||||
Reference in New Issue
Block a user