Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
64f33880
Commit
64f33880
authored
Mar 19, 2010
by
Alex Brainman
Committed by
Russ Cox
Mar 19, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
syscall: mingw implemntation of Errstr()
R=golang-dev, rsc CC=golang-dev
https://golang.org/cl/621041
parent
fa462f37
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
19 deletions
+30
-19
src/pkg/syscall/Makefile
src/pkg/syscall/Makefile
+15
-1
src/pkg/syscall/str.go
src/pkg/syscall/str.go
+0
-8
src/pkg/syscall/syscall_mingw.go
src/pkg/syscall/syscall_mingw.go
+3
-5
src/pkg/syscall/syscall_unix.go
src/pkg/syscall/syscall_unix.go
+12
-0
src/pkg/syscall/zerrors_mingw_386.go
src/pkg/syscall/zerrors_mingw_386.go
+0
-5
No files found.
src/pkg/syscall/Makefile
View file @
64f33880
...
@@ -6,7 +6,7 @@ include ../../Make.$(GOARCH)
...
@@ -6,7 +6,7 @@ include ../../Make.$(GOARCH)
TARG
=
syscall
TARG
=
syscall
GOFILES
=
\
GOFILES
=
\
err
str.go
\
str.go
\
exec.go
\
exec.go
\
syscall.go
\
syscall.go
\
syscall_
$(GOARCH)
.go
\
syscall_
$(GOARCH)
.go
\
...
@@ -17,7 +17,21 @@ GOFILES=\
...
@@ -17,7 +17,21 @@ GOFILES=\
zsysnum_
$(GOOS)
_
$(GOARCH)
.go
\
zsysnum_
$(GOOS)
_
$(GOARCH)
.go
\
ztypes_
$(GOOS)
_
$(GOARCH)
.go
\
ztypes_
$(GOOS)
_
$(GOARCH)
.go
\
GOFILES_freebsd
=
\
syscall_unix.go
\
GOFILES_darwin
=
\
syscall_unix.go
\
GOFILES_linux
=
\
syscall_unix.go
\
GOFILES_nacl
=
\
syscall_unix.go
\
OFILES
=
\
OFILES
=
\
asm_
$(GOOS)
_
$(GOARCH)
.
$O
\
asm_
$(GOOS)
_
$(GOARCH)
.
$O
\
GOFILES
+=
$
(
GOFILES_
$(GOOS)
)
include
../../Make.pkg
include
../../Make.pkg
src/pkg/syscall/
err
str.go
→
src/pkg/syscall/str.go
View file @
64f33880
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
package
syscall
package
syscall
func
str
(
val
int
)
string
{
// do it here rather than with fmt to avoid dependency
func
str
(
val
int
)
string
{
// do it here rather than with fmt to avoid dependency
if
val
<
0
{
if
val
<
0
{
return
"-"
+
str
(
-
val
)
return
"-"
+
str
(
-
val
)
...
@@ -19,10 +18,3 @@ func str(val int) string { // do it here rather than with fmt to avoid dependenc
...
@@ -19,10 +18,3 @@ func str(val int) string { // do it here rather than with fmt to avoid dependenc
buf
[
i
]
=
byte
(
val
+
'0'
)
buf
[
i
]
=
byte
(
val
+
'0'
)
return
string
(
buf
[
i
:
])
return
string
(
buf
[
i
:
])
}
}
func
Errstr
(
errno
int
)
string
{
if
errno
<
0
||
errno
>=
int
(
len
(
errors
))
{
return
"error "
+
str
(
errno
)
}
return
errors
[
errno
]
}
src/pkg/syscall/syscall_mingw.go
View file @
64f33880
...
@@ -24,7 +24,7 @@ import (
...
@@ -24,7 +24,7 @@ import (
)
)
func abort(funcname string, err int) {
func abort(funcname string, err int) {
panic(funcname+" failed: (", err, ") ", syscall.
Get
Errstr(err), "\n")
panic(funcname+" failed: (", err, ") ", syscall.Errstr(err), "\n")
}
}
func print_version(v uint32) {
func print_version(v uint32) {
...
@@ -99,11 +99,9 @@ func getSysProcAddr(m uint32, pname string) uintptr {
...
@@ -99,11 +99,9 @@ func getSysProcAddr(m uint32, pname string) uintptr {
//sys GetVersion() (ver uint32, errno int)
//sys GetVersion() (ver uint32, errno int)
//sys FormatMessage(flags uint32, msgsrc uint32, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, errno int) = FormatMessageW
//sys FormatMessage(flags uint32, msgsrc uint32, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, errno int) = FormatMessageW
// TODO(brainman): maybe GetErrstr should replace Errstr alltogether
func
Errstr
(
errno
int
)
string
{
func
GetErrstr
(
errno
int
)
string
{
if
errno
==
EMINGW
{
if
errno
==
EMINGW
{
return
errors
[
errno
]
return
"not supported by windows"
}
}
var
b
=
make
([]
uint16
,
300
)
var
b
=
make
([]
uint16
,
300
)
n
,
err
:=
FormatMessage
(
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_ARGUMENT_ARRAY
,
0
,
uint32
(
errno
),
0
,
b
,
nil
)
n
,
err
:=
FormatMessage
(
FORMAT_MESSAGE_FROM_SYSTEM
|
FORMAT_MESSAGE_ARGUMENT_ARRAY
,
0
,
uint32
(
errno
),
0
,
b
,
nil
)
...
...
src/pkg/syscall/syscall_unix.go
0 → 100644
View file @
64f33880
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package
syscall
func
Errstr
(
errno
int
)
string
{
if
errno
<
0
||
errno
>=
int
(
len
(
errors
))
{
return
"error "
+
str
(
errno
)
}
return
errors
[
errno
]
}
src/pkg/syscall/zerrors_mingw_386.go
View file @
64f33880
...
@@ -12,8 +12,3 @@ const (
...
@@ -12,8 +12,3 @@ const (
// TODO(brainman): should use value for EMINGW that does not clashes with anything else
// TODO(brainman): should use value for EMINGW that does not clashes with anything else
EMINGW
=
99999
/* otherwise unused */
EMINGW
=
99999
/* otherwise unused */
)
)
// Error table
var
errors
=
[
...
]
string
{
EMINGW
:
"not supported by windows"
,
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment