Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
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
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
30 additions
and
19 deletions
+30
-19
Makefile
src/pkg/syscall/Makefile
+15
-1
str.go
src/pkg/syscall/str.go
+0
-8
syscall_mingw.go
src/pkg/syscall/syscall_mingw.go
+3
-5
syscall_unix.go
src/pkg/syscall/syscall_unix.go
+12
-0
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)
TARG
=
syscall
GOFILES
=
\
err
str.go
\
str.go
\
exec.go
\
syscall.go
\
syscall_
$(GOARCH)
.go
\
...
...
@@ -17,7 +17,21 @@ GOFILES=\
zsysnum_
$(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
=
\
asm_
$(GOOS)
_
$(GOARCH)
.
$O
\
GOFILES
+=
$
(
GOFILES_
$(GOOS)
)
include
../../Make.pkg
src/pkg/syscall/
err
str.go
→
src/pkg/syscall/str.go
View file @
64f33880
...
...
@@ -4,7 +4,6 @@
package
syscall
func
str
(
val
int
)
string
{
// do it here rather than with fmt to avoid dependency
if
val
<
0
{
return
"-"
+
str
(
-
val
)
...
...
@@ -19,10 +18,3 @@ func str(val int) string { // do it here rather than with fmt to avoid dependenc
buf
[
i
]
=
byte
(
val
+
'0'
)
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 (
)
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) {
...
...
@@ -99,11 +99,9 @@ func getSysProcAddr(m uint32, pname string) uintptr {
//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
// TODO(brainman): maybe GetErrstr should replace Errstr alltogether
func
GetErrstr
(
errno
int
)
string
{
func
Errstr
(
errno
int
)
string
{
if
errno
==
EMINGW
{
return
errors
[
errno
]
return
"not supported by windows"
}
var
b
=
make
([]
uint16
,
300
)
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 (
// TODO(brainman): should use value for EMINGW that does not clashes with anything else
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