Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -r 6053abaa495b src/pkg/syscall/zerrors_windows_386.go
- --- a/src/pkg/syscall/zerrors_windows_386.go Thu Oct 21 10:47:02 2010 +1100
- +++ b/src/pkg/syscall/zerrors_windows_386.go Thu Oct 21 09:49:04 2010 +0900
- @@ -12,6 +12,18 @@
- // Windows reserves errors >= 1<<29 for application use.
- const APPLICATION_ERROR = 1 << 29
- +// Signal values.
- +const (
- + SIGINT = 0x2
- + SIGILL = 0x4
- + SIGFPE = 0x8
- + SIGKILL = 0x9
- + SIGSEGV = 0xb
- + SIGTERM = 0xf
- + SIGBREAK = 0x15
- + SIGABRT = 0x16
- +)
- +
- // Invented values to support what package os and others expects.
- const (
- E2BIG = APPLICATION_ERROR + iota
- diff -r 6053abaa495b src/pkg/syscall/zsyscall_windows_386.go
- --- a/src/pkg/syscall/zsyscall_windows_386.go Thu Oct 21 10:47:02 2010 +1100
- +++ b/src/pkg/syscall/zsyscall_windows_386.go Thu Oct 21 09:49:04 2010 +0900
- @@ -60,6 +60,7 @@
- procGetEnvironmentVariableW = getSysProcAddr(modkernel32, "GetEnvironmentVariableW")
- procSetEnvironmentVariableW = getSysProcAddr(modkernel32, "SetEnvironmentVariableW")
- procSetFileTime = getSysProcAddr(modkernel32, "SetFileTime")
- + procTerminateProcess = getSysProcAddr(modkernel32, "TerminateProcess")
- procWSAStartup = getSysProcAddr(modwsock32, "WSAStartup")
- procWSACleanup = getSysProcAddr(modwsock32, "WSACleanup")
- procsocket = getSysProcAddr(modwsock32, "socket")
- @@ -786,6 +787,34 @@
- return
- }
- +func TerminateProcess(h int32, c uint32) (ok bool, errno int) {
- + r0, _, e1 := Syscall(procTerminateProcess, uintptr(h), uintptr(c), 0)
- + ok = bool(r0 != 0)
- + if !ok {
- + if e1 != 0 {
- + errno = int(e1)
- + } else {
- + errno = EINVAL
- + }
- + } else {
- + errno = 0
- + }
- + return
- +}
- +
- +func Kill(pid int, sig int) (errno int) {
- + if sig != SIGKILL { // TODO(mattn): meaning/treating SIGKILL
- + return ENOSYS
- + }
- + handle, errno := OpenProcess(PROCESS_ALL_ACCESS, 0, uint32(pid))
- + if errno != 0 {
- + return errno
- + }
- + defer CloseHandle(int32(handle))
- + _, errno = TerminateProcess(int32(handle), 0)
- + return
- +}
- +
- func WSAStartup(verreq uint32, data *WSAData) (sockerrno int) {
- r0, _, _ := Syscall(procWSAStartup, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0)
- sockerrno = int(r0)
- diff -r 6053abaa495b src/pkg/syscall/ztypes_windows_386.go
- --- a/src/pkg/syscall/ztypes_windows_386.go Thu Oct 21 10:47:02 2010 +1100
- +++ b/src/pkg/syscall/ztypes_windows_386.go Thu Oct 21 09:49:04 2010 +0900
- @@ -481,5 +481,7 @@
- HANDLE_FLAG_INHERIT = 0x00000001
- HANDLE_FLAG_PROTECT_FROM_CLOSE = 0x00000002
- - PROCESS_ALL_ACCESS = 0x001fffff
- + SYNCHRONIZE = 0x100000
- + STANDARD_RIGHTS_REQUIRED = 0xf0000
- + PROCESS_ALL_ACCESS = (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0xfff)
- )
Add Comment
Please, Sign In to add comment