From: Alex Brainman Date: Mon, 25 Jul 2011 16:25:23 +0000 (-0400) Subject: syscall: remove unused windows code and comments X-Git-Tag: weekly.2011-07-29~64 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=770543107d64088cdcfc875dde9c2d867d89946e;p=gostls13.git syscall: remove unused windows code and comments R=golang-dev, vcc.163, rsc CC=golang-dev https://golang.org/cl/4826042 --- diff --git a/src/pkg/syscall/syscall_windows.go b/src/pkg/syscall/syscall_windows.go index 70955b94bf..9b1a9deddf 100644 --- a/src/pkg/syscall/syscall_windows.go +++ b/src/pkg/syscall/syscall_windows.go @@ -76,7 +76,7 @@ func StringToUTF16Ptr(s string) *uint16 { return &StringToUTF16(s)[0] } // dll helpers -// implemented in ../runtime/windows/syscall.cgo +// Implemented in ../runtime/windows/syscall.goc func Syscall(trap, nargs, a1, a2, a3 uintptr) (r1, r2, err uintptr) func Syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) func Syscall9(trap, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2, err uintptr) @@ -105,14 +105,9 @@ func Getpagesize() int { return 4096 } // Converts a Go function to a function pointer conforming // to the stdcall calling convention. This is useful when // interoperating with Windows code requiring callbacks. -// Implemented in ../runtime/windows/syscall.cgo +// Implemented in ../runtime/windows/syscall.goc func NewCallback(fn interface{}) uintptr -// TODO -func Sendfile(outfd int, infd int, offset *int64, count int) (written int, errno int) { - return -1, ENOSYS -} - // windows api calls //sys GetLastError() (lasterrno int) @@ -728,24 +723,3 @@ func Geteuid() (euid int) { return -1 } func Getgid() (gid int) { return -1 } func Getegid() (egid int) { return -1 } func Getgroups() (gids []int, errno int) { return nil, EWINDOWS } - -// TODO(brainman): fix all this meaningless code, it is here to compile exec.go - -func read(fd Handle, buf *byte, nbuf int) (n int, errno int) { - return 0, EWINDOWS -} - -func fcntl(fd Handle, cmd, arg int) (val int, errno int) { - return 0, EWINDOWS -} - -const ( - PTRACE_TRACEME = 1 + iota - WNOHANG - WSTOPPED - WUNTRACED - SYS_CLOSE - SYS_WRITE - SYS_EXIT - SYS_READ -) diff --git a/src/pkg/syscall/ztypes_windows.go b/src/pkg/syscall/ztypes_windows.go index 2943df580c..10780f7672 100644 --- a/src/pkg/syscall/ztypes_windows.go +++ b/src/pkg/syscall/ztypes_windows.go @@ -1,22 +1,5 @@ package syscall -// TODO(brainman): autogenerate types in ztypes_windows_386.go - -//import "unsafe" - -// Constants -const ( - sizeofPtr = 0x4 - sizeofShort = 0x2 - sizeofInt = 0x4 - sizeofLong = 0x4 - sizeofLongLong = 0x8 - PathMax = 0x1000 - SizeofLinger = 0x8 - SizeofMsghdr = 0x1c - SizeofCmsghdr = 0xc -) - const ( // Windows errors. ERROR_FILE_NOT_FOUND = 2 @@ -179,16 +162,6 @@ const ( CRYPT_DEFAULT_CONTAINER_OPTIONAL = 0x00000080 ) -// Types - -type _C_short int16 - -type _C_int int32 - -type _C_long int32 - -type _C_long_long int64 - // Invented values to support what package os expects. type Timeval struct { Sec int32 @@ -393,38 +366,23 @@ type WSABuf struct { Buf *byte } -// TODO(brainman): fix all needed for os - +// Invented values to support what package os expects. const ( - PROT_READ = 0x1 - PROT_WRITE = 0x2 - MAP_SHARED = 0x1 - SYS_FORK = 0 - SYS_PTRACE = 0 - SYS_CHDIR = 0 - SYS_DUP2 = 0 - SYS_FCNTL = 0 - SYS_EXECVE = 0 - F_GETFD = 0x1 - F_SETFD = 0x2 - F_GETFL = 0x3 - F_SETFL = 0x4 - FD_CLOEXEC = 0 - S_IFMT = 0x1f000 - S_IFIFO = 0x1000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFBLK = 0x6000 - S_IFREG = 0x8000 - S_IFLNK = 0xa000 - S_IFSOCK = 0xc000 - S_ISUID = 0x800 - S_ISGID = 0x400 - S_ISVTX = 0x200 - S_IRUSR = 0x100 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXUSR = 0x40 + S_IFMT = 0x1f000 + S_IFIFO = 0x1000 + S_IFCHR = 0x2000 + S_IFDIR = 0x4000 + S_IFBLK = 0x6000 + S_IFREG = 0x8000 + S_IFLNK = 0xa000 + S_IFSOCK = 0xc000 + S_ISUID = 0x800 + S_ISGID = 0x400 + S_ISVTX = 0x200 + S_IRUSR = 0x100 + S_IWRITE = 0x80 + S_IWUSR = 0x80 + S_IXUSR = 0x40 ) const (