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
07a2989d
Commit
07a2989d
authored
Feb 14, 2012
by
Alex Brainman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runtime, syscall, os/signal: fix windows build
R=golang-dev, bradfitz CC=golang-dev
https://golang.org/cl/5656048
parent
adc1e0bc
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
119 additions
and
36 deletions
+119
-36
src/pkg/net/dial_test.go
src/pkg/net/dial_test.go
+5
-0
src/pkg/os/signal/signal_unix.go
src/pkg/os/signal/signal_unix.go
+1
-1
src/pkg/os/signal/signal_windows_test.go
src/pkg/os/signal/signal_windows_test.go
+51
-0
src/pkg/runtime/os_windows.h
src/pkg/runtime/os_windows.h
+3
-0
src/pkg/runtime/runtime.h
src/pkg/runtime/runtime.h
+0
-1
src/pkg/runtime/signal_windows_386.c
src/pkg/runtime/signal_windows_386.c
+0
-6
src/pkg/runtime/signal_windows_amd64.c
src/pkg/runtime/signal_windows_amd64.c
+0
-12
src/pkg/runtime/sigqueue.goc
src/pkg/runtime/sigqueue.goc
+1
-1
src/pkg/runtime/thread_windows.c
src/pkg/runtime/thread_windows.c
+11
-0
src/pkg/syscall/syscall_windows.go
src/pkg/syscall/syscall_windows.go
+16
-2
src/pkg/syscall/ztypes_windows.go
src/pkg/syscall/ztypes_windows.go
+31
-13
No files found.
src/pkg/net/dial_test.go
View file @
07a2989d
...
...
@@ -86,6 +86,11 @@ func TestDialTimeout(t *testing.T) {
}
func
TestSelfConnect
(
t
*
testing
.
T
)
{
if
runtime
.
GOOS
==
"windows"
{
// TODO(brainman): do not know why it hangs.
t
.
Logf
(
"skipping known-broken test on windows"
)
return
}
// Test that Dial does not honor self-connects.
// See the comment in DialTCP.
...
...
src/pkg/os/signal/signal_unix.go
View file @
07a2989d
...
...
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build darwin freebsd linux netbsd openbsd
// +build darwin freebsd linux netbsd openbsd
windows
package
signal
...
...
src/pkg/os/signal/signal_windows_test.go
0 → 100644
View file @
07a2989d
// Copyright 2012 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
signal
import
(
"flag"
"os"
"syscall"
"testing"
"time"
)
var
runCtrlBreakTest
=
flag
.
Bool
(
"run_ctlbrk_test"
,
false
,
"force to run Ctrl+Break test"
)
func
sendCtrlBreak
(
t
*
testing
.
T
)
{
d
,
e
:=
syscall
.
LoadDLL
(
"kernel32.dll"
)
if
e
!=
nil
{
t
.
Fatalf
(
"LoadDLL: %v
\n
"
,
e
)
}
p
,
e
:=
d
.
FindProc
(
"GenerateConsoleCtrlEvent"
)
if
e
!=
nil
{
t
.
Fatalf
(
"FindProc: %v
\n
"
,
e
)
}
r
,
_
,
e
:=
p
.
Call
(
0
,
0
)
if
r
==
0
{
t
.
Fatalf
(
"GenerateConsoleCtrlEvent: %v
\n
"
,
e
)
}
}
func
TestCtrlBreak
(
t
*
testing
.
T
)
{
if
!*
runCtrlBreakTest
{
t
.
Logf
(
"test disabled; use -run_ctlbrk_test to enable"
)
return
}
go
func
()
{
time
.
Sleep
(
1
*
time
.
Second
)
sendCtrlBreak
(
t
)
}()
c
:=
make
(
chan
os
.
Signal
,
10
)
Notify
(
c
)
select
{
case
s
:=
<-
c
:
if
s
!=
os
.
Interrupt
{
t
.
Fatalf
(
"Wrong signal received: got %q, want %q
\n
"
,
s
,
os
.
Interrupt
)
}
case
<-
time
.
After
(
3
*
time
.
Second
)
:
t
.
Fatalf
(
"Timeout waiting for Ctrl+Break
\n
"
)
}
}
src/pkg/runtime/os_windows.h
View file @
07a2989d
...
...
@@ -27,3 +27,6 @@ uint32 runtime·ctrlhandler(uint32 type);
// Windows dll function to go callback entry.
byte
*
runtime
·
compilecallback
(
Eface
fn
,
bool
cleanstack
);
void
*
runtime
·
callbackasm
(
void
);
// TODO(brainman): should not need those
#define NSIG 65
src/pkg/runtime/runtime.h
View file @
07a2989d
...
...
@@ -555,7 +555,6 @@ void runtime·asmcgocall(void (*fn)(void*), void*);
void
runtime
·
entersyscall
(
void
);
void
runtime
·
exitsyscall
(
void
);
G
*
runtime
·
newproc1
(
byte
*
,
byte
*
,
int32
,
int32
,
void
*
);
void
runtime
·
siginit
(
void
);
bool
runtime
·
sigsend
(
int32
sig
);
int32
runtime
·
callers
(
int32
,
uintptr
*
,
int32
);
int32
runtime
·
gentraceback
(
byte
*
,
byte
*
,
byte
*
,
G
*
,
int32
,
uintptr
*
,
int32
);
...
...
src/pkg/runtime/signal_windows_386.c
View file @
07a2989d
...
...
@@ -24,12 +24,6 @@ runtime·dumpregs(Context *r)
runtime
·
printf
(
"gs %x
\n
"
,
r
->
SegGs
);
}
void
runtime
·
initsig
(
void
)
{
runtime
·
siginit
();
}
uint32
runtime
·
sighandler
(
ExceptionRecord
*
info
,
Context
*
r
,
G
*
gp
)
{
...
...
src/pkg/runtime/signal_windows_amd64.c
View file @
07a2989d
...
...
@@ -6,8 +6,6 @@
#include "defs_GOOS_GOARCH.h"
#include "os_GOOS.h"
extern
void
*
runtime
·
sigtramp
;
void
runtime
·
dumpregs
(
Context
*
r
)
{
...
...
@@ -34,16 +32,6 @@ runtime·dumpregs(Context *r)
runtime
·
printf
(
"gs %X
\n
"
,
(
uint64
)
r
->
SegGs
);
}
void
runtime
·
initsig
(
void
)
{
runtime
·
siginit
();
// following line keeps sigtramp alive at link stage
// if there's a better way please write it here
void
*
p
=
runtime
·
sigtramp
;
USED
(
p
);
}
uint32
runtime
·
sighandler
(
ExceptionRecord
*
info
,
Context
*
r
,
G
*
gp
)
{
...
...
src/pkg/runtime/sigqueue.goc
View file @
07a2989d
...
...
@@ -11,7 +11,7 @@
//
//
Ownership
for
sig
.
Note
passes
back
and
forth
between
//
the
signal
handler
and
the
signal
goroutine
in
rounds
.
//
The
initial
state
is
that
sig
.
note
is
cleared
(
setup
by
sig
init
).
//
The
initial
state
is
that
sig
.
note
is
cleared
(
setup
by
sig
nal_enable
).
//
At
the
beginning
of
each
round
,
mask
==
0.
//
The
round
goes
through
three
stages
:
//
...
...
src/pkg/runtime/thread_windows.c
View file @
07a2989d
...
...
@@ -291,6 +291,17 @@ runtime·sigpanic(void)
runtime
·
throw
(
"fault"
);
}
extern
void
*
runtime
·
sigtramp
;
void
runtime
·
initsig
(
void
)
{
// following line keeps sigtramp alive at link stage
// if there's a better way please write it here
void
*
p
=
runtime
·
sigtramp
;
USED
(
p
);
}
String
runtime
·
signame
(
int32
sig
)
{
...
...
src/pkg/syscall/syscall_windows.go
View file @
07a2989d
...
...
@@ -610,7 +610,7 @@ func (w WaitStatus) Exited() bool { return true }
func
(
w
WaitStatus
)
ExitStatus
()
int
{
return
int
(
w
.
ExitCode
)
}
func
(
w
WaitStatus
)
Signal
()
int
{
return
-
1
}
func
(
w
WaitStatus
)
Signal
()
Signal
{
return
-
1
}
func
(
w
WaitStatus
)
CoreDump
()
bool
{
return
false
}
...
...
@@ -618,7 +618,7 @@ func (w WaitStatus) Stopped() bool { return false }
func
(
w
WaitStatus
)
Continued
()
bool
{
return
false
}
func
(
w
WaitStatus
)
StopSignal
()
int
{
return
-
1
}
func
(
w
WaitStatus
)
StopSignal
()
Signal
{
return
-
1
}
func
(
w
WaitStatus
)
Signaled
()
bool
{
return
false
}
...
...
@@ -685,3 +685,17 @@ func Geteuid() (euid int) { return -1 }
func
Getgid
()
(
gid
int
)
{
return
-
1
}
func
Getegid
()
(
egid
int
)
{
return
-
1
}
func
Getgroups
()
(
gids
[]
int
,
err
error
)
{
return
nil
,
EWINDOWS
}
type
Signal
int
func
(
s
Signal
)
Signal
()
{}
func
(
s
Signal
)
String
()
string
{
if
0
<=
s
&&
int
(
s
)
<
len
(
signals
)
{
str
:=
signals
[
s
]
if
str
!=
""
{
return
str
}
}
return
"signal "
+
itoa
(
int
(
s
))
}
src/pkg/syscall/ztypes_windows.go
View file @
07a2989d
...
...
@@ -38,21 +38,39 @@ const (
const
(
// More invented values for signals
SIGHUP
=
0x1
SIGINT
=
0x2
SIGQUIT
=
0x3
SIGILL
=
0x4
SIGTRAP
=
0x5
SIGABRT
=
0x6
SIGBUS
=
0x7
SIGFPE
=
0x8
SIGKILL
=
0x9
SIGSEGV
=
0xb
SIGPIPE
=
0xd
SIGALRM
=
0xe
SIGTERM
=
0xf
SIGHUP
=
Signal
(
0x1
)
SIGINT
=
Signal
(
0x2
)
SIGQUIT
=
Signal
(
0x3
)
SIGILL
=
Signal
(
0x4
)
SIGTRAP
=
Signal
(
0x5
)
SIGABRT
=
Signal
(
0x6
)
SIGBUS
=
Signal
(
0x7
)
SIGFPE
=
Signal
(
0x8
)
SIGKILL
=
Signal
(
0x9
)
SIGSEGV
=
Signal
(
0xb
)
SIGPIPE
=
Signal
(
0xd
)
SIGALRM
=
Signal
(
0xe
)
SIGTERM
=
Signal
(
0xf
)
)
var
signals
=
[
...
]
string
{
1
:
"hangup"
,
2
:
"interrupt"
,
3
:
"quit"
,
4
:
"illegal instruction"
,
5
:
"trace/breakpoint trap"
,
6
:
"aborted"
,
7
:
"bus error"
,
8
:
"floating point exception"
,
9
:
"killed"
,
10
:
"user defined signal 1"
,
11
:
"segmentation fault"
,
12
:
"user defined signal 2"
,
13
:
"broken pipe"
,
14
:
"alarm clock"
,
15
:
"terminated"
,
}
const
(
GENERIC_READ
=
0x80000000
GENERIC_WRITE
=
0x40000000
...
...
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