Commit 0d37998a authored by Alex Brainman's avatar Alex Brainman Committed by Russ Cox

syscall: make windows build again after d3963c0fca78 change

R=rsc, mikioh.mikioh
CC=golang-dev
https://golang.org/cl/5373097
parent d03611f6
...@@ -8,6 +8,7 @@ import ( ...@@ -8,6 +8,7 @@ import (
"errors" "errors"
"runtime" "runtime"
"syscall" "syscall"
"unsafe"
) )
func (p *Process) Wait(options int) (w *Waitmsg, err error) { func (p *Process) Wait(options int) (w *Waitmsg, err error) {
...@@ -68,14 +69,14 @@ func FindProcess(pid int) (p *Process, err error) { ...@@ -68,14 +69,14 @@ func FindProcess(pid int) (p *Process, err error) {
func init() { func init() {
var argc int32 var argc int32
cmd := GetCommandLine() cmd := syscall.GetCommandLine()
argv, e := CommandLineToArgv(cmd, &argc) argv, e := syscall.CommandLineToArgv(cmd, &argc)
if e != nil { if e != nil {
return return
} }
defer LocalFree(Handle(uintptr(unsafe.Pointer(argv)))) defer syscall.LocalFree(syscall.Handle(uintptr(unsafe.Pointer(argv))))
Args = make([]string, argc) Args = make([]string, argc)
for i, v := range (*argv)[:argc] { for i, v := range (*argv)[:argc] {
Args[i] = string(UTF16ToString((*v)[:])) Args[i] = string(syscall.UTF16ToString((*v)[:]))
} }
} }
...@@ -9,6 +9,7 @@ import ( ...@@ -9,6 +9,7 @@ import (
"runtime" "runtime"
"sync" "sync"
"syscall" "syscall"
"unicode/utf16"
) )
// File represents an open file descriptor. // File represents an open file descriptor.
...@@ -299,7 +300,7 @@ func Pipe() (r *File, w *File, err error) { ...@@ -299,7 +300,7 @@ func Pipe() (r *File, w *File, err error) {
// TempDir returns the default directory to use for temporary files. // TempDir returns the default directory to use for temporary files.
func TempDir() string { func TempDir() string {
const pathSep = '\\' const pathSep = '\\'
dirw := make([]uint16, MAX_PATH) dirw := make([]uint16, syscall.MAX_PATH)
n, _ := syscall.GetTempPath(uint32(len(dirw)), &dirw[0]) n, _ := syscall.GetTempPath(uint32(len(dirw)), &dirw[0])
if n > uint32(len(dirw)) { if n > uint32(len(dirw)) {
dirw = make([]uint16, n) dirw = make([]uint16, n)
......
...@@ -81,7 +81,7 @@ runtime·osinit(void) ...@@ -81,7 +81,7 @@ runtime·osinit(void)
void void
runtime·goenvs(void) runtime·goenvs(void)
{ {
extern Slice os·Envs; extern Slice syscall·envs;
uint16 *env; uint16 *env;
String *s; String *s;
...@@ -101,9 +101,9 @@ runtime·goenvs(void) ...@@ -101,9 +101,9 @@ runtime·goenvs(void)
s[i] = runtime·gostringw(p); s[i] = runtime·gostringw(p);
p += runtime·findnullw(p)+1; p += runtime·findnullw(p)+1;
} }
os·Envs.array = (byte*)s; syscall·envs.array = (byte*)s;
os·Envs.len = n; syscall·envs.len = n;
os·Envs.cap = n; syscall·envs.cap = n;
runtime·stdcall(runtime·FreeEnvironmentStringsW, 1, env); runtime·stdcall(runtime·FreeEnvironmentStringsW, 1, env);
} }
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
package syscall package syscall
import ( import (
"errors"
"unicode/utf16" "unicode/utf16"
"unsafe" "unsafe"
) )
......
...@@ -158,7 +158,7 @@ main(void) ...@@ -158,7 +158,7 @@ main(void)
printf("\n// Go names for Windows errors.\n"); printf("\n// Go names for Windows errors.\n");
printf("const (\n"); printf("const (\n");
for(i=0; i<nelem(goerrors); i++) { for(i=0; i<nelem(goerrors); i++) {
printf("\t%s = %s\n", goerrors[i].goname, goerrors[i].winname); printf("\t%s Errno = %s\n", goerrors[i].goname, goerrors[i].winname);
} }
printf(")\n"); printf(")\n");
...@@ -171,7 +171,7 @@ main(void) ...@@ -171,7 +171,7 @@ main(void)
for(i=0; i<nelem(errors); i++) { for(i=0; i<nelem(errors); i++) {
printf("\t%s", errors[i].name); printf("\t%s", errors[i].name);
if(iota) { if(iota) {
printf(" = APPLICATION_ERROR + iota"); printf(" Errno = APPLICATION_ERROR + iota");
iota = !iota; iota = !iota;
} }
printf("\n"); printf("\n");
......
...@@ -357,11 +357,6 @@ func Gettimeofday(tv *Timeval) (err error) { ...@@ -357,11 +357,6 @@ func Gettimeofday(tv *Timeval) (err error) {
return nil return nil
} }
func Sleep(nsec int64) (err error) {
sleep(uint32((nsec + 1e6 - 1) / 1e6)) // round up to milliseconds
return nil
}
func Pipe(p []Handle) (err error) { func Pipe(p []Handle) (err error) {
if len(p) != 2 { if len(p) != 2 {
return EINVAL return EINVAL
......
// mkerrors_windows.sh -f -m32 // mkerrors_windows.sh -m32
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
package syscall package syscall
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment