diff options
Diffstat (limited to 'src/pkg/syscall')
64 files changed, 4922 insertions, 2181 deletions
diff --git a/src/pkg/syscall/Makefile b/src/pkg/syscall/Makefile index 9284fcc5d..212b6f85d 100644 --- a/src/pkg/syscall/Makefile +++ b/src/pkg/syscall/Makefile @@ -17,24 +17,32 @@ GOFILES=\ ztypes_$(GOOS)_$(GOARCH).go\ GOFILES_freebsd=\ + bpf_bsd.go\ exec_unix.go\ route_bsd.go\ + sockcmsg_unix.go\ syscall_bsd.go\ syscall_unix.go\ GOFILES_darwin=\ + bpf_bsd.go\ exec_unix.go\ route_bsd.go\ + sockcmsg_unix.go\ syscall_bsd.go\ syscall_unix.go\ GOFILES_linux=\ exec_unix.go\ + lsf_linux.go\ netlink_linux.go\ + sockcmsg_unix.go\ syscall_unix.go\ GOFILES_windows=\ exec_windows.go\ + zerrors_windows.go\ + ztypes_windows.go\ GOFILES_plan9=\ exec_plan9.go\ diff --git a/src/pkg/syscall/asm_windows_386.s b/src/pkg/syscall/asm_windows_386.s index 3d9f6fc94..a7b95643d 100644 --- a/src/pkg/syscall/asm_windows_386.s +++ b/src/pkg/syscall/asm_windows_386.s @@ -3,5 +3,5 @@ // license that can be found in the LICENSE file. // -// System calls for 386, Windows are implemented in ../runtime/windows/syscall.cgo +// System calls for 386, Windows are implemented in ../runtime/windows/syscall.goc // diff --git a/src/pkg/syscall/asm_windows_amd64.s b/src/pkg/syscall/asm_windows_amd64.s new file mode 100644 index 000000000..8b38710c7 --- /dev/null +++ b/src/pkg/syscall/asm_windows_amd64.s @@ -0,0 +1,7 @@ +// 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. + +// +// System calls for amd64, Windows are implemented in ../runtime/windows/syscall.goc +// diff --git a/src/pkg/syscall/bpf_bsd.go b/src/pkg/syscall/bpf_bsd.go new file mode 100644 index 000000000..1eac9a3d8 --- /dev/null +++ b/src/pkg/syscall/bpf_bsd.go @@ -0,0 +1,167 @@ +// Copyright 2011 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. + +// Berkeley packet filter for BSD variants + +package syscall + +import ( + "unsafe" +) + +func BpfStmt(code, k int) *BpfInsn { + return &BpfInsn{Code: uint16(code), K: uint32(k)} +} + +func BpfJump(code, k, jt, jf int) *BpfInsn { + return &BpfInsn{Code: uint16(code), Jt: uint8(jt), Jf: uint8(jf), K: uint32(k)} +} + +func BpfBuflen(fd int) (int, int) { + var l int + _, _, ep := Syscall(SYS_IOCTL, uintptr(fd), BIOCGBLEN, uintptr(unsafe.Pointer(&l))) + if e := int(ep); e != 0 { + return 0, e + } + return l, 0 +} + +func SetBpfBuflen(fd, l int) (int, int) { + _, _, ep := Syscall(SYS_IOCTL, uintptr(fd), BIOCSBLEN, uintptr(unsafe.Pointer(&l))) + if e := int(ep); e != 0 { + return 0, e + } + return l, 0 +} + +func BpfDatalink(fd int) (int, int) { + var t int + _, _, ep := Syscall(SYS_IOCTL, uintptr(fd), BIOCGDLT, uintptr(unsafe.Pointer(&t))) + if e := int(ep); e != 0 { + return 0, e + } + return t, 0 +} + +func SetBpfDatalink(fd, t int) (int, int) { + _, _, ep := Syscall(SYS_IOCTL, uintptr(fd), BIOCSDLT, uintptr(unsafe.Pointer(&t))) + if e := int(ep); e != 0 { + return 0, e + } + return t, 0 +} + +func SetBpfPromisc(fd, m int) int { + _, _, ep := Syscall(SYS_IOCTL, uintptr(fd), BIOCPROMISC, uintptr(unsafe.Pointer(&m))) + if e := int(ep); e != 0 { + return e + } + return 0 +} + +func FlushBpf(fd int) int { + _, _, ep := Syscall(SYS_IOCTL, uintptr(fd), BIOCFLUSH, 0) + if e := int(ep); e != 0 { + return e + } + return 0 +} + +type ivalue struct { + name [IFNAMSIZ]byte + value int16 +} + +func BpfInterface(fd int, name string) (string, int) { + var iv ivalue + _, _, ep := Syscall(SYS_IOCTL, uintptr(fd), BIOCGETIF, uintptr(unsafe.Pointer(&iv))) + if e := int(ep); e != 0 { + return "", e + } + return name, 0 +} + +func SetBpfInterface(fd int, name string) int { + var iv ivalue + copy(iv.name[:], []byte(name)) + _, _, ep := Syscall(SYS_IOCTL, uintptr(fd), BIOCSETIF, uintptr(unsafe.Pointer(&iv))) + if e := int(ep); e != 0 { + return e + } + return 0 +} + +func BpfTimeout(fd int) (*Timeval, int) { + var tv Timeval + _, _, ep := Syscall(SYS_IOCTL, uintptr(fd), BIOCGRTIMEOUT, uintptr(unsafe.Pointer(&tv))) + if e := int(ep); e != 0 { + return nil, e + } + return &tv, 0 +} + +func SetBpfTimeout(fd int, tv *Timeval) int { + _, _, ep := Syscall(SYS_IOCTL, uintptr(fd), BIOCSRTIMEOUT, uintptr(unsafe.Pointer(tv))) + if e := int(ep); e != 0 { + return e + } + return 0 +} + +func BpfStats(fd int) (*BpfStat, int) { + var s BpfStat + _, _, ep := Syscall(SYS_IOCTL, uintptr(fd), BIOCGSTATS, uintptr(unsafe.Pointer(&s))) + if e := int(ep); e != 0 { + return nil, e + } + return &s, 0 +} + +func SetBpfImmediate(fd, m int) int { + _, _, ep := Syscall(SYS_IOCTL, uintptr(fd), BIOCIMMEDIATE, uintptr(unsafe.Pointer(&m))) + if e := int(ep); e != 0 { + return e + } + return 0 +} + +func SetBpf(fd int, i []BpfInsn) int { + var p BpfProgram + p.Len = uint32(len(i)) + p.Insns = (*BpfInsn)(unsafe.Pointer(&i[0])) + _, _, ep := Syscall(SYS_IOCTL, uintptr(fd), BIOCSETF, uintptr(unsafe.Pointer(&p))) + if e := int(ep); e != 0 { + return e + } + return 0 +} + +func CheckBpfVersion(fd int) int { + var v BpfVersion + _, _, ep := Syscall(SYS_IOCTL, uintptr(fd), BIOCVERSION, uintptr(unsafe.Pointer(&v))) + if e := int(ep); e != 0 { + return e + } + if v.Major != BPF_MAJOR_VERSION || v.Minor != BPF_MINOR_VERSION { + return EINVAL + } + return 0 +} + +func BpfHeadercmpl(fd int) (int, int) { + var f int + _, _, ep := Syscall(SYS_IOCTL, uintptr(fd), BIOCGHDRCMPLT, uintptr(unsafe.Pointer(&f))) + if e := int(ep); e != 0 { + return 0, e + } + return f, 0 +} + +func SetBpfHeadercmpl(fd, f int) int { + _, _, ep := Syscall(SYS_IOCTL, uintptr(fd), BIOCSHDRCMPLT, uintptr(unsafe.Pointer(&f))) + if e := int(ep); e != 0 { + return e + } + return 0 +} diff --git a/src/pkg/syscall/exec_plan9.go b/src/pkg/syscall/exec_plan9.go index 962b39b78..66ab1fced 100644 --- a/src/pkg/syscall/exec_plan9.go +++ b/src/pkg/syscall/exec_plan9.go @@ -62,7 +62,7 @@ var ForkLock sync.RWMutex // Convert array of string to array // of NUL-terminated byte pointer. -func StringArrayPtr(ss []string) []*byte { +func StringSlicePtr(ss []string) []*byte { bb := make([]*byte, len(ss)+1) for i := 0; i < len(ss); i++ { bb[i] = StringBytePtr(ss[i]) @@ -169,7 +169,7 @@ func init() { // no rescheduling, no malloc calls, and no new stack segments. // The calls to RawSyscall are okay because they are assembly // functions that do not grow the stack. -func forkAndExecInChild(argv0 *byte, argv []*byte, envv []envItem, chroot, dir *byte, attr *ProcAttr, fdsToClose []int, pipe int) (pid int, err Error) { +func forkAndExecInChild(argv0 *byte, argv []*byte, envv []envItem, dir *byte, attr *ProcAttr, fdsToClose []int, pipe int, rflag int) (pid int, err Error) { // Declare all variables at top in case any // declarations require heap allocation (e.g., errbuf). var ( @@ -190,7 +190,7 @@ func forkAndExecInChild(argv0 *byte, argv []*byte, envv []envItem, chroot, dir * // About to call fork. // No more allocation or calls of non-assembly functions. - r1, _, _ = RawSyscall(SYS_RFORK, uintptr(RFPROC|RFFDG|RFREND|clearenv), 0, 0) + r1, _, _ = RawSyscall(SYS_RFORK, uintptr(RFPROC|RFFDG|RFREND|clearenv|rflag), 0, 0) if r1 != 0 { if int(r1) == -1 { @@ -338,14 +338,18 @@ type envItem struct { } type ProcAttr struct { - Dir string // Current working directory. - Env []string // Environment. - Files []int // File descriptors. - Chroot string // Chroot. + Dir string // Current working directory. + Env []string // Environment. + Files []int // File descriptors. + Sys *SysProcAttr } -var zeroAttributes ProcAttr +type SysProcAttr struct { + Rfork int // additional flags to pass to rfork +} +var zeroProcAttr ProcAttr +var zeroSysProcAttr SysProcAttr func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err Error) { var ( @@ -356,7 +360,11 @@ func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err Error) ) if attr == nil { - attr = &zeroAttributes + attr = &zeroProcAttr + } + sys := attr.Sys + if sys == nil { + sys = &zeroSysProcAttr } p[0] = -1 @@ -364,12 +372,8 @@ func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err Error) // Convert args to C form. argv0p := StringBytePtr(argv0) - argvp := StringArrayPtr(argv) + argvp := StringSlicePtr(argv) - var chroot *byte - if attr.Chroot != "" { - chroot = StringBytePtr(attr.Chroot) - } var dir *byte if attr.Dir != "" { dir = StringBytePtr(attr.Dir) @@ -439,7 +443,7 @@ func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err Error) fdsToClose = append(fdsToClose, p[0]) // Kick off child. - pid, err = forkAndExecInChild(argv0p, argvp, envvParsed, chroot, dir, attr, fdsToClose, p[1]) + pid, err = forkAndExecInChild(argv0p, argvp, envvParsed, dir, attr, fdsToClose, p[1], sys.Rfork) if err != nil { if p[0] >= 0 { @@ -514,7 +518,7 @@ func Exec(argv0 string, argv []string, envv []string) (err Error) { _, _, e := Syscall(SYS_EXEC, uintptr(unsafe.Pointer(StringBytePtr(argv0))), - uintptr(unsafe.Pointer(&StringArrayPtr(argv)[0])), + uintptr(unsafe.Pointer(&StringSlicePtr(argv)[0])), 0) return NewError(e) diff --git a/src/pkg/syscall/exec_unix.go b/src/pkg/syscall/exec_unix.go index b6cb1baa2..46f05efef 100644 --- a/src/pkg/syscall/exec_unix.go +++ b/src/pkg/syscall/exec_unix.go @@ -62,7 +62,7 @@ var ForkLock sync.RWMutex // Convert array of string to array // of NUL-terminated byte pointer. -func StringArrayPtr(ss []string) []*byte { +func StringSlicePtr(ss []string) []*byte { bb := make([]*byte, len(ss)+1) for i := 0; i < len(ss); i++ { bb[i] = StringBytePtr(ss[i]) @@ -96,7 +96,7 @@ func SetNonblock(fd int, nonblocking bool) (errno int) { // no rescheduling, no malloc calls, and no new stack segments. // The calls to RawSyscall are okay because they are assembly // functions that do not grow the stack. -func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr *ProcAttr, pipe int) (pid int, err int) { +func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr *ProcAttr, sys *SysProcAttr, pipe int) (pid int, err int) { // Declare all variables at top in case any // declarations require heap allocation (e.g., err1). var r1, r2, err1 uintptr @@ -131,7 +131,7 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr // Fork succeeded, now in child. // Enable tracing if requested. - if attr.Ptrace { + if sys.Ptrace { _, _, err1 = RawSyscall(SYS_PTRACE, uintptr(PTRACE_TRACEME), 0, 0) if err1 != 0 { goto childerror @@ -139,13 +139,21 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr } // Session ID - if attr.Setsid { + if sys.Setsid { _, _, err1 = RawSyscall(SYS_SETSID, 0, 0, 0) if err1 != 0 { goto childerror } } + // Set process group + if sys.Setpgid { + _, _, err1 = RawSyscall(SYS_SETPGID, 0, 0, 0) + if err1 != 0 { + goto childerror + } + } + // Chroot if chroot != nil { _, _, err1 = RawSyscall(SYS_CHROOT, uintptr(unsafe.Pointer(chroot)), 0, 0) @@ -155,21 +163,21 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr } // User and groups - if attr.Credential != nil { - ngroups := uintptr(len(attr.Credential.Groups)) + if cred := sys.Credential; cred != nil { + ngroups := uintptr(len(cred.Groups)) groups := uintptr(0) if ngroups > 0 { - groups = uintptr(unsafe.Pointer(&attr.Credential.Groups[0])) + groups = uintptr(unsafe.Pointer(&cred.Groups[0])) } _, _, err1 = RawSyscall(SYS_SETGROUPS, ngroups, groups, 0) if err1 != 0 { goto childerror } - _, _, err1 = RawSyscall(SYS_SETGID, uintptr(attr.Credential.Gid), 0, 0) + _, _, err1 = RawSyscall(SYS_SETGID, uintptr(cred.Gid), 0, 0) if err1 != 0 { goto childerror } - _, _, err1 = RawSyscall(SYS_SETUID, uintptr(attr.Credential.Uid), 0, 0) + _, _, err1 = RawSyscall(SYS_SETUID, uintptr(cred.Uid), 0, 0) if err1 != 0 { goto childerror } @@ -241,6 +249,22 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr RawSyscall(SYS_CLOSE, uintptr(i), 0, 0) } + // Detach fd 0 from tty + if sys.Noctty { + _, _, err1 = RawSyscall(SYS_IOCTL, 0, uintptr(TIOCNOTTY), 0) + if err1 != 0 { + goto childerror + } + } + + // Make fd 0 the tty + if sys.Setctty { + _, _, err1 = RawSyscall(SYS_IOCTL, 0, uintptr(TIOCSCTTY), 0) + if err1 != 0 { + goto childerror + } + } + // Time to exec. _, _, err1 = RawSyscall(SYS_EXECVE, uintptr(unsafe.Pointer(argv0)), @@ -249,7 +273,7 @@ func forkAndExecInChild(argv0 *byte, argv, envv []*byte, chroot, dir *byte, attr childerror: // send error code on pipe - RawSyscall(SYS_WRITE, uintptr(pipe), uintptr(unsafe.Pointer(&err1)), uintptr(unsafe.Sizeof(err1))) + RawSyscall(SYS_WRITE, uintptr(pipe), uintptr(unsafe.Pointer(&err1)), unsafe.Sizeof(err1)) for { RawSyscall(SYS_EXIT, 253, 0, 0) } @@ -260,23 +284,35 @@ childerror: panic("unreached") } +// Credential holds user and group identities to be assumed +// by a child process started by StartProcess. type Credential struct { Uid uint32 // User ID. Gid uint32 // Group ID. Groups []uint32 // Supplementary group IDs. } +// ProcAttr holds attributes that will be applied to a new process started +// by StartProcess. type ProcAttr struct { - Setsid bool // Create session. - Ptrace bool // Enable tracing. - Dir string // Current working directory. - Env []string // Environment. - Files []int // File descriptors. + Dir string // Current working directory. + Env []string // Environment. + Files []int // File descriptors. + Sys *SysProcAttr +} + +type SysProcAttr struct { Chroot string // Chroot. Credential *Credential // Credential. + Ptrace bool // Enable tracing. + Setsid bool // Create session. + Setpgid bool // Set process group ID to new pid (SYSV setpgrp) + Setctty bool // Set controlling terminal to fd 0 + Noctty bool // Detach fd 0 from controlling terminal } -var zeroAttributes ProcAttr +var zeroProcAttr ProcAttr +var zeroSysProcAttr SysProcAttr func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err int) { var p [2]int @@ -285,7 +321,11 @@ func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err int) { var wstatus WaitStatus if attr == nil { - attr = &zeroAttributes + attr = &zeroProcAttr + } + sys := attr.Sys + if sys == nil { + sys = &zeroSysProcAttr } p[0] = -1 @@ -293,16 +333,16 @@ func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err int) { // Convert args to C form. argv0p := StringBytePtr(argv0) - argvp := StringArrayPtr(argv) - envvp := StringArrayPtr(attr.Env) + argvp := StringSlicePtr(argv) + envvp := StringSlicePtr(attr.Env) if OS == "freebsd" && len(argv[0]) > len(argv0) { argvp[0] = argv0p } var chroot *byte - if attr.Chroot != "" { - chroot = StringBytePtr(attr.Chroot) + if sys.Chroot != "" { + chroot = StringBytePtr(sys.Chroot) } var dir *byte if attr.Dir != "" { @@ -326,24 +366,18 @@ func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err int) { } // Kick off child. - pid, err = forkAndExecInChild(argv0p, argvp, envvp, chroot, dir, attr, p[1]) + pid, err = forkAndExecInChild(argv0p, argvp, envvp, chroot, dir, attr, sys, p[1]) if err != 0 { - error: - if p[0] >= 0 { - Close(p[0]) - Close(p[1]) - } - ForkLock.Unlock() - return 0, err + goto error } ForkLock.Unlock() // Read child error status from pipe. Close(p[1]) - n, err = read(p[0], (*byte)(unsafe.Pointer(&err1)), unsafe.Sizeof(err1)) + n, err = read(p[0], (*byte)(unsafe.Pointer(&err1)), int(unsafe.Sizeof(err1))) Close(p[0]) if err != 0 || n != 0 { - if n == unsafe.Sizeof(err1) { + if n == int(unsafe.Sizeof(err1)) { err = int(err1) } if err == 0 { @@ -361,6 +395,14 @@ func forkExec(argv0 string, argv []string, attr *ProcAttr) (pid int, err int) { // Read got EOF, so pipe closed on exec, so exec succeeded. return pid, 0 + +error: + if p[0] >= 0 { + Close(p[0]) + Close(p[1]) + } + ForkLock.Unlock() + return 0, err } // Combination of fork and exec, careful to be thread safe. @@ -378,7 +420,7 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid, handle int, func Exec(argv0 string, argv []string, envv []string) (err int) { _, _, err1 := RawSyscall(SYS_EXECVE, uintptr(unsafe.Pointer(StringBytePtr(argv0))), - uintptr(unsafe.Pointer(&StringArrayPtr(argv)[0])), - uintptr(unsafe.Pointer(&StringArrayPtr(envv)[0]))) + uintptr(unsafe.Pointer(&StringSlicePtr(argv)[0])), + uintptr(unsafe.Pointer(&StringSlicePtr(envv)[0]))) return int(err1) } diff --git a/src/pkg/syscall/exec_windows.go b/src/pkg/syscall/exec_windows.go index b25f4a650..e8b540ad1 100644 --- a/src/pkg/syscall/exec_windows.go +++ b/src/pkg/syscall/exec_windows.go @@ -121,11 +121,11 @@ func createEnvBlock(envv []string) *uint16 { return &utf16.Encode([]int(string(b)))[0] } -func CloseOnExec(fd int) { - SetHandleInformation(int32(fd), HANDLE_FLAG_INHERIT, 0) +func CloseOnExec(fd Handle) { + SetHandleInformation(Handle(fd), HANDLE_FLAG_INHERIT, 0) } -func SetNonblock(fd int, nonblocking bool) (errno int) { +func SetNonblock(fd Handle, nonblocking bool) (errno int) { return 0 } @@ -218,22 +218,32 @@ func joinExeDirAndFName(dir, p string) (name string, err int) { } type ProcAttr struct { - Dir string - Env []string - Files []int + Dir string + Env []string + Files []Handle + Sys *SysProcAttr +} + +type SysProcAttr struct { HideWindow bool CmdLine string // used if non-empty, else the windows command line is built by escaping the arguments passed to StartProcess } -var zeroAttributes ProcAttr +var zeroProcAttr ProcAttr +var zeroSysProcAttr SysProcAttr func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid, handle int, err int) { if len(argv0) == 0 { return 0, 0, EWINDOWS } if attr == nil { - attr = &zeroAttributes + attr = &zeroProcAttr } + sys := attr.Sys + if sys == nil { + sys = &zeroSysProcAttr + } + if len(attr.Files) > 3 { return 0, 0, EWINDOWS } @@ -257,8 +267,8 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid, handle int, // Windows CreateProcess takes the command line as a single string: // use attr.CmdLine if set, else build the command line by escaping // and joining each argument with spaces - if attr.CmdLine != "" { - cmdline = attr.CmdLine + if sys.CmdLine != "" { + cmdline = sys.CmdLine } else { cmdline = makeCmdLine(argv) } @@ -280,20 +290,20 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid, handle int, defer ForkLock.Unlock() p, _ := GetCurrentProcess() - fd := make([]int32, len(attr.Files)) + fd := make([]Handle, len(attr.Files)) for i := range attr.Files { if attr.Files[i] > 0 { - err := DuplicateHandle(p, int32(attr.Files[i]), p, &fd[i], 0, true, DUPLICATE_SAME_ACCESS) + err := DuplicateHandle(p, Handle(attr.Files[i]), p, &fd[i], 0, true, DUPLICATE_SAME_ACCESS) if err != 0 { return 0, 0, err } - defer CloseHandle(int32(fd[i])) + defer CloseHandle(Handle(fd[i])) } } si := new(StartupInfo) si.Cb = uint32(unsafe.Sizeof(*si)) si.Flags = STARTF_USESTDHANDLES - if attr.HideWindow { + if sys.HideWindow { si.Flags |= STARTF_USESHOWWINDOW si.ShowWindow = SW_HIDE } @@ -307,7 +317,7 @@ func StartProcess(argv0 string, argv []string, attr *ProcAttr) (pid, handle int, if err != 0 { return 0, 0, err } - defer CloseHandle(pi.Thread) + defer CloseHandle(Handle(pi.Thread)) return int(pi.ProcessId), int(pi.Process), 0 } diff --git a/src/pkg/syscall/lsf_linux.go b/src/pkg/syscall/lsf_linux.go new file mode 100644 index 000000000..f2bd2b757 --- /dev/null +++ b/src/pkg/syscall/lsf_linux.go @@ -0,0 +1,78 @@ +// Copyright 2011 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. + +// Linux socket filter + +package syscall + +import ( + "unsafe" +) + +func LsfStmt(code, k int) *SockFilter { + return &SockFilter{Code: uint16(code), K: uint32(k)} +} + +func LsfJump(code, k, jt, jf int) *SockFilter { + return &SockFilter{Code: uint16(code), Jt: uint8(jt), Jf: uint8(jf), K: uint32(k)} +} + +func LsfSocket(ifindex, proto int) (int, int) { + var lsall SockaddrLinklayer + s, e := Socket(AF_PACKET, SOCK_RAW, proto) + if e != 0 { + return 0, e + } + p := (*[2]byte)(unsafe.Pointer(&lsall.Protocol)) + p[0] = byte(proto >> 8) + p[1] = byte(proto) + lsall.Ifindex = ifindex + e = Bind(s, &lsall) + if e != 0 { + Close(s) + return 0, e + } + return s, 0 +} + +type iflags struct { + name [IFNAMSIZ]byte + flags uint16 +} + +func SetLsfPromisc(name string, m bool) int { + s, e := Socket(AF_INET, SOCK_DGRAM, 0) + if e != 0 { + return e + } + defer Close(s) + var ifl iflags + copy(ifl.name[:], []byte(name)) + _, _, ep := Syscall(SYS_IOCTL, uintptr(s), SIOCGIFFLAGS, uintptr(unsafe.Pointer(&ifl))) + if e := int(ep); e != 0 { + return e + } + if m { + ifl.flags |= uint16(IFF_PROMISC) + } else { + ifl.flags &= ^uint16(IFF_PROMISC) + } + _, _, ep = Syscall(SYS_IOCTL, uintptr(s), SIOCSIFFLAGS, uintptr(unsafe.Pointer(&ifl))) + if e := int(ep); e != 0 { + return e + } + return 0 +} + +func AttachLsf(fd int, i []SockFilter) int { + var p SockFprog + p.Len = uint16(len(i)) + p.Filter = (*SockFilter)(unsafe.Pointer(&i[0])) + return setsockopt(fd, SOL_SOCKET, SO_ATTACH_FILTER, uintptr(unsafe.Pointer(&p)), unsafe.Sizeof(p)) +} + +func DetachLsf(fd int) int { + var dummy int + return setsockopt(fd, SOL_SOCKET, SO_DETACH_FILTER, uintptr(unsafe.Pointer(&dummy)), unsafe.Sizeof(dummy)) +} diff --git a/src/pkg/syscall/mkall.sh b/src/pkg/syscall/mkall.sh index 0a4ca0326..7d0c1ac2a 100755 --- a/src/pkg/syscall/mkall.sh +++ b/src/pkg/syscall/mkall.sh @@ -78,6 +78,7 @@ GOOSARCH="${GOOS}_${GOARCH}" # defaults mksyscall="./mksyscall.pl" mkerrors="./mkerrors.sh" +zerrors="zerrors_$GOOSARCH.go" run="sh" case "$1" in @@ -120,14 +121,13 @@ freebsd_amd64) darwin_386) mkerrors="$mkerrors -f -m32" mksyscall="./mksyscall.pl -l32" - mksysnum="./mksysnum_darwin.pl /home/rsc/pub/xnu-1228/bsd/kern/syscalls.master" + mksysnum="./mksysnum_darwin.pl /usr/include/sys/syscall.h" mktypes="godefs -gsyscall -f-m32" ;; darwin_amd64) mkerrors="$mkerrors -f -m64" - mksysnum="./mksysnum_darwin.pl /home/rsc/pub/xnu-1228/bsd/kern/syscalls.master" + mksysnum="./mksysnum_darwin.pl /usr/include/sys/syscall.h" mktypes="godefs -gsyscall -f-m64" - mkerrors="./mkerrors.sh" ;; linux_386) mkerrors="$mkerrors -f -m32" @@ -151,6 +151,14 @@ windows_386) mksysnum= mktypes= mkerrors="./mkerrors_windows.sh -f -m32" + zerrors="zerrors_windows.go" + ;; +windows_amd64) + mksyscall="./mksyscall_windows.pl" + mksysnum= + mktypes= + mkerrors="./mkerrors_windows.sh -f -m32" + zerrors="zerrors_windows.go" ;; plan9_386) mkerrors= @@ -165,7 +173,7 @@ plan9_386) esac ( - if [ -n "$mkerrors" ]; then echo "$mkerrors |gofmt >zerrors_$GOOSARCH.go"; fi + if [ -n "$mkerrors" ]; then echo "$mkerrors |gofmt >$zerrors"; fi syscall_goos="syscall_$GOOS.go" case "$GOOS" in darwin | freebsd) diff --git a/src/pkg/syscall/mkerrors.sh b/src/pkg/syscall/mkerrors.sh index 1949ebfad..c90cd1c00 100755 --- a/src/pkg/syscall/mkerrors.sh +++ b/src/pkg/syscall/mkerrors.sh @@ -30,7 +30,9 @@ includes_Linux=' #include <sys/stat.h> #include <sys/types.h> #include <linux/if_addr.h> +#include <linux/if_ether.h> #include <linux/if_tun.h> +#include <linux/filter.h> #include <linux/netlink.h> #include <linux/reboot.h> #include <linux/rtnetlink.h> @@ -47,6 +49,7 @@ includes_Darwin=' #define _DARWIN_USE_64_BIT_INODE #include <sys/types.h> #include <sys/event.h> +#include <sys/ptrace.h> #include <sys/socket.h> #include <sys/sockio.h> #include <sys/sysctl.h> @@ -59,6 +62,7 @@ includes_Darwin=' #include <netinet/in.h> #include <netinet/ip.h> #include <netinet/ip_mroute.h> +#include <termios.h> ' includes_FreeBSD=' @@ -68,11 +72,13 @@ includes_FreeBSD=' #include <sys/sockio.h> #include <sys/sysctl.h> #include <sys/wait.h> +#include <sys/ioctl.h> #include <net/bpf.h> #include <net/if.h> #include <net/if_types.h> #include <net/route.h> #include <netinet/in.h> +#include <termios.h> #include <netinet/ip.h> #include <netinet/ip_mroute.h> ' @@ -136,12 +142,13 @@ done $2 == "CTL_MAXNAME" || $2 ~ /^(MS|MNT)_/ || $2 ~ /^TUN(SET|GET|ATTACH|DETACH)/ || - $2 ~ /^(O|F|FD|NAME|S|PTRACE)_/ || + $2 ~ /^(O|F|FD|NAME|S|PTRACE|PT)_/ || $2 ~ /^LINUX_REBOOT_CMD_/ || $2 ~ /^LINUX_REBOOT_MAGIC[12]$/ || $2 !~ "NLA_TYPE_MASK" && - $2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|RTM|RTN|RTPROT|RTA|RTAX|RTNH|ARPHRD)_/ || + $2 ~ /^(NETLINK|NLM|NLMSG|NLA|IFA|RTM|RTN|RTPROT|RTA|RTAX|RTNH|ARPHRD|ETH_P)_/ || $2 ~ /^SIOC/ || + $2 ~ /^TIOC/ || $2 ~ /^(IFF|IFT|NET_RT|RTM|RTF|RTV|RTA|RTAX)_/ || $2 ~ /^BIOC/ || $2 !~ /^(BPF_TIMEVAL)$/ && diff --git a/src/pkg/syscall/mksyscall.pl b/src/pkg/syscall/mksyscall.pl index ecf4abdd4..ed6525972 100755 --- a/src/pkg/syscall/mksyscall.pl +++ b/src/pkg/syscall/mksyscall.pl @@ -19,11 +19,12 @@ # block, as otherwise the system call could cause all goroutines to # hang. -$cmdline = "mksyscall.pl " . join(' ', @ARGV); -$errors = 0; -$_32bit = ""; -$nacl = 0; -$plan9 = 0; +use strict; + +my $cmdline = "mksyscall.pl " . join(' ', @ARGV); +my $errors = 0; +my $_32bit = ""; +my $plan9 = 0; if($ARGV[0] eq "-b32") { $_32bit = "big-endian"; @@ -32,10 +33,6 @@ if($ARGV[0] eq "-b32") { $_32bit = "little-endian"; shift; } -if($ARGV[0] eq "-nacl") { - $nacl = 1; - shift; -} if($ARGV[0] eq "-plan9") { $plan9 = 1; shift; @@ -66,7 +63,7 @@ sub parseparam($) { return ($1, $2); } -$text = ""; +my $text = ""; while(<>) { chomp; s/\s+/ /g; diff --git a/src/pkg/syscall/mksyscall_windows.pl b/src/pkg/syscall/mksyscall_windows.pl index fb5a1272b..c3cb142ed 100755 --- a/src/pkg/syscall/mksyscall_windows.pl +++ b/src/pkg/syscall/mksyscall_windows.pl @@ -23,9 +23,13 @@ # //sys LoadLibrary(libname string) (handle uint32, errno int) [failretval==-1] = LoadLibraryA # and is [failretval==0] by default. -$cmdline = "mksyscall_windows.pl " . join(' ', @ARGV); -$errors = 0; -$_32bit = ""; +use strict; + +my $cmdline = "mksyscall_windows.pl " . join(' ', @ARGV); +my $errors = 0; +my $_32bit = ""; + +binmode STDOUT; if($ARGV[0] eq "-b32") { $_32bit = "big-endian"; @@ -60,10 +64,10 @@ sub parseparam($) { return ($1, $2); } -$text = ""; -$vars = ""; -$mods = ""; -$modnames = ""; +my $text = ""; +my $vars = ""; +my $mods = ""; +my $modnames = ""; while(<>) { chomp; s/\s+/ /g; @@ -89,7 +93,7 @@ while(<>) { if($modname eq "") { $modname = "kernel32"; } - $modvname = "mod$modname"; + my $modvname = "mod$modname"; if($modnames !~ /$modname/) { $modnames .= ".$modname"; $mods .= "\t$modvname = loadDll(\"$modname.dll\")\n"; @@ -101,7 +105,7 @@ while(<>) { } # System call pointer variable name. - $sysvarname = "proc$sysname"; + my $sysvarname = "proc$sysname"; # Returned value when failed if($failcond eq "") { @@ -109,17 +113,13 @@ while(<>) { } # Decide which version of api is used: ascii or unicode. - if($sysname !~ /W$/) { - $strconvfunc = "StringBytePtr"; - } else { - $strconvfunc = "StringToUTF16Ptr"; - } + my $strconvfunc = $sysname !~ /W$/ ? "StringBytePtr" : "StringToUTF16Ptr"; # Winapi proc address variable. $vars .= sprintf "\t%s = getSysProcAddr(%s, \"%s\")\n", $sysvarname, $modvname, $sysname; # Go function header. - my $out = join(', ', @out); + $out = join(', ', @out); if($out ne "") { $out = " ($out)"; } @@ -240,7 +240,7 @@ while(<>) { $failexpr = "$name $failcond"; } } - $failexpr =~ s/(=)([0-9A-Za-z\-+])/\1 \2/; # gofmt compatible + $failexpr =~ s/(=)([0-9A-Za-z\-+])/$1 $2/; # gofmt compatible if($name eq "errno") { # Set errno to "last error" only if returned value indicate failure $body .= "\tif $failexpr {\n"; diff --git a/src/pkg/syscall/mksysnum_darwin.pl b/src/pkg/syscall/mksysnum_darwin.pl index d078a1836..fd4375b2f 100755 --- a/src/pkg/syscall/mksysnum_darwin.pl +++ b/src/pkg/syscall/mksysnum_darwin.pl @@ -3,8 +3,9 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. # -# Generate system call table for Darwin from master list -# (for example, xnu-1228/bsd/kern/syscalls.master). +# Generate system call table for Darwin from sys/syscall.h + +use strict; my $command = "mksysnum_darwin.pl " . join(' ', @ARGV); @@ -18,18 +19,11 @@ const ( EOF while(<>){ - if(/^([0-9]+)\s+ALL\s+({ \S+\s+(\w+).*})/){ - my $num = $1; - my $proto = $2; - my $name = "SYS_$3"; + if(/^#define\s+SYS_(\w+)\s+([0-9]+)/){ + my $name = $1; + my $num = $2; $name =~ y/a-z/A-Z/; - - # There are multiple entries for enosys and nosys, so comment them out. - if($name =~ /^SYS_E?NOSYS$/){ - $name = "// $name"; - } - - print " $name = $num; // $proto\n"; + print " SYS_$name = $num;" } } diff --git a/src/pkg/syscall/mksysnum_freebsd.pl b/src/pkg/syscall/mksysnum_freebsd.pl index 03f7d9e25..54872b2f4 100755 --- a/src/pkg/syscall/mksysnum_freebsd.pl +++ b/src/pkg/syscall/mksysnum_freebsd.pl @@ -6,6 +6,8 @@ # Generate system call table for FreeBSD from master list # (for example, /usr/src/sys/kern/syscalls.master). +use strict; + my $command = "mksysnum_freebsd.pl " . join(' ', @ARGV); print <<EOF; diff --git a/src/pkg/syscall/mksysnum_linux.pl b/src/pkg/syscall/mksysnum_linux.pl index e97c87f44..ecf364188 100755 --- a/src/pkg/syscall/mksysnum_linux.pl +++ b/src/pkg/syscall/mksysnum_linux.pl @@ -3,6 +3,8 @@ # Use of this source code is governed by a BSD-style # license that can be found in the LICENSE file. +use strict; + my $command = "mksysnum_linux.pl ". join(' ', @ARGV); print <<EOF; diff --git a/src/pkg/syscall/route_bsd.go b/src/pkg/syscall/route_bsd.go index 79a8793d5..7821a6d29 100644 --- a/src/pkg/syscall/route_bsd.go +++ b/src/pkg/syscall/route_bsd.go @@ -10,8 +10,6 @@ import ( "unsafe" ) -const darwinAMD64 = OS == "darwin" && ARCH == "amd64" - // Round the length of a raw sockaddr up to align it properly. func rsaAlignOf(salen int) int { salign := sizeofPtr @@ -59,7 +57,7 @@ type RoutingMessage interface { sockaddr() []Sockaddr } -const anyMessageLen = unsafe.Sizeof(anyMessage{}) +const anyMessageLen = int(unsafe.Sizeof(anyMessage{})) type anyMessage struct { Msglen uint16 diff --git a/src/pkg/syscall/sockcmsg_unix.go b/src/pkg/syscall/sockcmsg_unix.go new file mode 100644 index 000000000..f0c05eaf3 --- /dev/null +++ b/src/pkg/syscall/sockcmsg_unix.go @@ -0,0 +1,65 @@ +// Copyright 2011 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. + +// Socket control messages + +package syscall + +import ( + "unsafe" +) + +// Round the length of a raw sockaddr up to align it propery. +func cmsgAlignOf(salen int) int { + salign := sizeofPtr + // NOTE: It seems like 64-bit Darwin kernel still requires 32-bit + // aligned access to BSD subsystem. + if darwinAMD64 { + salign = 4 + } + if salen == 0 { + return salign + } + return (salen + salign - 1) & ^(salign - 1) +} + +func cmsgLen(datalen int) int { + return cmsgAlignOf(SizeofCmsghdr) + datalen +} + +type SocketControlMessage struct { + Header Cmsghdr + Data []byte +} + +func ParseSocketControlMessage(buf []byte) ([]SocketControlMessage, int) { + var ( + h *Cmsghdr + dbuf []byte + e int + cmsgs []SocketControlMessage + ) + + for len(buf) >= cmsgLen(0) { + h, dbuf, e = socketControlMessageHeaderAndData(buf) + if e != 0 { + break + } + m := SocketControlMessage{} + m.Header = *h + m.Data = dbuf[:int(h.Len)-cmsgAlignOf(SizeofCmsghdr)] + cmsgs = append(cmsgs, m) + buf = buf[cmsgAlignOf(int(h.Len)):] + } + + return cmsgs, e +} + +func socketControlMessageHeaderAndData(buf []byte) (*Cmsghdr, []byte, int) { + h := (*Cmsghdr)(unsafe.Pointer(&buf[0])) + if h.Len < SizeofCmsghdr || int(h.Len) > len(buf) { + return nil, nil, EINVAL + } + return h, buf[cmsgAlignOf(SizeofCmsghdr):], 0 +} diff --git a/src/pkg/syscall/syscall.go b/src/pkg/syscall/syscall.go index 157abaa8b..9f777f59e 100644 --- a/src/pkg/syscall/syscall.go +++ b/src/pkg/syscall/syscall.go @@ -13,11 +13,6 @@ // errno is an operating system error number describing the failure. package syscall -import ( - "sync" - "unsafe" -) - // StringByteSlice returns a NUL-terminated slice of bytes // containing the text of s. func StringByteSlice(s string) []byte { @@ -33,63 +28,3 @@ func StringBytePtr(s string) *byte { return &StringByteSlice(s)[0] } // Single-word zero for use when we need a valid pointer to 0 bytes. // See mksyscall.sh. var _zero uintptr - -// Mmap manager, for use by operating system-specific implementations. - -type mmapper struct { - sync.Mutex - active map[*byte][]byte // active mappings; key is last byte in mapping - mmap func(addr, length uintptr, prot, flags, fd int, offset int64) (uintptr, int) - munmap func(addr uintptr, length uintptr) int -} - -func (m *mmapper) Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, errno int) { - if length <= 0 { - return nil, EINVAL - } - - // Map the requested memory. - addr, errno := m.mmap(0, uintptr(length), prot, flags, fd, offset) - if errno != 0 { - return nil, errno - } - - // Slice memory layout - var sl = struct { - addr uintptr - len int - cap int - }{addr, length, length} - - // Use unsafe to turn sl into a []byte. - b := *(*[]byte)(unsafe.Pointer(&sl)) - - // Register mapping in m and return it. - p := &b[cap(b)-1] - m.Lock() - defer m.Unlock() - m.active[p] = b - return b, 0 -} - -func (m *mmapper) Munmap(data []byte) (errno int) { - if len(data) == 0 || len(data) != cap(data) { - return EINVAL - } - - // Find the base of the mapping. - p := &data[cap(data)-1] - m.Lock() - defer m.Unlock() - b := m.active[p] - if b == nil || &b[0] != &data[0] { - return EINVAL - } - - // Unmap the memory and update m. - if errno := m.munmap(uintptr(unsafe.Pointer(&b[0])), uintptr(len(b))); errno != 0 { - return errno - } - m.active[p] = nil, false - return 0 -} diff --git a/src/pkg/syscall/syscall_bsd.go b/src/pkg/syscall/syscall_bsd.go index 89bcc7f0e..2df75917b 100644 --- a/src/pkg/syscall/syscall_bsd.go +++ b/src/pkg/syscall/syscall_bsd.go @@ -155,7 +155,7 @@ func Sleep(ns int64) (errno int) { //sys connect(s int, addr uintptr, addrlen _Socklen) (errno int) //sysnb socket(domain int, typ int, proto int) (fd int, errno int) //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (errno int) -//sys setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) +//sys setsockopt(s int, level int, name int, val uintptr, vallen uintptr) (errno int) //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) //sys Shutdown(s int, how int) (errno int) @@ -400,7 +400,7 @@ func SetsockoptIPv6Mreq(fd, level, opt int, mreq *IPv6Mreq) (errno int) { } func SetsockoptString(fd, level, opt int, s string) (errno int) { - return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&[]byte(s)[0])), len(s)) + return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&[]byte(s)[0])), uintptr(len(s))) } //sys recvfrom(fd int, p []byte, flags int, from *RawSockaddrAny, fromlen *_Socklen) (n int, errno int) @@ -425,6 +425,80 @@ func Sendto(fd int, p []byte, flags int, to Sockaddr) (errno int) { return sendto(fd, p, flags, ptr, n) } +//sys recvmsg(s int, msg *Msghdr, flags int) (n int, errno int) + +func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, errno int) { + var msg Msghdr + var rsa RawSockaddrAny + msg.Name = (*byte)(unsafe.Pointer(&rsa)) + msg.Namelen = uint32(SizeofSockaddrAny) + var iov Iovec + if len(p) > 0 { + iov.Base = (*byte)(unsafe.Pointer(&p[0])) + iov.SetLen(len(p)) + } + var dummy byte + if len(oob) > 0 { + // receive at least one normal byte + if len(p) == 0 { + iov.Base = &dummy + iov.SetLen(1) + } + msg.Control = (*byte)(unsafe.Pointer(&oob[0])) + msg.SetControllen(len(oob)) + } + msg.Iov = &iov + msg.Iovlen = 1 + if n, errno = recvmsg(fd, &msg, flags); errno != 0 { + return + } + oobn = int(msg.Controllen) + recvflags = int(msg.Flags) + // source address is only specified if the socket is unconnected + if rsa.Addr.Family != AF_UNSPEC { + from, errno = anyToSockaddr(&rsa) + } + return +} + +//sys sendmsg(s int, msg *Msghdr, flags int) (errno int) + +func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (errno int) { + var ptr uintptr + var salen _Socklen + if to != nil { + var err int + ptr, salen, err = to.sockaddr() + if err != 0 { + return err + } + } + var msg Msghdr + msg.Name = (*byte)(unsafe.Pointer(ptr)) + msg.Namelen = uint32(salen) + var iov Iovec + if len(p) > 0 { + iov.Base = (*byte)(unsafe.Pointer(&p[0])) + iov.SetLen(len(p)) + } + var dummy byte + if len(oob) > 0 { + // send at least one normal byte + if len(p) == 0 { + iov.Base = &dummy + iov.SetLen(1) + } + msg.Control = (*byte)(unsafe.Pointer(&oob[0])) + msg.SetControllen(len(oob)) + } + msg.Iov = &iov + msg.Iovlen = 1 + if errno = sendmsg(fd, &msg, flags); errno != 0 { + return + } + return +} + // TODO: // FreeBSD has IP_SENDIF. Darwin probably needs BSDLLCTest, see: // http://developer.apple.com/mac/library/samplecode/BSDLLCTest/index.html @@ -451,7 +525,7 @@ func Kevent(kq int, changes, events []Kevent_t, timeout *Timespec) (n int, errno // Translate "kern.hostname" to []_C_int{0,1,2,3}. func nametomib(name string) (mib []_C_int, errno int) { - const siz = uintptr(unsafe.Sizeof(mib[0])) + const siz = unsafe.Sizeof(mib[0]) // NOTE(rsc): It seems strange to set the buffer to have // size CTL_MAXNAME+2 but use only CTL_MAXNAME @@ -540,14 +614,6 @@ func Futimes(fd int, tv []Timeval) (errno int) { //sys fcntl(fd int, cmd int, arg int) (val int, errno int) -func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from Sockaddr, errno int) { - return 0, 0, 0, nil, EAFNOSUPPORT -} - -func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (errno int) { - return EAFNOSUPPORT -} - // TODO: wrap // Acct(name nil-string) (errno int) // Gethostuuid(uuid *byte, timeout *Timespec) (errno int) diff --git a/src/pkg/syscall/syscall_darwin.go b/src/pkg/syscall/syscall_darwin.go index 9e153b73d..fabd48178 100644 --- a/src/pkg/syscall/syscall_darwin.go +++ b/src/pkg/syscall/syscall_darwin.go @@ -56,6 +56,10 @@ func ParseDirent(buf []byte, max int, names []string) (consumed int, count int, return origlen - len(buf), count, names } +//sys ptrace(request int, pid int, addr uintptr, data uintptr) (errno int) +func PtraceAttach(pid int) (errno int) { return ptrace(PT_ATTACH, pid, 0, 0) } +func PtraceDetach(pid int) (errno int) { return ptrace(PT_DETACH, pid, 0, 0) } + // TODO func Sendfile(outfd int, infd int, offset *int64, count int) (written int, errno int) { return -1, ENOSYS diff --git a/src/pkg/syscall/syscall_darwin_386.go b/src/pkg/syscall/syscall_darwin_386.go index 5101ba6c7..d76b22844 100644 --- a/src/pkg/syscall/syscall_darwin_386.go +++ b/src/pkg/syscall/syscall_darwin_386.go @@ -40,4 +40,16 @@ func SetKevent(k *Kevent_t, fd, mode, flags int) { k.Flags = uint16(flags) } +func (iov *Iovec) SetLen(length int) { + iov.Len = uint32(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = uint32(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = uint32(length) +} + func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2, err uintptr) // sic diff --git a/src/pkg/syscall/syscall_darwin_amd64.go b/src/pkg/syscall/syscall_darwin_amd64.go index acf7a5554..ed4372304 100644 --- a/src/pkg/syscall/syscall_darwin_amd64.go +++ b/src/pkg/syscall/syscall_darwin_amd64.go @@ -39,3 +39,15 @@ func SetKevent(k *Kevent_t, fd, mode, flags int) { k.Filter = int16(mode) k.Flags = uint16(flags) } + +func (iov *Iovec) SetLen(length int) { + iov.Len = uint64(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = uint32(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = uint32(length) +} diff --git a/src/pkg/syscall/syscall_freebsd_386.go b/src/pkg/syscall/syscall_freebsd_386.go index d0fa506c7..d3b5a1bfe 100644 --- a/src/pkg/syscall/syscall_freebsd_386.go +++ b/src/pkg/syscall/syscall_freebsd_386.go @@ -29,4 +29,16 @@ func SetKevent(k *Kevent_t, fd, mode, flags int) { k.Flags = uint16(flags) } +func (iov *Iovec) SetLen(length int) { + iov.Len = uint32(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = uint32(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = uint32(length) +} + func Syscall9(num, a1, a2, a3, a4, a5, a6, a7, a8, a9 uintptr) (r1, r2, err uintptr) // sic diff --git a/src/pkg/syscall/syscall_freebsd_amd64.go b/src/pkg/syscall/syscall_freebsd_amd64.go index ef5aff6ef..8c1ddf6db 100644 --- a/src/pkg/syscall/syscall_freebsd_amd64.go +++ b/src/pkg/syscall/syscall_freebsd_amd64.go @@ -28,3 +28,15 @@ func SetKevent(k *Kevent_t, fd, mode, flags int) { k.Filter = int16(mode) k.Flags = uint16(flags) } + +func (iov *Iovec) SetLen(length int) { + iov.Len = uint64(length) +} + +func (msghdr *Msghdr) SetControllen(length int) { + msghdr.Controllen = uint32(length) +} + +func (cmsg *Cmsghdr) SetLen(length int) { + cmsg.Len = uint32(length) +} diff --git a/src/pkg/syscall/syscall_linux.go b/src/pkg/syscall/syscall_linux.go index 63682d23c..1d6fc76c7 100644 --- a/src/pkg/syscall/syscall_linux.go +++ b/src/pkg/syscall/syscall_linux.go @@ -472,7 +472,7 @@ func SetsockoptIPv6Mreq(fd, level, opt int, mreq *IPv6Mreq) (errno int) { } func SetsockoptString(fd, level, opt int, s string) (errno int) { - return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&[]byte(s)[0])), len(s)) + return setsockopt(fd, level, opt, uintptr(unsafe.Pointer(&[]byte(s)[0])), uintptr(len(s))) } func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, errno int) { @@ -529,17 +529,17 @@ func Recvmsg(fd int, p, oob []byte, flags int) (n, oobn int, recvflags int, from func Sendmsg(fd int, p, oob []byte, to Sockaddr, flags int) (errno int) { var ptr uintptr - var nsock _Socklen + var salen _Socklen if to != nil { var err int - ptr, nsock, err = to.sockaddr() + ptr, salen, err = to.sockaddr() if err != 0 { return err } } var msg Msghdr msg.Name = (*byte)(unsafe.Pointer(ptr)) - msg.Namelen = uint32(nsock) + msg.Namelen = uint32(salen) var iov Iovec if len(p) > 0 { iov.Base = (*byte)(unsafe.Pointer(&p[0])) diff --git a/src/pkg/syscall/syscall_linux_386.go b/src/pkg/syscall/syscall_linux_386.go index 5195179a2..44891de87 100644 --- a/src/pkg/syscall/syscall_linux_386.go +++ b/src/pkg/syscall/syscall_linux_386.go @@ -146,8 +146,8 @@ func getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (errn return } -func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) { - _, errno = socketcall(_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) +func setsockopt(s int, level int, name int, val uintptr, vallen uintptr) (errno int) { + _, errno = socketcall(_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), val, vallen, 0) return } @@ -190,13 +190,13 @@ func Shutdown(s, how int) (errno int) { } func Fstatfs(fd int, buf *Statfs_t) (errno int) { - _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), uintptr(unsafe.Sizeof(*buf)), uintptr(unsafe.Pointer(buf))) + _, _, e1 := Syscall(SYS_FSTATFS64, uintptr(fd), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf))) errno = int(e1) return } func Statfs(path string, buf *Statfs_t) (errno int) { - _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(StringBytePtr(path))), uintptr(unsafe.Sizeof(*buf)), uintptr(unsafe.Pointer(buf))) + _, _, e1 := Syscall(SYS_STATFS64, uintptr(unsafe.Pointer(StringBytePtr(path))), unsafe.Sizeof(*buf), uintptr(unsafe.Pointer(buf))) errno = int(e1) return } diff --git a/src/pkg/syscall/syscall_linux_amd64.go b/src/pkg/syscall/syscall_linux_amd64.go index db9524668..8b206ad0a 100644 --- a/src/pkg/syscall/syscall_linux_amd64.go +++ b/src/pkg/syscall/syscall_linux_amd64.go @@ -42,7 +42,7 @@ package syscall //sysnb getgroups(n int, list *_Gid_t) (nn int, errno int) //sysnb setgroups(n int, list *_Gid_t) (errno int) //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (errno int) -//sys setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) +//sys setsockopt(s int, level int, name int, val uintptr, vallen uintptr) (errno int) //sysnb socket(domain int, typ int, proto int) (fd int, errno int) //sysnb socketpair(domain int, typ int, proto int, fd *[2]int) (errno int) //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) diff --git a/src/pkg/syscall/syscall_linux_arm.go b/src/pkg/syscall/syscall_linux_arm.go index 37845301f..8c03c765c 100644 --- a/src/pkg/syscall/syscall_linux_arm.go +++ b/src/pkg/syscall/syscall_linux_arm.go @@ -71,7 +71,7 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, errno int) //sysnb getgroups(n int, list *_Gid_t) (nn int, errno int) = SYS_GETGROUPS32 //sysnb setgroups(n int, list *_Gid_t) (errno int) = SYS_SETGROUPS32 //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (errno int) -//sys setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) +//sys setsockopt(s int, level int, name int, val uintptr, vallen uintptr) (errno int) //sysnb socket(domain int, typ int, proto int) (fd int, errno int) //sysnb getpeername(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) //sysnb getsockname(fd int, rsa *RawSockaddrAny, addrlen *_Socklen) (errno int) diff --git a/src/pkg/syscall/syscall_plan9.go b/src/pkg/syscall/syscall_plan9.go index 730126f23..4104050fd 100644 --- a/src/pkg/syscall/syscall_plan9.go +++ b/src/pkg/syscall/syscall_plan9.go @@ -35,7 +35,7 @@ var ( Stdout = 1 Stderr = 2 - EISDIR Error = NewError("file is a directory") + EISDIR = NewError("file is a directory") ) func Syscall(trap, a1, a2, a3 uintptr) (r1, r2 uintptr, err string) @@ -200,6 +200,17 @@ type Waitmsg struct { Msg string } +func (w Waitmsg) Exited() bool { return true } +func (w Waitmsg) Signaled() bool { return false } + +func (w Waitmsg) ExitStatus() int { + if len(w.Msg) == 0 { + // a normal exit returns no message + return 0 + } + return 1 +} + //sys await(s []byte) (n int, err Error) func Await(w *Waitmsg) (err Error) { var buf [512]byte @@ -230,7 +241,7 @@ func Await(w *Waitmsg) (err Error) { w.Time[0] = uint32(atoi(f[1])) w.Time[1] = uint32(atoi(f[2])) w.Time[2] = uint32(atoi(f[3])) - w.Msg = string(f[4]) + w.Msg = cstring(f[4]) return } @@ -327,11 +338,6 @@ func Getgroups() (gids []int, err Error) { return make([]int, 0), nil } -// TODO -func Sendfile(outfd int, infd int, offset *int64, count int) (written int, errno int) { - return -1, ENOSYS -} - //sys Dup(oldfd int, newfd int) (fd int, err Error) //sys Open(path string, mode int) (fd int, err Error) //sys Create(path string, mode int, perm uint32) (fd int, err Error) diff --git a/src/pkg/syscall/syscall_unix.go b/src/pkg/syscall/syscall_unix.go index a77e40bc6..20c8a135f 100644 --- a/src/pkg/syscall/syscall_unix.go +++ b/src/pkg/syscall/syscall_unix.go @@ -4,12 +4,20 @@ package syscall +import ( + "sync" + "unsafe" +) + + var ( Stdin = 0 Stdout = 1 Stderr = 2 ) +const darwinAMD64 = OS == "darwin" && ARCH == "amd64" + func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) @@ -21,3 +29,63 @@ func Errstr(errno int) string { } return errors[errno] } + +// Mmap manager, for use by operating system-specific implementations. + +type mmapper struct { + sync.Mutex + active map[*byte][]byte // active mappings; key is last byte in mapping + mmap func(addr, length uintptr, prot, flags, fd int, offset int64) (uintptr, int) + munmap func(addr uintptr, length uintptr) int +} + +func (m *mmapper) Mmap(fd int, offset int64, length int, prot int, flags int) (data []byte, errno int) { + if length <= 0 { + return nil, EINVAL + } + + // Map the requested memory. + addr, errno := m.mmap(0, uintptr(length), prot, flags, fd, offset) + if errno != 0 { + return nil, errno + } + + // Slice memory layout + var sl = struct { + addr uintptr + len int + cap int + }{addr, length, length} + + // Use unsafe to turn sl into a []byte. + b := *(*[]byte)(unsafe.Pointer(&sl)) + + // Register mapping in m and return it. + p := &b[cap(b)-1] + m.Lock() + defer m.Unlock() + m.active[p] = b + return b, 0 +} + +func (m *mmapper) Munmap(data []byte) (errno int) { + if len(data) == 0 || len(data) != cap(data) { + return EINVAL + } + + // Find the base of the mapping. + p := &data[cap(data)-1] + m.Lock() + defer m.Unlock() + b := m.active[p] + if b == nil || &b[0] != &data[0] { + return EINVAL + } + + // Unmap the memory and update m. + if errno := m.munmap(uintptr(unsafe.Pointer(&b[0])), uintptr(len(b))); errno != 0 { + return errno + } + m.active[p] = nil, false + return 0 +} diff --git a/src/pkg/syscall/syscall_windows.go b/src/pkg/syscall/syscall_windows.go index d01664d12..5b8143aac 100644 --- a/src/pkg/syscall/syscall_windows.go +++ b/src/pkg/syscall/syscall_windows.go @@ -13,6 +13,10 @@ import ( const OS = "windows" +type Handle uintptr + +const InvalidHandle = ^Handle(0) + /* small demo to detect version of windows you are running: @@ -77,10 +81,10 @@ 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) func Syscall12(trap, nargs, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12 uintptr) (r1, r2, err uintptr) -func loadlibraryex(filename uintptr) (handle uint32) -func getprocaddress(handle uint32, procname uintptr) (proc uintptr) +func loadlibraryex(filename uintptr) (handle uintptr) +func getprocaddress(handle uintptr, procname uintptr) (proc uintptr) -func loadDll(fname string) uint32 { +func loadDll(fname string) uintptr { m := loadlibraryex(uintptr(unsafe.Pointer(StringBytePtr(fname)))) if m == 0 { panic("syscall: could not LoadLibraryEx " + fname) @@ -88,7 +92,7 @@ func loadDll(fname string) uint32 { return m } -func getSysProcAddr(m uint32, pname string) uintptr { +func getSysProcAddr(m uintptr, pname string) uintptr { p := getprocaddress(m, uintptr(unsafe.Pointer(StringBytePtr(pname)))) if p == 0 { panic("syscall: could not GetProcAddress for " + pname) @@ -96,6 +100,8 @@ func getSysProcAddr(m uint32, pname string) uintptr { return p } +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. @@ -110,22 +116,22 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, errno // windows api calls //sys GetLastError() (lasterrno int) -//sys LoadLibrary(libname string) (handle uint32, errno int) = LoadLibraryW -//sys FreeLibrary(handle uint32) (errno int) -//sys GetProcAddress(module uint32, procname string) (proc uint32, errno int) +//sys LoadLibrary(libname string) (handle Handle, errno int) = LoadLibraryW +//sys FreeLibrary(handle Handle) (errno int) +//sys GetProcAddress(module Handle, procname string) (proc Handle, errno int) //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 //sys ExitProcess(exitcode uint32) -//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle int32, errno int) [failretval==-1] = CreateFileW -//sys ReadFile(handle int32, buf []byte, done *uint32, overlapped *Overlapped) (errno int) -//sys WriteFile(handle int32, buf []byte, done *uint32, overlapped *Overlapped) (errno int) -//sys SetFilePointer(handle int32, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, errno int) [failretval==0xffffffff] -//sys CloseHandle(handle int32) (errno int) -//sys GetStdHandle(stdhandle int32) (handle int32, errno int) [failretval==-1] -//sys FindFirstFile(name *uint16, data *Win32finddata) (handle int32, errno int) [failretval==-1] = FindFirstFileW -//sys FindNextFile(handle int32, data *Win32finddata) (errno int) = FindNextFileW -//sys FindClose(handle int32) (errno int) -//sys GetFileInformationByHandle(handle int32, data *ByHandleFileInformation) (errno int) +//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, errno int) [failretval==InvalidHandle] = CreateFileW +//sys ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (errno int) +//sys WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (errno int) +//sys SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, errno int) [failretval==0xffffffff] +//sys CloseHandle(handle Handle) (errno int) +//sys GetStdHandle(stdhandle int) (handle Handle, errno int) [failretval==InvalidHandle] +//sys FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, errno int) [failretval==InvalidHandle] = FindFirstFileW +//sys FindNextFile(handle Handle, data *Win32finddata) (errno int) = FindNextFileW +//sys FindClose(handle Handle) (errno int) +//sys GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (errno int) //sys GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, errno int) = GetCurrentDirectoryW //sys SetCurrentDirectory(path *uint16) (errno int) = SetCurrentDirectoryW //sys CreateDirectory(path *uint16, sa *SecurityAttributes) (errno int) = CreateDirectoryW @@ -133,46 +139,47 @@ func Sendfile(outfd int, infd int, offset *int64, count int) (written int, errno //sys DeleteFile(path *uint16) (errno int) = DeleteFileW //sys MoveFile(from *uint16, to *uint16) (errno int) = MoveFileW //sys GetComputerName(buf *uint16, n *uint32) (errno int) = GetComputerNameW -//sys SetEndOfFile(handle int32) (errno int) +//sys SetEndOfFile(handle Handle) (errno int) //sys GetSystemTimeAsFileTime(time *Filetime) //sys sleep(msec uint32) = Sleep //sys GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, errno int) [failretval==0xffffffff] -//sys CreateIoCompletionPort(filehandle int32, cphandle int32, key uint32, threadcnt uint32) (handle int32, errno int) -//sys GetQueuedCompletionStatus(cphandle int32, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (errno int) -//sys CancelIo(s uint32) (errno int) +//sys CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, errno int) +//sys GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (errno int) +//sys CancelIo(s Handle) (errno int) //sys CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (errno int) = CreateProcessW -//sys OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle int32, errno int) -//sys TerminateProcess(handle int32, exitcode uint32) (errno int) -//sys GetExitCodeProcess(handle int32, exitcode *uint32) (errno int) +//sys OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, errno int) +//sys TerminateProcess(handle Handle, exitcode uint32) (errno int) +//sys GetExitCodeProcess(handle Handle, exitcode *uint32) (errno int) //sys GetStartupInfo(startupInfo *StartupInfo) (errno int) = GetStartupInfoW -//sys GetCurrentProcess() (pseudoHandle int32, errno int) -//sys DuplicateHandle(hSourceProcessHandle int32, hSourceHandle int32, hTargetProcessHandle int32, lpTargetHandle *int32, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (errno int) -//sys WaitForSingleObject(handle int32, waitMilliseconds uint32) (event uint32, errno int) [failretval==0xffffffff] +//sys GetCurrentProcess() (pseudoHandle Handle, errno int) +//sys DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (errno int) +//sys WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, errno int) [failretval==0xffffffff] //sys GetTempPath(buflen uint32, buf *uint16) (n uint32, errno int) = GetTempPathW -//sys CreatePipe(readhandle *uint32, writehandle *uint32, sa *SecurityAttributes, size uint32) (errno int) -//sys GetFileType(filehandle uint32) (n uint32, errno int) -//sys CryptAcquireContext(provhandle *uint32, container *uint16, provider *uint16, provtype uint32, flags uint32) (errno int) = advapi32.CryptAcquireContextW -//sys CryptReleaseContext(provhandle uint32, flags uint32) (errno int) = advapi32.CryptReleaseContext -//sys CryptGenRandom(provhandle uint32, buflen uint32, buf *byte) (errno int) = advapi32.CryptGenRandom +//sys CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (errno int) +//sys GetFileType(filehandle Handle) (n uint32, errno int) +//sys CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (errno int) = advapi32.CryptAcquireContextW +//sys CryptReleaseContext(provhandle Handle, flags uint32) (errno int) = advapi32.CryptReleaseContext +//sys CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (errno int) = advapi32.CryptGenRandom //sys GetEnvironmentStrings() (envs *uint16, errno int) [failretval==nil] = kernel32.GetEnvironmentStringsW //sys FreeEnvironmentStrings(envs *uint16) (errno int) = kernel32.FreeEnvironmentStringsW //sys GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, errno int) = kernel32.GetEnvironmentVariableW //sys SetEnvironmentVariable(name *uint16, value *uint16) (errno int) = kernel32.SetEnvironmentVariableW -//sys SetFileTime(handle int32, ctime *Filetime, atime *Filetime, wtime *Filetime) (errno int) +//sys SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (errno int) //sys GetFileAttributes(name *uint16) (attrs uint32, errno int) [failretval==INVALID_FILE_ATTRIBUTES] = kernel32.GetFileAttributesW //sys SetFileAttributes(name *uint16, attrs uint32) (errno int) = kernel32.SetFileAttributesW //sys GetCommandLine() (cmd *uint16) = kernel32.GetCommandLineW //sys CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, errno int) [failretval==nil] = shell32.CommandLineToArgvW -//sys LocalFree(hmem uint32) (handle uint32, errno int) [failretval!=0] -//sys SetHandleInformation(handle int32, mask uint32, flags uint32) (errno int) -//sys FlushFileBuffers(handle int32) (errno int) +//sys LocalFree(hmem Handle) (handle Handle, errno int) [failretval!=0] +//sys SetHandleInformation(handle Handle, mask uint32, flags uint32) (errno int) +//sys FlushFileBuffers(handle Handle) (errno int) //sys GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, errno int) = kernel32.GetFullPathNameW -//sys CreateFileMapping(fhandle int32, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle int32, errno int) = kernel32.CreateFileMappingW -//sys MapViewOfFile(handle int32, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, errno int) +//sys CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, errno int) = kernel32.CreateFileMappingW +//sys MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, errno int) //sys UnmapViewOfFile(addr uintptr) (errno int) //sys FlushViewOfFile(addr uintptr, length uintptr) (errno int) //sys VirtualLock(addr uintptr, length uintptr) (errno int) //sys VirtualUnlock(addr uintptr, length uintptr) (errno int) +//sys TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (errno int) = wsock32.TransmitFile // syscall interface implementation for other packages @@ -204,9 +211,9 @@ func makeInheritSa() *SecurityAttributes { return &sa } -func Open(path string, mode int, perm uint32) (fd int, errno int) { +func Open(path string, mode int, perm uint32) (fd Handle, errno int) { if len(path) == 0 { - return -1, ERROR_FILE_NOT_FOUND + return InvalidHandle, ERROR_FILE_NOT_FOUND } var access uint32 switch mode & (O_RDONLY | O_WRONLY | O_RDWR) { @@ -243,12 +250,12 @@ func Open(path string, mode int, perm uint32) (fd int, errno int) { createmode = OPEN_EXISTING } h, e := CreateFile(StringToUTF16Ptr(path), access, sharemode, sa, createmode, FILE_ATTRIBUTE_NORMAL, 0) - return int(h), int(e) + return h, int(e) } -func Read(fd int, p []byte) (n int, errno int) { +func Read(fd Handle, p []byte) (n int, errno int) { var done uint32 - e := ReadFile(int32(fd), p, &done, nil) + e := ReadFile(fd, p, &done, nil) if e != 0 { if e == ERROR_BROKEN_PIPE { // NOTE(brainman): work around ERROR_BROKEN_PIPE is returned on reading EOF from stdin @@ -259,16 +266,16 @@ func Read(fd int, p []byte) (n int, errno int) { return int(done), 0 } -func Write(fd int, p []byte) (n int, errno int) { +func Write(fd Handle, p []byte) (n int, errno int) { var done uint32 - e := WriteFile(int32(fd), p, &done, nil) + e := WriteFile(fd, p, &done, nil) if e != 0 { return 0, e } return int(done), 0 } -func Seek(fd int, offset int64, whence int) (newoffset int64, errno int) { +func Seek(fd Handle, offset int64, whence int) (newoffset int64, errno int) { var w uint32 switch whence { case 0: @@ -281,19 +288,19 @@ func Seek(fd int, offset int64, whence int) (newoffset int64, errno int) { hi := int32(offset >> 32) lo := int32(offset) // use GetFileType to check pipe, pipe can't do seek - ft, _ := GetFileType(uint32(fd)) + ft, _ := GetFileType(fd) if ft == FILE_TYPE_PIPE { return 0, EPIPE } - rlo, e := SetFilePointer(int32(fd), lo, &hi, w) + rlo, e := SetFilePointer(fd, lo, &hi, w) if e != 0 { return 0, e } return int64(hi)<<32 + int64(rlo), 0 } -func Close(fd int) (errno int) { - return CloseHandle(int32(fd)) +func Close(fd Handle) (errno int) { + return CloseHandle(fd) } var ( @@ -302,9 +309,9 @@ var ( Stderr = getStdHandle(STD_ERROR_HANDLE) ) -func getStdHandle(h int32) (fd int) { +func getStdHandle(h int) (fd Handle) { r, _ := GetStdHandle(h) - return int(r) + return r } func Stat(path string, stat *Stat_t) (errno int) { @@ -383,7 +390,7 @@ func ComputerName() (name string, errno int) { return string(utf16.Decode(b[0:n])), 0 } -func Ftruncate(fd int, length int64) (errno int) { +func Ftruncate(fd Handle, length int64) (errno int) { curoffset, e := Seek(fd, 0, 1) if e != 0 { return e @@ -393,7 +400,7 @@ func Ftruncate(fd int, length int64) (errno int) { if e != 0 { return e } - e = SetEndOfFile(int32(fd)) + e = SetEndOfFile(fd) if e != 0 { return e } @@ -412,17 +419,17 @@ func Sleep(nsec int64) (errno int) { return 0 } -func Pipe(p []int) (errno int) { +func Pipe(p []Handle) (errno int) { if len(p) != 2 { return EINVAL } - var r, w uint32 + var r, w Handle e := CreatePipe(&r, &w, makeInheritSa(), 0) if e != 0 { return e } - p[0] = int(r) - p[1] = int(w) + p[0] = r + p[1] = w return 0 } @@ -436,14 +443,14 @@ func Utimes(path string, tv []Timeval) (errno int) { if e != 0 { return e } - defer Close(int(h)) + defer Close(h) a := NsecToFiletime(tv[0].Nanoseconds()) w := NsecToFiletime(tv[1].Nanoseconds()) return SetFileTime(h, nil, &a, &w) } -func Fsync(fd int) (errno int) { - return FlushFileBuffers(int32(fd)) +func Fsync(fd Handle) (errno int) { + return FlushFileBuffers(fd) } func Chmod(path string, mode uint32) (errno int) { @@ -467,26 +474,29 @@ func Chmod(path string, mode uint32) (errno int) { //sys WSAStartup(verreq uint32, data *WSAData) (sockerrno int) = wsock32.WSAStartup //sys WSACleanup() (errno int) [failretval==-1] = wsock32.WSACleanup -//sys socket(af int32, typ int32, protocol int32) (handle int32, errno int) [failretval==-1] = wsock32.socket -//sys setsockopt(s int32, level int32, optname int32, optval *byte, optlen int32) (errno int) [failretval==-1] = wsock32.setsockopt -//sys bind(s int32, name uintptr, namelen int32) (errno int) [failretval==-1] = wsock32.bind -//sys connect(s int32, name uintptr, namelen int32) (errno int) [failretval==-1] = wsock32.connect -//sys getsockname(s int32, rsa *RawSockaddrAny, addrlen *int32) (errno int) [failretval==-1] = wsock32.getsockname -//sys getpeername(s int32, rsa *RawSockaddrAny, addrlen *int32) (errno int) [failretval==-1] = wsock32.getpeername -//sys listen(s int32, backlog int32) (errno int) [failretval==-1] = wsock32.listen -//sys shutdown(s int32, how int32) (errno int) [failretval==-1] = wsock32.shutdown -//sys Closesocket(s int32) (errno int) [failretval==-1] = wsock32.closesocket -//sys AcceptEx(ls uint32, as uint32, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (errno int) = wsock32.AcceptEx +//sys WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (errno int) [failretval==-1] = ws2_32.WSAIoctl +//sys socket(af int32, typ int32, protocol int32) (handle Handle, errno int) [failretval==InvalidHandle] = wsock32.socket +//sys setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (errno int) [failretval==-1] = wsock32.setsockopt +//sys bind(s Handle, name uintptr, namelen int32) (errno int) [failretval==-1] = wsock32.bind +//sys connect(s Handle, name uintptr, namelen int32) (errno int) [failretval==-1] = wsock32.connect +//sys getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (errno int) [failretval==-1] = wsock32.getsockname +//sys getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (errno int) [failretval==-1] = wsock32.getpeername +//sys listen(s Handle, backlog int32) (errno int) [failretval==-1] = wsock32.listen +//sys shutdown(s Handle, how int32) (errno int) [failretval==-1] = wsock32.shutdown +//sys Closesocket(s Handle) (errno int) [failretval==-1] = wsock32.closesocket +//sys AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (errno int) = wsock32.AcceptEx //sys GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) = wsock32.GetAcceptExSockaddrs -//sys WSARecv(s uint32, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (errno int) [failretval==-1] = ws2_32.WSARecv -//sys WSASend(s uint32, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (errno int) [failretval==-1] = ws2_32.WSASend -//sys WSARecvFrom(s uint32, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (errno int) [failretval==-1] = ws2_32.WSARecvFrom -//sys WSASendTo(s uint32, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (errno int) [failretval==-1] = ws2_32.WSASendTo +//sys WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (errno int) [failretval==-1] = ws2_32.WSARecv +//sys WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (errno int) [failretval==-1] = ws2_32.WSASend +//sys WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (errno int) [failretval==-1] = ws2_32.WSARecvFrom +//sys WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (errno int) [failretval==-1] = ws2_32.WSASendTo //sys GetHostByName(name string) (h *Hostent, errno int) [failretval==nil] = ws2_32.gethostbyname //sys GetServByName(name string, proto string) (s *Servent, errno int) [failretval==nil] = ws2_32.getservbyname //sys Ntohs(netshort uint16) (u uint16) = ws2_32.ntohs //sys DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status uint32) = dnsapi.DnsQuery_W //sys DnsRecordListFree(rl *DNSRecord, freetype uint32) = dnsapi.DnsRecordListFree +//sys GetIfEntry(pIfRow *MibIfRow) (errcode int) = iphlpapi.GetIfEntry +//sys GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode int) = iphlpapi.GetAdaptersInfo // For testing: clients can set this flag to force // creation of IPv6 sockets to return EAFNOSUPPORT. @@ -574,62 +584,62 @@ func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, int) { return nil, EAFNOSUPPORT } -func Socket(domain, typ, proto int) (fd, errno int) { +func Socket(domain, typ, proto int) (fd Handle, errno int) { if domain == AF_INET6 && SocketDisableIPv6 { - return -1, EAFNOSUPPORT + return InvalidHandle, EAFNOSUPPORT } h, e := socket(int32(domain), int32(typ), int32(proto)) - return int(h), int(e) + return h, int(e) } -func SetsockoptInt(fd, level, opt int, value int) (errno int) { +func SetsockoptInt(fd Handle, level, opt int, value int) (errno int) { v := int32(value) - return int(setsockopt(int32(fd), int32(level), int32(opt), (*byte)(unsafe.Pointer(&v)), int32(unsafe.Sizeof(v)))) + return int(setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(&v)), int32(unsafe.Sizeof(v)))) } -func Bind(fd int, sa Sockaddr) (errno int) { +func Bind(fd Handle, sa Sockaddr) (errno int) { ptr, n, err := sa.sockaddr() if err != 0 { return err } - return bind(int32(fd), ptr, n) + return bind(fd, ptr, n) } -func Connect(fd int, sa Sockaddr) (errno int) { +func Connect(fd Handle, sa Sockaddr) (errno int) { ptr, n, err := sa.sockaddr() if err != 0 { return err } - return connect(int32(fd), ptr, n) + return connect(fd, ptr, n) } -func Getsockname(fd int) (sa Sockaddr, errno int) { +func Getsockname(fd Handle) (sa Sockaddr, errno int) { var rsa RawSockaddrAny l := int32(unsafe.Sizeof(rsa)) - if errno = getsockname(int32(fd), &rsa, &l); errno != 0 { + if errno = getsockname(fd, &rsa, &l); errno != 0 { return } return rsa.Sockaddr() } -func Getpeername(fd int) (sa Sockaddr, errno int) { +func Getpeername(fd Handle) (sa Sockaddr, errno int) { var rsa RawSockaddrAny l := int32(unsafe.Sizeof(rsa)) - if errno = getpeername(int32(fd), &rsa, &l); errno != 0 { + if errno = getpeername(fd, &rsa, &l); errno != 0 { return } return rsa.Sockaddr() } -func Listen(s int, n int) (errno int) { - return int(listen(int32(s), int32(n))) +func Listen(s Handle, n int) (errno int) { + return int(listen(s, int32(n))) } -func Shutdown(fd, how int) (errno int) { - return int(shutdown(int32(fd), int32(how))) +func Shutdown(fd Handle, how int) (errno int) { + return int(shutdown(fd, int32(how))) } -func WSASendto(s uint32, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to Sockaddr, overlapped *Overlapped, croutine *byte) (errno int) { +func WSASendto(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to Sockaddr, overlapped *Overlapped, croutine *byte) (errno int) { rsa, l, err := to.sockaddr() if err != 0 { return err @@ -666,10 +676,12 @@ func (w WaitStatus) TrapCause() int { return -1 } // TODO(brainman): fix all needed for net -func Accept(fd int) (nfd int, sa Sockaddr, errno int) { return 0, nil, EWINDOWS } -func Recvfrom(fd int, p []byte, flags int) (n int, from Sockaddr, errno int) { return 0, nil, EWINDOWS } -func Sendto(fd int, p []byte, flags int, to Sockaddr) (errno int) { return EWINDOWS } -func SetsockoptTimeval(fd, level, opt int, tv *Timeval) (errno int) { return EWINDOWS } +func Accept(fd Handle) (nfd Handle, sa Sockaddr, errno int) { return 0, nil, EWINDOWS } +func Recvfrom(fd Handle, p []byte, flags int) (n int, from Sockaddr, errno int) { + return 0, nil, EWINDOWS +} +func Sendto(fd Handle, p []byte, flags int, to Sockaddr) (errno int) { return EWINDOWS } +func SetsockoptTimeval(fd Handle, level, opt int, tv *Timeval) (errno int) { return EWINDOWS } type Linger struct { Onoff int32 @@ -691,25 +703,25 @@ type IPv6Mreq struct { Interface uint32 } -func SetsockoptLinger(fd, level, opt int, l *Linger) (errno int) { return EWINDOWS } -func SetsockoptIPMreq(fd, level, opt int, mreq *IPMreq) (errno int) { return EWINDOWS } -func SetsockoptIPv6Mreq(fd, level, opt int, mreq *IPv6Mreq) (errno int) { return EWINDOWS } -func BindToDevice(fd int, device string) (errno int) { return EWINDOWS } +func SetsockoptLinger(fd Handle, level, opt int, l *Linger) (errno int) { return EWINDOWS } +func SetsockoptIPMreq(fd Handle, level, opt int, mreq *IPMreq) (errno int) { return EWINDOWS } +func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (errno int) { return EWINDOWS } +func BindToDevice(fd Handle, device string) (errno int) { return EWINDOWS } // TODO(brainman): fix all needed for os func Getpid() (pid int) { return -1 } func Getppid() (ppid int) { return -1 } -func Fchdir(fd int) (errno int) { return EWINDOWS } +func Fchdir(fd Handle) (errno int) { return EWINDOWS } func Link(oldpath, newpath string) (errno int) { return EWINDOWS } func Symlink(path, link string) (errno int) { return EWINDOWS } func Readlink(path string, buf []byte) (n int, errno int) { return 0, EWINDOWS } -func Fchmod(fd int, mode uint32) (errno int) { return EWINDOWS } +func Fchmod(fd Handle, mode uint32) (errno int) { return EWINDOWS } func Chown(path string, uid int, gid int) (errno int) { return EWINDOWS } func Lchown(path string, uid int, gid int) (errno int) { return EWINDOWS } -func Fchown(fd int, uid int, gid int) (errno int) { return EWINDOWS } +func Fchown(fd Handle, uid int, gid int) (errno int) { return EWINDOWS } func Getuid() (uid int) { return -1 } func Geteuid() (euid int) { return -1 } @@ -719,11 +731,11 @@ 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 int, buf *byte, nbuf int) (n int, errno int) { +func read(fd Handle, buf *byte, nbuf int) (n int, errno int) { return 0, EWINDOWS } -func fcntl(fd, cmd, arg int) (val int, errno int) { +func fcntl(fd Handle, cmd, arg int) (val int, errno int) { return 0, EWINDOWS } diff --git a/src/pkg/syscall/syscall_windows_386.go b/src/pkg/syscall/syscall_windows_386.go index 1ce025b31..61d2d8cb6 100644 --- a/src/pkg/syscall/syscall_windows_386.go +++ b/src/pkg/syscall/syscall_windows_386.go @@ -3,5 +3,3 @@ // license that can be found in the LICENSE file. package syscall - -func Getpagesize() int { return 4096 } diff --git a/src/pkg/syscall/syscall_windows_amd64.go b/src/pkg/syscall/syscall_windows_amd64.go new file mode 100644 index 000000000..61d2d8cb6 --- /dev/null +++ b/src/pkg/syscall/syscall_windows_amd64.go @@ -0,0 +1,5 @@ +// 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 diff --git a/src/pkg/syscall/types_linux.c b/src/pkg/syscall/types_linux.c index ce7f96764..abb2a91a7 100644 --- a/src/pkg/syscall/types_linux.c +++ b/src/pkg/syscall/types_linux.c @@ -38,6 +38,7 @@ Input to godefs. See also mkerrors.sh and mkall.sh #include <sys/user.h> #include <sys/utsname.h> #include <sys/wait.h> +#include <linux/filter.h> #include <linux/netlink.h> #include <linux/rtnetlink.h> #include <time.h> @@ -225,6 +226,16 @@ typedef struct ifaddrmsg $IfAddrmsg; typedef struct rtmsg $RtMsg; typedef struct rtnexthop $RtNexthop; +// Linux socket filter + +enum { + $SizeofSockFilter = sizeof(struct sock_filter), + $SizeofSockFprog = sizeof(struct sock_fprog), +}; + +typedef struct sock_filter $SockFilter; +typedef struct sock_fprog $SockFprog; + // Inotify typedef struct inotify_event $InotifyEvent; diff --git a/src/pkg/syscall/types_plan9.c b/src/pkg/syscall/types_plan9.c index 6308ce08b..1da9d377c 100644 --- a/src/pkg/syscall/types_plan9.c +++ b/src/pkg/syscall/types_plan9.c @@ -19,20 +19,18 @@ enum { OREAD = 0, // open for read OWRITE = 1, // write ORDWR = 2, // read and write - - $O_RDONLY = OREAD, - $O_WRONLY = OWRITE, - $O_RDWR = ORDWR, - OEXEC = 3, // execute, == read but check execute permission OTRUNC = 16, // or'ed in (except for exec), truncate file first OCEXEC = 32, // or'ed in, close on exec - - $O_CLOEXEC = OCEXEC, - ORCLOSE = 64, // or'ed in, remove on close OEXCL = 0x1000, // or'ed in, exclusive use (create only) - $O_EXCL = OEXCL, + + $O_RDONLY = OREAD, + $O_WRONLY = OWRITE, + $O_RDWR = ORDWR, + $O_TRUNC = OTRUNC, + $O_CLOEXEC = OCEXEC, + $O_EXCL = OEXCL, $STATMAX = 65535U, $ERRMAX = 128, diff --git a/src/pkg/syscall/zerrors_darwin_386.go b/src/pkg/syscall/zerrors_darwin_386.go index 5ee64ee70..33cc7fd88 100644 --- a/src/pkg/syscall/zerrors_darwin_386.go +++ b/src/pkg/syscall/zerrors_darwin_386.go @@ -165,6 +165,13 @@ const ( EBUSY = 0x10 ECANCELED = 0x59 ECHILD = 0xa + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 ECONNABORTED = 0x35 ECONNREFUSED = 0x3d ECONNRESET = 0x36 @@ -282,6 +289,9 @@ const ( EV_TRIGGER = 0x100 EWOULDBLOCK = 0x23 EXDEV = 0x12 + EXTA = 0x4b00 + EXTB = 0x9600 + EXTPROC = 0x800 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 F_ADDFILESIGS = 0x3d @@ -709,6 +719,24 @@ const ( PROT_NONE = 0 PROT_READ = 0x1 PROT_WRITE = 0x2 + PT_ATTACH = 0xa + PT_ATTACHEXC = 0xe + PT_CONTINUE = 0x7 + PT_DENY_ATTACH = 0x1f + PT_DETACH = 0xb + PT_FIRSTMACH = 0x20 + PT_FORCEQUOTA = 0x1e + PT_KILL = 0x8 + PT_READ_D = 0x2 + PT_READ_I = 0x1 + PT_READ_U = 0x3 + PT_SIGEXC = 0xc + PT_STEP = 0x9 + PT_THUPDATE = 0xd + PT_TRACE_ME = 0 + PT_WRITE_D = 0x5 + PT_WRITE_I = 0x4 + PT_WRITE_U = 0x6 RTAX_AUTHOR = 0x6 RTAX_BRD = 0x7 RTAX_DST = 0 @@ -978,6 +1006,75 @@ const ( TCP_NODELAY = 0x1 TCP_NOOPT = 0x8 TCP_NOPUSH = 0x4 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCONS = 0x80047462 + TIOCDCDTIMESTAMP = 0x40087458 + TIOCDRAIN = 0x2000745e + TIOCDSIMICROCODE = 0x20007455 + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLUSH = 0x80047410 + TIOCGDRAINWAIT = 0x40047456 + TIOCGETA = 0x402c7413 + TIOCGETD = 0x4004741a + TIOCGPGRP = 0x40047477 + TIOCGWINSZ = 0x40087468 + TIOCIXOFF = 0x20007480 + TIOCIXON = 0x20007481 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGDTRWAIT = 0x4004745a + TIOCMGET = 0x4004746a + TIOCMODG = 0x40047403 + TIOCMODS = 0x80047404 + TIOCMSDTRWAIT = 0x8004745b + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCPTYGNAME = 0x40807453 + TIOCPTYGRANT = 0x20007454 + TIOCPTYUNLK = 0x20007452 + TIOCREMOTE = 0x80047469 + TIOCSBRK = 0x2000747b + TIOCSCONS = 0x20007463 + TIOCSCTTY = 0x20007461 + TIOCSDRAINWAIT = 0x80047457 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x802c7414 + TIOCSETAF = 0x802c7416 + TIOCSETAW = 0x802c7415 + TIOCSETD = 0x8004741b + TIOCSIG = 0x2000745f + TIOCSPGRP = 0x80047476 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x20007465 + TIOCSTI = 0x80017472 + TIOCSTOP = 0x2000746f + TIOCSWINSZ = 0x80087467 + TIOCTIMESTAMP = 0x40087459 + TIOCUCNTL = 0x80047466 WCONTINUED = 0x10 WCOREFLAG = 0x80 WEXITED = 0x4 diff --git a/src/pkg/syscall/zerrors_darwin_amd64.go b/src/pkg/syscall/zerrors_darwin_amd64.go index 65a48d6e7..571ce907c 100644 --- a/src/pkg/syscall/zerrors_darwin_amd64.go +++ b/src/pkg/syscall/zerrors_darwin_amd64.go @@ -1,7 +1,7 @@ -// mkerrors.sh +// mkerrors.sh -f -m64 // MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// godefs -c gcc -gsyscall _const.c +// godefs -c gcc -f -m64 -gsyscall -f -m64 _const.c // MACHINE GENERATED - DO NOT EDIT. @@ -165,6 +165,13 @@ const ( EBUSY = 0x10 ECANCELED = 0x59 ECHILD = 0xa + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 ECONNABORTED = 0x35 ECONNREFUSED = 0x3d ECONNRESET = 0x36 @@ -282,6 +289,9 @@ const ( EV_TRIGGER = 0x100 EWOULDBLOCK = 0x23 EXDEV = 0x12 + EXTA = 0x4b00 + EXTB = 0x9600 + EXTPROC = 0x800 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 F_ADDFILESIGS = 0x3d @@ -709,6 +719,24 @@ const ( PROT_NONE = 0 PROT_READ = 0x1 PROT_WRITE = 0x2 + PT_ATTACH = 0xa + PT_ATTACHEXC = 0xe + PT_CONTINUE = 0x7 + PT_DENY_ATTACH = 0x1f + PT_DETACH = 0xb + PT_FIRSTMACH = 0x20 + PT_FORCEQUOTA = 0x1e + PT_KILL = 0x8 + PT_READ_D = 0x2 + PT_READ_I = 0x1 + PT_READ_U = 0x3 + PT_SIGEXC = 0xc + PT_STEP = 0x9 + PT_THUPDATE = 0xd + PT_TRACE_ME = 0 + PT_WRITE_D = 0x5 + PT_WRITE_I = 0x4 + PT_WRITE_U = 0x6 RTAX_AUTHOR = 0x6 RTAX_BRD = 0x7 RTAX_DST = 0 @@ -978,6 +1006,75 @@ const ( TCP_NODELAY = 0x1 TCP_NOOPT = 0x8 TCP_NOPUSH = 0x4 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCONS = 0x80047462 + TIOCDCDTIMESTAMP = 0x40107458 + TIOCDRAIN = 0x2000745e + TIOCDSIMICROCODE = 0x20007455 + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLUSH = 0x80047410 + TIOCGDRAINWAIT = 0x40047456 + TIOCGETA = 0x40487413 + TIOCGETD = 0x4004741a + TIOCGPGRP = 0x40047477 + TIOCGWINSZ = 0x40087468 + TIOCIXOFF = 0x20007480 + TIOCIXON = 0x20007481 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGDTRWAIT = 0x4004745a + TIOCMGET = 0x4004746a + TIOCMODG = 0x40047403 + TIOCMODS = 0x80047404 + TIOCMSDTRWAIT = 0x8004745b + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCPTYGNAME = 0x40807453 + TIOCPTYGRANT = 0x20007454 + TIOCPTYUNLK = 0x20007452 + TIOCREMOTE = 0x80047469 + TIOCSBRK = 0x2000747b + TIOCSCONS = 0x20007463 + TIOCSCTTY = 0x20007461 + TIOCSDRAINWAIT = 0x80047457 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x80487414 + TIOCSETAF = 0x80487416 + TIOCSETAW = 0x80487415 + TIOCSETD = 0x8004741b + TIOCSIG = 0x2000745f + TIOCSPGRP = 0x80047476 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x20007465 + TIOCSTI = 0x80017472 + TIOCSTOP = 0x2000746f + TIOCSWINSZ = 0x80087467 + TIOCTIMESTAMP = 0x40107459 + TIOCUCNTL = 0x80047466 WCONTINUED = 0x10 WCOREFLAG = 0x80 WEXITED = 0x4 diff --git a/src/pkg/syscall/zerrors_freebsd_386.go b/src/pkg/syscall/zerrors_freebsd_386.go index 52e42487b..d045cab08 100644 --- a/src/pkg/syscall/zerrors_freebsd_386.go +++ b/src/pkg/syscall/zerrors_freebsd_386.go @@ -327,6 +327,13 @@ const ( EBUSY = 0x10 ECANCELED = 0x55 ECHILD = 0xa + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 ECONNABORTED = 0x35 ECONNREFUSED = 0x3d ECONNRESET = 0x36 @@ -432,6 +439,9 @@ const ( EV_SYSFLAGS = 0xf000 EWOULDBLOCK = 0x23 EXDEV = 0x12 + EXTA = 0x4b00 + EXTB = 0x9600 + EXTPROC = 0x800 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 F_CANCEL = 0x5 @@ -1224,6 +1234,68 @@ const ( TCP_NODELAY = 0x1 TCP_NOOPT = 0x8 TCP_NOPUSH = 0x4 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCONS = 0x80047462 + TIOCDRAIN = 0x2000745e + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLUSH = 0x80047410 + TIOCGDRAINWAIT = 0x40047456 + TIOCGETA = 0x402c7413 + TIOCGETD = 0x4004741a + TIOCGPGRP = 0x40047477 + TIOCGPTN = 0x4004740f + TIOCGSID = 0x40047463 + TIOCGWINSZ = 0x40087468 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGDTRWAIT = 0x4004745a + TIOCMGET = 0x4004746a + TIOCMSDTRWAIT = 0x8004745b + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DCD = 0x40 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCPTMASTER = 0x2000741c + TIOCSBRK = 0x2000747b + TIOCSCTTY = 0x20007461 + TIOCSDRAINWAIT = 0x80047457 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x802c7414 + TIOCSETAF = 0x802c7416 + TIOCSETAW = 0x802c7415 + TIOCSETD = 0x8004741b + TIOCSIG = 0x2004745f + TIOCSPGRP = 0x80047476 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x20007465 + TIOCSTI = 0x80017472 + TIOCSTOP = 0x2000746f + TIOCSWINSZ = 0x80087467 + TIOCTIMESTAMP = 0x40087459 + TIOCUCNTL = 0x80047466 WCONTINUED = 0x4 WCOREFLAG = 0x80 WLINUXCLONE = 0x80000000 diff --git a/src/pkg/syscall/zerrors_freebsd_amd64.go b/src/pkg/syscall/zerrors_freebsd_amd64.go index 9b632ba93..871b3818c 100644 --- a/src/pkg/syscall/zerrors_freebsd_amd64.go +++ b/src/pkg/syscall/zerrors_freebsd_amd64.go @@ -327,6 +327,13 @@ const ( EBUSY = 0x10 ECANCELED = 0x55 ECHILD = 0xa + ECHO = 0x8 + ECHOCTL = 0x40 + ECHOE = 0x2 + ECHOK = 0x4 + ECHOKE = 0x1 + ECHONL = 0x10 + ECHOPRT = 0x20 ECONNABORTED = 0x35 ECONNREFUSED = 0x3d ECONNRESET = 0x36 @@ -432,6 +439,9 @@ const ( EV_SYSFLAGS = 0xf000 EWOULDBLOCK = 0x23 EXDEV = 0x12 + EXTA = 0x4b00 + EXTB = 0x9600 + EXTPROC = 0x800 FD_CLOEXEC = 0x1 FD_SETSIZE = 0x400 F_CANCEL = 0x5 @@ -1224,6 +1234,68 @@ const ( TCP_NODELAY = 0x1 TCP_NOOPT = 0x8 TCP_NOPUSH = 0x4 + TIOCCBRK = 0x2000747a + TIOCCDTR = 0x20007478 + TIOCCONS = 0x80047462 + TIOCDRAIN = 0x2000745e + TIOCEXCL = 0x2000740d + TIOCEXT = 0x80047460 + TIOCFLUSH = 0x80047410 + TIOCGDRAINWAIT = 0x40047456 + TIOCGETA = 0x402c7413 + TIOCGETD = 0x4004741a + TIOCGPGRP = 0x40047477 + TIOCGPTN = 0x4004740f + TIOCGSID = 0x40047463 + TIOCGWINSZ = 0x40087468 + TIOCMBIC = 0x8004746b + TIOCMBIS = 0x8004746c + TIOCMGDTRWAIT = 0x4004745a + TIOCMGET = 0x4004746a + TIOCMSDTRWAIT = 0x8004745b + TIOCMSET = 0x8004746d + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DCD = 0x40 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x20007471 + TIOCNXCL = 0x2000740e + TIOCOUTQ = 0x40047473 + TIOCPKT = 0x80047470 + TIOCPKT_DATA = 0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_IOCTL = 0x40 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCPTMASTER = 0x2000741c + TIOCSBRK = 0x2000747b + TIOCSCTTY = 0x20007461 + TIOCSDRAINWAIT = 0x80047457 + TIOCSDTR = 0x20007479 + TIOCSETA = 0x802c7414 + TIOCSETAF = 0x802c7416 + TIOCSETAW = 0x802c7415 + TIOCSETD = 0x8004741b + TIOCSIG = 0x2004745f + TIOCSPGRP = 0x80047476 + TIOCSTART = 0x2000746e + TIOCSTAT = 0x20007465 + TIOCSTI = 0x80017472 + TIOCSTOP = 0x2000746f + TIOCSWINSZ = 0x80087467 + TIOCTIMESTAMP = 0x40107459 + TIOCUCNTL = 0x80047466 WCONTINUED = 0x4 WCOREFLAG = 0x80 WLINUXCLONE = 0x80000000 diff --git a/src/pkg/syscall/zerrors_linux_386.go b/src/pkg/syscall/zerrors_linux_386.go index 73caed44c..298754052 100644 --- a/src/pkg/syscall/zerrors_linux_386.go +++ b/src/pkg/syscall/zerrors_linux_386.go @@ -106,6 +106,46 @@ const ( ARPHRD_TUNNEL6 = 0x301 ARPHRD_VOID = 0xffff ARPHRD_X25 = 0x10f + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_DIV = 0x30 + BPF_H = 0x8 + BPF_IMM = 0 + BPF_IND = 0x40 + BPF_JA = 0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0 + BPF_LD = 0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXINSNS = 0x1000 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_OR = 0x40 + BPF_RET = 0x6 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0 + BPF_TXA = 0x80 + BPF_W = 0 + BPF_X = 0x8 DT_BLK = 0x6 DT_CHR = 0x2 DT_DIR = 0x4 @@ -256,6 +296,68 @@ const ( ESRMNT = 0x45 ESTALE = 0x74 ESTRPIPE = 0x56 + ETH_P_1588 = 0x88f7 + ETH_P_8021Q = 0x8100 + ETH_P_802_2 = 0x4 + ETH_P_802_3 = 0x1 + ETH_P_AARP = 0x80f3 + ETH_P_ALL = 0x3 + ETH_P_AOE = 0x88a2 + ETH_P_ARCNET = 0x1a + ETH_P_ARP = 0x806 + ETH_P_ATALK = 0x809b + ETH_P_ATMFATE = 0x8884 + ETH_P_ATMMPOA = 0x884c + ETH_P_AX25 = 0x2 + ETH_P_BPQ = 0x8ff + ETH_P_CAN = 0xc + ETH_P_CONTROL = 0x16 + ETH_P_CUST = 0x6006 + ETH_P_DDCMP = 0x6 + ETH_P_DEC = 0x6000 + ETH_P_DIAG = 0x6005 + ETH_P_DNA_DL = 0x6001 + ETH_P_DNA_RC = 0x6002 + ETH_P_DNA_RT = 0x6003 + ETH_P_DSA = 0x1b + ETH_P_ECONET = 0x18 + ETH_P_EDSA = 0xdada + ETH_P_FCOE = 0x8906 + ETH_P_FIP = 0x8914 + ETH_P_HDLC = 0x19 + ETH_P_IEEE802154 = 0xf6 + ETH_P_IEEEPUP = 0xa00 + ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IP = 0x800 + ETH_P_IPV6 = 0x86dd + ETH_P_IPX = 0x8137 + ETH_P_IRDA = 0x17 + ETH_P_LAT = 0x6004 + ETH_P_LOCALTALK = 0x9 + ETH_P_LOOP = 0x60 + ETH_P_MOBITEX = 0x15 + ETH_P_MPLS_MC = 0x8848 + ETH_P_MPLS_UC = 0x8847 + ETH_P_PAE = 0x888e + ETH_P_PAUSE = 0x8808 + ETH_P_PHONET = 0xf5 + ETH_P_PPPTALK = 0x10 + ETH_P_PPP_DISC = 0x8863 + ETH_P_PPP_MP = 0x8 + ETH_P_PPP_SES = 0x8864 + ETH_P_PUP = 0x200 + ETH_P_PUPAT = 0x201 + ETH_P_RARP = 0x8035 + ETH_P_SCA = 0x6007 + ETH_P_SLOW = 0x8809 + ETH_P_SNAP = 0x5 + ETH_P_TEB = 0x6558 + ETH_P_TIPC = 0x88ca + ETH_P_TRAILER = 0x1c + ETH_P_TR_802_2 = 0x11 + ETH_P_WAN_PPP = 0x7 + ETH_P_WCCP = 0x883e + ETH_P_X25 = 0x805 ETIME = 0x3e ETIMEDOUT = 0x6e ETOOMANYREFS = 0x6d @@ -1002,6 +1104,69 @@ const ( TCP_QUICKACK = 0xc TCP_SYNCNT = 0x7 TCP_WINDOW_CLAMP = 0xa + TIOCCBRK = 0x5428 + TIOCCONS = 0x541d + TIOCEXCL = 0x540c + TIOCGETD = 0x5424 + TIOCGHAYESESP = 0x545e + TIOCGICOUNT = 0x545d + TIOCGLCKTRMIOS = 0x5456 + TIOCGPGRP = 0x540f + TIOCGPTN = 0x80045430 + TIOCGRS485 = 0x542e + TIOCGSERIAL = 0x541e + TIOCGSID = 0x5429 + TIOCGSOFTCAR = 0x5419 + TIOCGWINSZ = 0x5413 + TIOCINQ = 0x541b + TIOCLINUX = 0x541c + TIOCMBIC = 0x5417 + TIOCMBIS = 0x5416 + TIOCMGET = 0x5415 + TIOCMIWAIT = 0x545c + TIOCMSET = 0x5418 + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x5422 + TIOCNXCL = 0x540d + TIOCOUTQ = 0x5411 + TIOCPKT = 0x5420 + TIOCPKT_DATA = 0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCSBRK = 0x5427 + TIOCSCTTY = 0x540e + TIOCSERCONFIG = 0x5453 + TIOCSERGETLSR = 0x5459 + TIOCSERGETMULTI = 0x545a + TIOCSERGSTRUCT = 0x5458 + TIOCSERGWILD = 0x5454 + TIOCSERSETMULTI = 0x545b + TIOCSERSWILD = 0x5455 + TIOCSER_TEMT = 0x1 + TIOCSETD = 0x5423 + TIOCSHAYESESP = 0x545f + TIOCSLCKTRMIOS = 0x5457 + TIOCSPGRP = 0x5410 + TIOCSPTLCK = 0x40045431 + TIOCSRS485 = 0x542f + TIOCSSERIAL = 0x541f + TIOCSSOFTCAR = 0x541a + TIOCSTI = 0x5412 + TIOCSWINSZ = 0x5414 TUNGETFEATURES = 0x800454cf TUNGETIFF = 0x800454d2 TUNGETSNDBUF = 0x800454d3 diff --git a/src/pkg/syscall/zerrors_linux_amd64.go b/src/pkg/syscall/zerrors_linux_amd64.go index 89260740d..728eefdde 100644 --- a/src/pkg/syscall/zerrors_linux_amd64.go +++ b/src/pkg/syscall/zerrors_linux_amd64.go @@ -106,6 +106,46 @@ const ( ARPHRD_TUNNEL6 = 0x301 ARPHRD_VOID = 0xffff ARPHRD_X25 = 0x10f + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_DIV = 0x30 + BPF_H = 0x8 + BPF_IMM = 0 + BPF_IND = 0x40 + BPF_JA = 0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0 + BPF_LD = 0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXINSNS = 0x1000 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_OR = 0x40 + BPF_RET = 0x6 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0 + BPF_TXA = 0x80 + BPF_W = 0 + BPF_X = 0x8 DT_BLK = 0x6 DT_CHR = 0x2 DT_DIR = 0x4 @@ -256,6 +296,68 @@ const ( ESRMNT = 0x45 ESTALE = 0x74 ESTRPIPE = 0x56 + ETH_P_1588 = 0x88f7 + ETH_P_8021Q = 0x8100 + ETH_P_802_2 = 0x4 + ETH_P_802_3 = 0x1 + ETH_P_AARP = 0x80f3 + ETH_P_ALL = 0x3 + ETH_P_AOE = 0x88a2 + ETH_P_ARCNET = 0x1a + ETH_P_ARP = 0x806 + ETH_P_ATALK = 0x809b + ETH_P_ATMFATE = 0x8884 + ETH_P_ATMMPOA = 0x884c + ETH_P_AX25 = 0x2 + ETH_P_BPQ = 0x8ff + ETH_P_CAN = 0xc + ETH_P_CONTROL = 0x16 + ETH_P_CUST = 0x6006 + ETH_P_DDCMP = 0x6 + ETH_P_DEC = 0x6000 + ETH_P_DIAG = 0x6005 + ETH_P_DNA_DL = 0x6001 + ETH_P_DNA_RC = 0x6002 + ETH_P_DNA_RT = 0x6003 + ETH_P_DSA = 0x1b + ETH_P_ECONET = 0x18 + ETH_P_EDSA = 0xdada + ETH_P_FCOE = 0x8906 + ETH_P_FIP = 0x8914 + ETH_P_HDLC = 0x19 + ETH_P_IEEE802154 = 0xf6 + ETH_P_IEEEPUP = 0xa00 + ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IP = 0x800 + ETH_P_IPV6 = 0x86dd + ETH_P_IPX = 0x8137 + ETH_P_IRDA = 0x17 + ETH_P_LAT = 0x6004 + ETH_P_LOCALTALK = 0x9 + ETH_P_LOOP = 0x60 + ETH_P_MOBITEX = 0x15 + ETH_P_MPLS_MC = 0x8848 + ETH_P_MPLS_UC = 0x8847 + ETH_P_PAE = 0x888e + ETH_P_PAUSE = 0x8808 + ETH_P_PHONET = 0xf5 + ETH_P_PPPTALK = 0x10 + ETH_P_PPP_DISC = 0x8863 + ETH_P_PPP_MP = 0x8 + ETH_P_PPP_SES = 0x8864 + ETH_P_PUP = 0x200 + ETH_P_PUPAT = 0x201 + ETH_P_RARP = 0x8035 + ETH_P_SCA = 0x6007 + ETH_P_SLOW = 0x8809 + ETH_P_SNAP = 0x5 + ETH_P_TEB = 0x6558 + ETH_P_TIPC = 0x88ca + ETH_P_TRAILER = 0x1c + ETH_P_TR_802_2 = 0x11 + ETH_P_WAN_PPP = 0x7 + ETH_P_WCCP = 0x883e + ETH_P_X25 = 0x805 ETIME = 0x3e ETIMEDOUT = 0x6e ETOOMANYREFS = 0x6d @@ -1003,6 +1105,69 @@ const ( TCP_QUICKACK = 0xc TCP_SYNCNT = 0x7 TCP_WINDOW_CLAMP = 0xa + TIOCCBRK = 0x5428 + TIOCCONS = 0x541d + TIOCEXCL = 0x540c + TIOCGETD = 0x5424 + TIOCGHAYESESP = 0x545e + TIOCGICOUNT = 0x545d + TIOCGLCKTRMIOS = 0x5456 + TIOCGPGRP = 0x540f + TIOCGPTN = 0x80045430 + TIOCGRS485 = 0x542e + TIOCGSERIAL = 0x541e + TIOCGSID = 0x5429 + TIOCGSOFTCAR = 0x5419 + TIOCGWINSZ = 0x5413 + TIOCINQ = 0x541b + TIOCLINUX = 0x541c + TIOCMBIC = 0x5417 + TIOCMBIS = 0x5416 + TIOCMGET = 0x5415 + TIOCMIWAIT = 0x545c + TIOCMSET = 0x5418 + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x5422 + TIOCNXCL = 0x540d + TIOCOUTQ = 0x5411 + TIOCPKT = 0x5420 + TIOCPKT_DATA = 0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCSBRK = 0x5427 + TIOCSCTTY = 0x540e + TIOCSERCONFIG = 0x5453 + TIOCSERGETLSR = 0x5459 + TIOCSERGETMULTI = 0x545a + TIOCSERGSTRUCT = 0x5458 + TIOCSERGWILD = 0x5454 + TIOCSERSETMULTI = 0x545b + TIOCSERSWILD = 0x5455 + TIOCSER_TEMT = 0x1 + TIOCSETD = 0x5423 + TIOCSHAYESESP = 0x545f + TIOCSLCKTRMIOS = 0x5457 + TIOCSPGRP = 0x5410 + TIOCSPTLCK = 0x40045431 + TIOCSRS485 = 0x542f + TIOCSSERIAL = 0x541f + TIOCSSOFTCAR = 0x541a + TIOCSTI = 0x5412 + TIOCSWINSZ = 0x5414 TUNGETFEATURES = 0x800454cf TUNGETIFF = 0x800454d2 TUNGETSNDBUF = 0x800454d3 diff --git a/src/pkg/syscall/zerrors_linux_arm.go b/src/pkg/syscall/zerrors_linux_arm.go index 50cdaf18a..7d572712f 100644 --- a/src/pkg/syscall/zerrors_linux_arm.go +++ b/src/pkg/syscall/zerrors_linux_arm.go @@ -106,6 +106,46 @@ const ( ARPHRD_TUNNEL6 = 0x301 ARPHRD_VOID = 0xffff ARPHRD_X25 = 0x10f + BPF_A = 0x10 + BPF_ABS = 0x20 + BPF_ADD = 0 + BPF_ALU = 0x4 + BPF_AND = 0x50 + BPF_B = 0x10 + BPF_DIV = 0x30 + BPF_H = 0x8 + BPF_IMM = 0 + BPF_IND = 0x40 + BPF_JA = 0 + BPF_JEQ = 0x10 + BPF_JGE = 0x30 + BPF_JGT = 0x20 + BPF_JMP = 0x5 + BPF_JSET = 0x40 + BPF_K = 0 + BPF_LD = 0 + BPF_LDX = 0x1 + BPF_LEN = 0x80 + BPF_LSH = 0x60 + BPF_MAJOR_VERSION = 0x1 + BPF_MAXINSNS = 0x1000 + BPF_MEM = 0x60 + BPF_MEMWORDS = 0x10 + BPF_MINOR_VERSION = 0x1 + BPF_MISC = 0x7 + BPF_MSH = 0xa0 + BPF_MUL = 0x20 + BPF_NEG = 0x80 + BPF_OR = 0x40 + BPF_RET = 0x6 + BPF_RSH = 0x70 + BPF_ST = 0x2 + BPF_STX = 0x3 + BPF_SUB = 0x10 + BPF_TAX = 0 + BPF_TXA = 0x80 + BPF_W = 0 + BPF_X = 0x8 DT_BLK = 0x6 DT_CHR = 0x2 DT_DIR = 0x4 @@ -258,6 +298,68 @@ const ( ESRMNT = 0x45 ESTALE = 0x74 ESTRPIPE = 0x56 + ETH_P_1588 = 0x88f7 + ETH_P_8021Q = 0x8100 + ETH_P_802_2 = 0x4 + ETH_P_802_3 = 0x1 + ETH_P_AARP = 0x80f3 + ETH_P_ALL = 0x3 + ETH_P_AOE = 0x88a2 + ETH_P_ARCNET = 0x1a + ETH_P_ARP = 0x806 + ETH_P_ATALK = 0x809b + ETH_P_ATMFATE = 0x8884 + ETH_P_ATMMPOA = 0x884c + ETH_P_AX25 = 0x2 + ETH_P_BPQ = 0x8ff + ETH_P_CAN = 0xc + ETH_P_CONTROL = 0x16 + ETH_P_CUST = 0x6006 + ETH_P_DDCMP = 0x6 + ETH_P_DEC = 0x6000 + ETH_P_DIAG = 0x6005 + ETH_P_DNA_DL = 0x6001 + ETH_P_DNA_RC = 0x6002 + ETH_P_DNA_RT = 0x6003 + ETH_P_DSA = 0x1b + ETH_P_ECONET = 0x18 + ETH_P_EDSA = 0xdada + ETH_P_FCOE = 0x8906 + ETH_P_FIP = 0x8914 + ETH_P_HDLC = 0x19 + ETH_P_IEEE802154 = 0xf6 + ETH_P_IEEEPUP = 0xa00 + ETH_P_IEEEPUPAT = 0xa01 + ETH_P_IP = 0x800 + ETH_P_IPV6 = 0x86dd + ETH_P_IPX = 0x8137 + ETH_P_IRDA = 0x17 + ETH_P_LAT = 0x6004 + ETH_P_LOCALTALK = 0x9 + ETH_P_LOOP = 0x60 + ETH_P_MOBITEX = 0x15 + ETH_P_MPLS_MC = 0x8848 + ETH_P_MPLS_UC = 0x8847 + ETH_P_PAE = 0x888e + ETH_P_PAUSE = 0x8808 + ETH_P_PHONET = 0xf5 + ETH_P_PPPTALK = 0x10 + ETH_P_PPP_DISC = 0x8863 + ETH_P_PPP_MP = 0x8 + ETH_P_PPP_SES = 0x8864 + ETH_P_PUP = 0x200 + ETH_P_PUPAT = 0x201 + ETH_P_RARP = 0x8035 + ETH_P_SCA = 0x6007 + ETH_P_SLOW = 0x8809 + ETH_P_SNAP = 0x5 + ETH_P_TEB = 0x6558 + ETH_P_TIPC = 0x88ca + ETH_P_TRAILER = 0x1c + ETH_P_TR_802_2 = 0x11 + ETH_P_WAN_PPP = 0x7 + ETH_P_WCCP = 0x883e + ETH_P_X25 = 0x805 ETIME = 0x3e ETIMEDOUT = 0x6e ETOOMANYREFS = 0x6d @@ -696,6 +798,9 @@ const ( PTRACE_SINGLESTEP = 0x9 PTRACE_SYSCALL = 0x18 PTRACE_TRACEME = 0 + PT_DATA_ADDR = 0x10004 + PT_TEXT_ADDR = 0x10000 + PT_TEXT_END_ADDR = 0x10008 RTAX_ADVMSS = 0x8 RTAX_CWND = 0x7 RTAX_FEATURES = 0xc @@ -993,6 +1098,65 @@ const ( TCP_QUICKACK = 0xc TCP_SYNCNT = 0x7 TCP_WINDOW_CLAMP = 0xa + TIOCCBRK = 0x5428 + TIOCCONS = 0x541d + TIOCEXCL = 0x540c + TIOCGETD = 0x5424 + TIOCGICOUNT = 0x545d + TIOCGLCKTRMIOS = 0x5456 + TIOCGPGRP = 0x540f + TIOCGPTN = 0x80045430 + TIOCGSERIAL = 0x541e + TIOCGSID = 0x5429 + TIOCGSOFTCAR = 0x5419 + TIOCGWINSZ = 0x5413 + TIOCINQ = 0x541b + TIOCLINUX = 0x541c + TIOCMBIC = 0x5417 + TIOCMBIS = 0x5416 + TIOCMGET = 0x5415 + TIOCMIWAIT = 0x545c + TIOCMSET = 0x5418 + TIOCM_CAR = 0x40 + TIOCM_CD = 0x40 + TIOCM_CTS = 0x20 + TIOCM_DSR = 0x100 + TIOCM_DTR = 0x2 + TIOCM_LE = 0x1 + TIOCM_RI = 0x80 + TIOCM_RNG = 0x80 + TIOCM_RTS = 0x4 + TIOCM_SR = 0x10 + TIOCM_ST = 0x8 + TIOCNOTTY = 0x5422 + TIOCNXCL = 0x540d + TIOCOUTQ = 0x5411 + TIOCPKT = 0x5420 + TIOCPKT_DATA = 0 + TIOCPKT_DOSTOP = 0x20 + TIOCPKT_FLUSHREAD = 0x1 + TIOCPKT_FLUSHWRITE = 0x2 + TIOCPKT_NOSTOP = 0x10 + TIOCPKT_START = 0x8 + TIOCPKT_STOP = 0x4 + TIOCSBRK = 0x5427 + TIOCSCTTY = 0x540e + TIOCSERCONFIG = 0x5453 + TIOCSERGETLSR = 0x5459 + TIOCSERGETMULTI = 0x545a + TIOCSERGSTRUCT = 0x5458 + TIOCSERGWILD = 0x5454 + TIOCSERSETMULTI = 0x545b + TIOCSERSWILD = 0x5455 + TIOCSER_TEMT = 0x1 + TIOCSETD = 0x5423 + TIOCSLCKTRMIOS = 0x5457 + TIOCSPGRP = 0x5410 + TIOCSPTLCK = 0x40045431 + TIOCSSERIAL = 0x541f + TIOCSSOFTCAR = 0x541a + TIOCSTI = 0x5412 + TIOCSWINSZ = 0x5414 TUNGETFEATURES = 0x800454cf TUNGETIFF = 0x800454d2 TUNGETSNDBUF = 0x800454d3 diff --git a/src/pkg/syscall/zerrors_plan9_386.go b/src/pkg/syscall/zerrors_plan9_386.go index 78b5c72bb..e452079f5 100644 --- a/src/pkg/syscall/zerrors_plan9_386.go +++ b/src/pkg/syscall/zerrors_plan9_386.go @@ -4,10 +4,9 @@ package syscall const ( // Invented values to support what package os expects. O_CREAT = 0x02000 + O_APPEND = 0x00400 O_NOCTTY = 0x00000 - O_TRUNC = 0x00000 O_NONBLOCK = 0x00000 - O_APPEND = 0x00000 O_SYNC = 0x00000 O_ASYNC = 0x00000 diff --git a/src/pkg/syscall/zerrors_windows.go b/src/pkg/syscall/zerrors_windows.go new file mode 100644 index 000000000..ae4506fac --- /dev/null +++ b/src/pkg/syscall/zerrors_windows.go @@ -0,0 +1,283 @@ +// mkerrors_windows.sh -f -m32 +// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT + +package syscall + +// Go names for Windows errors. +const ( + ENOENT = ERROR_FILE_NOT_FOUND + ENOTDIR = ERROR_DIRECTORY +) + +// Windows reserves errors >= 1<<29 for application use. +const APPLICATION_ERROR = 1 << 29 + +// Invented values to support what package os and others expects. +const ( + E2BIG = APPLICATION_ERROR + iota + EACCES + EADDRINUSE + EADDRNOTAVAIL + EADV + EAFNOSUPPORT + EAGAIN + EALREADY + EBADE + EBADF + EBADFD + EBADMSG + EBADR + EBADRQC + EBADSLT + EBFONT + EBUSY + ECANCELED + ECHILD + ECHRNG + ECOMM + ECONNABORTED + ECONNREFUSED + ECONNRESET + EDEADLK + EDEADLOCK + EDESTADDRREQ + EDOM + EDOTDOT + EDQUOT + EEXIST + EFAULT + EFBIG + EHOSTDOWN + EHOSTUNREACH + EIDRM + EILSEQ + EINPROGRESS + EINTR + EINVAL + EIO + EISCONN + EISDIR + EISNAM + EKEYEXPIRED + EKEYREJECTED + EKEYREVOKED + EL2HLT + EL2NSYNC + EL3HLT + EL3RST + ELIBACC + ELIBBAD + ELIBEXEC + ELIBMAX + ELIBSCN + ELNRNG + ELOOP + EMEDIUMTYPE + EMFILE + EMLINK + EMSGSIZE + EMULTIHOP + ENAMETOOLONG + ENAVAIL + ENETDOWN + ENETRESET + ENETUNREACH + ENFILE + ENOANO + ENOBUFS + ENOCSI + ENODATA + ENODEV + ENOEXEC + ENOKEY + ENOLCK + ENOLINK + ENOMEDIUM + ENOMEM + ENOMSG + ENONET + ENOPKG + ENOPROTOOPT + ENOSPC + ENOSR + ENOSTR + ENOSYS + ENOTBLK + ENOTCONN + ENOTEMPTY + ENOTNAM + ENOTRECOVERABLE + ENOTSOCK + ENOTSUP + ENOTTY + ENOTUNIQ + ENXIO + EOPNOTSUPP + EOVERFLOW + EOWNERDEAD + EPERM + EPFNOSUPPORT + EPIPE + EPROTO + EPROTONOSUPPORT + EPROTOTYPE + ERANGE + EREMCHG + EREMOTE + EREMOTEIO + ERESTART + EROFS + ESHUTDOWN + ESOCKTNOSUPPORT + ESPIPE + ESRCH + ESRMNT + ESTALE + ESTRPIPE + ETIME + ETIMEDOUT + ETOOMANYREFS + ETXTBSY + EUCLEAN + EUNATCH + EUSERS + EWOULDBLOCK + EXDEV + EXFULL + EWINDOWS +) + +// Error strings for invented errors +var errors = [...]string{ + E2BIG - APPLICATION_ERROR: "argument list too long", + EACCES - APPLICATION_ERROR: "permission denied", + EADDRINUSE - APPLICATION_ERROR: "address already in use", + EADDRNOTAVAIL - APPLICATION_ERROR: "cannot assign requested address", + EADV - APPLICATION_ERROR: "advertise error", + EAFNOSUPPORT - APPLICATION_ERROR: "address family not supported by protocol", + EAGAIN - APPLICATION_ERROR: "resource temporarily unavailable", + EALREADY - APPLICATION_ERROR: "operation already in progress", + EBADE - APPLICATION_ERROR: "invalid exchange", + EBADF - APPLICATION_ERROR: "bad file descriptor", + EBADFD - APPLICATION_ERROR: "file descriptor in bad state", + EBADMSG - APPLICATION_ERROR: "bad message", + EBADR - APPLICATION_ERROR: "invalid request descriptor", + EBADRQC - APPLICATION_ERROR: "invalid request code", + EBADSLT - APPLICATION_ERROR: "invalid slot", + EBFONT - APPLICATION_ERROR: "bad font file format", + EBUSY - APPLICATION_ERROR: "device or resource busy", + ECANCELED - APPLICATION_ERROR: "operation canceled", + ECHILD - APPLICATION_ERROR: "no child processes", + ECHRNG - APPLICATION_ERROR: "channel number out of range", + ECOMM - APPLICATION_ERROR: "communication error on send", + ECONNABORTED - APPLICATION_ERROR: "software caused connection abort", + ECONNREFUSED - APPLICATION_ERROR: "connection refused", + ECONNRESET - APPLICATION_ERROR: "connection reset by peer", + EDEADLK - APPLICATION_ERROR: "resource deadlock avoided", + EDEADLOCK - APPLICATION_ERROR: "resource deadlock avoided", + EDESTADDRREQ - APPLICATION_ERROR: "destination address required", + EDOM - APPLICATION_ERROR: "numerical argument out of domain", + EDOTDOT - APPLICATION_ERROR: "RFS specific error", + EDQUOT - APPLICATION_ERROR: "disk quota exceeded", + EEXIST - APPLICATION_ERROR: "file exists", + EFAULT - APPLICATION_ERROR: "bad address", + EFBIG - APPLICATION_ERROR: "file too large", + EHOSTDOWN - APPLICATION_ERROR: "host is down", + EHOSTUNREACH - APPLICATION_ERROR: "no route to host", + EIDRM - APPLICATION_ERROR: "identifier removed", + EILSEQ - APPLICATION_ERROR: "invalid or incomplete multibyte or wide character", + EINPROGRESS - APPLICATION_ERROR: "operation now in progress", + EINTR - APPLICATION_ERROR: "interrupted system call", + EINVAL - APPLICATION_ERROR: "invalid argument", + EIO - APPLICATION_ERROR: "input/output error", + EISCONN - APPLICATION_ERROR: "transport endpoint is already connected", + EISDIR - APPLICATION_ERROR: "is a directory", + EISNAM - APPLICATION_ERROR: "is a named type file", + EKEYEXPIRED - APPLICATION_ERROR: "key has expired", + EKEYREJECTED - APPLICATION_ERROR: "key was rejected by service", + EKEYREVOKED - APPLICATION_ERROR: "key has been revoked", + EL2HLT - APPLICATION_ERROR: "level 2 halted", + EL2NSYNC - APPLICATION_ERROR: "level 2 not synchronized", + EL3HLT - APPLICATION_ERROR: "level 3 halted", + EL3RST - APPLICATION_ERROR: "level 3 reset", + ELIBACC - APPLICATION_ERROR: "can not access a needed shared library", + ELIBBAD - APPLICATION_ERROR: "accessing a corrupted shared library", + ELIBEXEC - APPLICATION_ERROR: "cannot exec a shared library directly", + ELIBMAX - APPLICATION_ERROR: "attempting to link in too many shared libraries", + ELIBSCN - APPLICATION_ERROR: ".lib section in a.out corrupted", + ELNRNG - APPLICATION_ERROR: "link number out of range", + ELOOP - APPLICATION_ERROR: "too many levels of symbolic links", + EMEDIUMTYPE - APPLICATION_ERROR: "wrong medium type", + EMFILE - APPLICATION_ERROR: "too many open files", + EMLINK - APPLICATION_ERROR: "too many links", + EMSGSIZE - APPLICATION_ERROR: "message too long", + EMULTIHOP - APPLICATION_ERROR: "multihop attempted", + ENAMETOOLONG - APPLICATION_ERROR: "file name too long", + ENAVAIL - APPLICATION_ERROR: "no XENIX semaphores available", + ENETDOWN - APPLICATION_ERROR: "network is down", + ENETRESET - APPLICATION_ERROR: "network dropped connection on reset", + ENETUNREACH - APPLICATION_ERROR: "network is unreachable", + ENFILE - APPLICATION_ERROR: "too many open files in system", + ENOANO - APPLICATION_ERROR: "no anode", + ENOBUFS - APPLICATION_ERROR: "no buffer space available", + ENOCSI - APPLICATION_ERROR: "no CSI structure available", + ENODATA - APPLICATION_ERROR: "no data available", + ENODEV - APPLICATION_ERROR: "no such device", + ENOEXEC - APPLICATION_ERROR: "exec format error", + ENOKEY - APPLICATION_ERROR: "required key not available", + ENOLCK - APPLICATION_ERROR: "no locks available", + ENOLINK - APPLICATION_ERROR: "link has been severed", + ENOMEDIUM - APPLICATION_ERROR: "no medium found", + ENOMEM - APPLICATION_ERROR: "cannot allocate memory", + ENOMSG - APPLICATION_ERROR: "no message of desired type", + ENONET - APPLICATION_ERROR: "machine is not on the network", + ENOPKG - APPLICATION_ERROR: "package not installed", + ENOPROTOOPT - APPLICATION_ERROR: "protocol not available", + ENOSPC - APPLICATION_ERROR: "no space left on device", + ENOSR - APPLICATION_ERROR: "out of streams resources", + ENOSTR - APPLICATION_ERROR: "device not a stream", + ENOSYS - APPLICATION_ERROR: "function not implemented", + ENOTBLK - APPLICATION_ERROR: "block device required", + ENOTCONN - APPLICATION_ERROR: "transport endpoint is not connected", + ENOTEMPTY - APPLICATION_ERROR: "directory not empty", + ENOTNAM - APPLICATION_ERROR: "not a XENIX named type file", + ENOTRECOVERABLE - APPLICATION_ERROR: "state not recoverable", + ENOTSOCK - APPLICATION_ERROR: "socket operation on non-socket", + ENOTSUP - APPLICATION_ERROR: "operation not supported", + ENOTTY - APPLICATION_ERROR: "inappropriate ioctl for device", + ENOTUNIQ - APPLICATION_ERROR: "name not unique on network", + ENXIO - APPLICATION_ERROR: "no such device or address", + EOPNOTSUPP - APPLICATION_ERROR: "operation not supported", + EOVERFLOW - APPLICATION_ERROR: "value too large for defined data type", + EOWNERDEAD - APPLICATION_ERROR: "owner died", + EPERM - APPLICATION_ERROR: "operation not permitted", + EPFNOSUPPORT - APPLICATION_ERROR: "protocol family not supported", + EPIPE - APPLICATION_ERROR: "broken pipe", + EPROTO - APPLICATION_ERROR: "protocol error", + EPROTONOSUPPORT - APPLICATION_ERROR: "protocol not supported", + EPROTOTYPE - APPLICATION_ERROR: "protocol wrong type for socket", + ERANGE - APPLICATION_ERROR: "numerical result out of range", + EREMCHG - APPLICATION_ERROR: "remote address changed", + EREMOTE - APPLICATION_ERROR: "object is remote", + EREMOTEIO - APPLICATION_ERROR: "remote I/O error", + ERESTART - APPLICATION_ERROR: "interrupted system call should be restarted", + EROFS - APPLICATION_ERROR: "read-only file system", + ESHUTDOWN - APPLICATION_ERROR: "cannot send after transport endpoint shutdown", + ESOCKTNOSUPPORT - APPLICATION_ERROR: "socket type not supported", + ESPIPE - APPLICATION_ERROR: "illegal seek", + ESRCH - APPLICATION_ERROR: "no such process", + ESRMNT - APPLICATION_ERROR: "srmount error", + ESTALE - APPLICATION_ERROR: "stale NFS file handle", + ESTRPIPE - APPLICATION_ERROR: "streams pipe error", + ETIME - APPLICATION_ERROR: "timer expired", + ETIMEDOUT - APPLICATION_ERROR: "connection timed out", + ETOOMANYREFS - APPLICATION_ERROR: "too many references: cannot splice", + ETXTBSY - APPLICATION_ERROR: "text file busy", + EUCLEAN - APPLICATION_ERROR: "structure needs cleaning", + EUNATCH - APPLICATION_ERROR: "protocol driver not attached", + EUSERS - APPLICATION_ERROR: "too many users", + EWOULDBLOCK - APPLICATION_ERROR: "resource temporarily unavailable", + EXDEV - APPLICATION_ERROR: "invalid cross-device link", + EXFULL - APPLICATION_ERROR: "exchange full", + EWINDOWS - APPLICATION_ERROR: "not supported by windows", +} diff --git a/src/pkg/syscall/zerrors_windows_386.go b/src/pkg/syscall/zerrors_windows_386.go index ae4506fac..d1008bd03 100644 --- a/src/pkg/syscall/zerrors_windows_386.go +++ b/src/pkg/syscall/zerrors_windows_386.go @@ -1,283 +1,5 @@ -// mkerrors_windows.sh -f -m32 -// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT +// Copyright 2011 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 - -// Go names for Windows errors. -const ( - ENOENT = ERROR_FILE_NOT_FOUND - ENOTDIR = ERROR_DIRECTORY -) - -// Windows reserves errors >= 1<<29 for application use. -const APPLICATION_ERROR = 1 << 29 - -// Invented values to support what package os and others expects. -const ( - E2BIG = APPLICATION_ERROR + iota - EACCES - EADDRINUSE - EADDRNOTAVAIL - EADV - EAFNOSUPPORT - EAGAIN - EALREADY - EBADE - EBADF - EBADFD - EBADMSG - EBADR - EBADRQC - EBADSLT - EBFONT - EBUSY - ECANCELED - ECHILD - ECHRNG - ECOMM - ECONNABORTED - ECONNREFUSED - ECONNRESET - EDEADLK - EDEADLOCK - EDESTADDRREQ - EDOM - EDOTDOT - EDQUOT - EEXIST - EFAULT - EFBIG - EHOSTDOWN - EHOSTUNREACH - EIDRM - EILSEQ - EINPROGRESS - EINTR - EINVAL - EIO - EISCONN - EISDIR - EISNAM - EKEYEXPIRED - EKEYREJECTED - EKEYREVOKED - EL2HLT - EL2NSYNC - EL3HLT - EL3RST - ELIBACC - ELIBBAD - ELIBEXEC - ELIBMAX - ELIBSCN - ELNRNG - ELOOP - EMEDIUMTYPE - EMFILE - EMLINK - EMSGSIZE - EMULTIHOP - ENAMETOOLONG - ENAVAIL - ENETDOWN - ENETRESET - ENETUNREACH - ENFILE - ENOANO - ENOBUFS - ENOCSI - ENODATA - ENODEV - ENOEXEC - ENOKEY - ENOLCK - ENOLINK - ENOMEDIUM - ENOMEM - ENOMSG - ENONET - ENOPKG - ENOPROTOOPT - ENOSPC - ENOSR - ENOSTR - ENOSYS - ENOTBLK - ENOTCONN - ENOTEMPTY - ENOTNAM - ENOTRECOVERABLE - ENOTSOCK - ENOTSUP - ENOTTY - ENOTUNIQ - ENXIO - EOPNOTSUPP - EOVERFLOW - EOWNERDEAD - EPERM - EPFNOSUPPORT - EPIPE - EPROTO - EPROTONOSUPPORT - EPROTOTYPE - ERANGE - EREMCHG - EREMOTE - EREMOTEIO - ERESTART - EROFS - ESHUTDOWN - ESOCKTNOSUPPORT - ESPIPE - ESRCH - ESRMNT - ESTALE - ESTRPIPE - ETIME - ETIMEDOUT - ETOOMANYREFS - ETXTBSY - EUCLEAN - EUNATCH - EUSERS - EWOULDBLOCK - EXDEV - EXFULL - EWINDOWS -) - -// Error strings for invented errors -var errors = [...]string{ - E2BIG - APPLICATION_ERROR: "argument list too long", - EACCES - APPLICATION_ERROR: "permission denied", - EADDRINUSE - APPLICATION_ERROR: "address already in use", - EADDRNOTAVAIL - APPLICATION_ERROR: "cannot assign requested address", - EADV - APPLICATION_ERROR: "advertise error", - EAFNOSUPPORT - APPLICATION_ERROR: "address family not supported by protocol", - EAGAIN - APPLICATION_ERROR: "resource temporarily unavailable", - EALREADY - APPLICATION_ERROR: "operation already in progress", - EBADE - APPLICATION_ERROR: "invalid exchange", - EBADF - APPLICATION_ERROR: "bad file descriptor", - EBADFD - APPLICATION_ERROR: "file descriptor in bad state", - EBADMSG - APPLICATION_ERROR: "bad message", - EBADR - APPLICATION_ERROR: "invalid request descriptor", - EBADRQC - APPLICATION_ERROR: "invalid request code", - EBADSLT - APPLICATION_ERROR: "invalid slot", - EBFONT - APPLICATION_ERROR: "bad font file format", - EBUSY - APPLICATION_ERROR: "device or resource busy", - ECANCELED - APPLICATION_ERROR: "operation canceled", - ECHILD - APPLICATION_ERROR: "no child processes", - ECHRNG - APPLICATION_ERROR: "channel number out of range", - ECOMM - APPLICATION_ERROR: "communication error on send", - ECONNABORTED - APPLICATION_ERROR: "software caused connection abort", - ECONNREFUSED - APPLICATION_ERROR: "connection refused", - ECONNRESET - APPLICATION_ERROR: "connection reset by peer", - EDEADLK - APPLICATION_ERROR: "resource deadlock avoided", - EDEADLOCK - APPLICATION_ERROR: "resource deadlock avoided", - EDESTADDRREQ - APPLICATION_ERROR: "destination address required", - EDOM - APPLICATION_ERROR: "numerical argument out of domain", - EDOTDOT - APPLICATION_ERROR: "RFS specific error", - EDQUOT - APPLICATION_ERROR: "disk quota exceeded", - EEXIST - APPLICATION_ERROR: "file exists", - EFAULT - APPLICATION_ERROR: "bad address", - EFBIG - APPLICATION_ERROR: "file too large", - EHOSTDOWN - APPLICATION_ERROR: "host is down", - EHOSTUNREACH - APPLICATION_ERROR: "no route to host", - EIDRM - APPLICATION_ERROR: "identifier removed", - EILSEQ - APPLICATION_ERROR: "invalid or incomplete multibyte or wide character", - EINPROGRESS - APPLICATION_ERROR: "operation now in progress", - EINTR - APPLICATION_ERROR: "interrupted system call", - EINVAL - APPLICATION_ERROR: "invalid argument", - EIO - APPLICATION_ERROR: "input/output error", - EISCONN - APPLICATION_ERROR: "transport endpoint is already connected", - EISDIR - APPLICATION_ERROR: "is a directory", - EISNAM - APPLICATION_ERROR: "is a named type file", - EKEYEXPIRED - APPLICATION_ERROR: "key has expired", - EKEYREJECTED - APPLICATION_ERROR: "key was rejected by service", - EKEYREVOKED - APPLICATION_ERROR: "key has been revoked", - EL2HLT - APPLICATION_ERROR: "level 2 halted", - EL2NSYNC - APPLICATION_ERROR: "level 2 not synchronized", - EL3HLT - APPLICATION_ERROR: "level 3 halted", - EL3RST - APPLICATION_ERROR: "level 3 reset", - ELIBACC - APPLICATION_ERROR: "can not access a needed shared library", - ELIBBAD - APPLICATION_ERROR: "accessing a corrupted shared library", - ELIBEXEC - APPLICATION_ERROR: "cannot exec a shared library directly", - ELIBMAX - APPLICATION_ERROR: "attempting to link in too many shared libraries", - ELIBSCN - APPLICATION_ERROR: ".lib section in a.out corrupted", - ELNRNG - APPLICATION_ERROR: "link number out of range", - ELOOP - APPLICATION_ERROR: "too many levels of symbolic links", - EMEDIUMTYPE - APPLICATION_ERROR: "wrong medium type", - EMFILE - APPLICATION_ERROR: "too many open files", - EMLINK - APPLICATION_ERROR: "too many links", - EMSGSIZE - APPLICATION_ERROR: "message too long", - EMULTIHOP - APPLICATION_ERROR: "multihop attempted", - ENAMETOOLONG - APPLICATION_ERROR: "file name too long", - ENAVAIL - APPLICATION_ERROR: "no XENIX semaphores available", - ENETDOWN - APPLICATION_ERROR: "network is down", - ENETRESET - APPLICATION_ERROR: "network dropped connection on reset", - ENETUNREACH - APPLICATION_ERROR: "network is unreachable", - ENFILE - APPLICATION_ERROR: "too many open files in system", - ENOANO - APPLICATION_ERROR: "no anode", - ENOBUFS - APPLICATION_ERROR: "no buffer space available", - ENOCSI - APPLICATION_ERROR: "no CSI structure available", - ENODATA - APPLICATION_ERROR: "no data available", - ENODEV - APPLICATION_ERROR: "no such device", - ENOEXEC - APPLICATION_ERROR: "exec format error", - ENOKEY - APPLICATION_ERROR: "required key not available", - ENOLCK - APPLICATION_ERROR: "no locks available", - ENOLINK - APPLICATION_ERROR: "link has been severed", - ENOMEDIUM - APPLICATION_ERROR: "no medium found", - ENOMEM - APPLICATION_ERROR: "cannot allocate memory", - ENOMSG - APPLICATION_ERROR: "no message of desired type", - ENONET - APPLICATION_ERROR: "machine is not on the network", - ENOPKG - APPLICATION_ERROR: "package not installed", - ENOPROTOOPT - APPLICATION_ERROR: "protocol not available", - ENOSPC - APPLICATION_ERROR: "no space left on device", - ENOSR - APPLICATION_ERROR: "out of streams resources", - ENOSTR - APPLICATION_ERROR: "device not a stream", - ENOSYS - APPLICATION_ERROR: "function not implemented", - ENOTBLK - APPLICATION_ERROR: "block device required", - ENOTCONN - APPLICATION_ERROR: "transport endpoint is not connected", - ENOTEMPTY - APPLICATION_ERROR: "directory not empty", - ENOTNAM - APPLICATION_ERROR: "not a XENIX named type file", - ENOTRECOVERABLE - APPLICATION_ERROR: "state not recoverable", - ENOTSOCK - APPLICATION_ERROR: "socket operation on non-socket", - ENOTSUP - APPLICATION_ERROR: "operation not supported", - ENOTTY - APPLICATION_ERROR: "inappropriate ioctl for device", - ENOTUNIQ - APPLICATION_ERROR: "name not unique on network", - ENXIO - APPLICATION_ERROR: "no such device or address", - EOPNOTSUPP - APPLICATION_ERROR: "operation not supported", - EOVERFLOW - APPLICATION_ERROR: "value too large for defined data type", - EOWNERDEAD - APPLICATION_ERROR: "owner died", - EPERM - APPLICATION_ERROR: "operation not permitted", - EPFNOSUPPORT - APPLICATION_ERROR: "protocol family not supported", - EPIPE - APPLICATION_ERROR: "broken pipe", - EPROTO - APPLICATION_ERROR: "protocol error", - EPROTONOSUPPORT - APPLICATION_ERROR: "protocol not supported", - EPROTOTYPE - APPLICATION_ERROR: "protocol wrong type for socket", - ERANGE - APPLICATION_ERROR: "numerical result out of range", - EREMCHG - APPLICATION_ERROR: "remote address changed", - EREMOTE - APPLICATION_ERROR: "object is remote", - EREMOTEIO - APPLICATION_ERROR: "remote I/O error", - ERESTART - APPLICATION_ERROR: "interrupted system call should be restarted", - EROFS - APPLICATION_ERROR: "read-only file system", - ESHUTDOWN - APPLICATION_ERROR: "cannot send after transport endpoint shutdown", - ESOCKTNOSUPPORT - APPLICATION_ERROR: "socket type not supported", - ESPIPE - APPLICATION_ERROR: "illegal seek", - ESRCH - APPLICATION_ERROR: "no such process", - ESRMNT - APPLICATION_ERROR: "srmount error", - ESTALE - APPLICATION_ERROR: "stale NFS file handle", - ESTRPIPE - APPLICATION_ERROR: "streams pipe error", - ETIME - APPLICATION_ERROR: "timer expired", - ETIMEDOUT - APPLICATION_ERROR: "connection timed out", - ETOOMANYREFS - APPLICATION_ERROR: "too many references: cannot splice", - ETXTBSY - APPLICATION_ERROR: "text file busy", - EUCLEAN - APPLICATION_ERROR: "structure needs cleaning", - EUNATCH - APPLICATION_ERROR: "protocol driver not attached", - EUSERS - APPLICATION_ERROR: "too many users", - EWOULDBLOCK - APPLICATION_ERROR: "resource temporarily unavailable", - EXDEV - APPLICATION_ERROR: "invalid cross-device link", - EXFULL - APPLICATION_ERROR: "exchange full", - EWINDOWS - APPLICATION_ERROR: "not supported by windows", -} diff --git a/src/pkg/syscall/zerrors_windows_amd64.go b/src/pkg/syscall/zerrors_windows_amd64.go new file mode 100644 index 000000000..d1008bd03 --- /dev/null +++ b/src/pkg/syscall/zerrors_windows_amd64.go @@ -0,0 +1,5 @@ +// Copyright 2011 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 diff --git a/src/pkg/syscall/zsyscall_darwin_386.go b/src/pkg/syscall/zsyscall_darwin_386.go index 2f5b2703b..436953eca 100644 --- a/src/pkg/syscall/zsyscall_darwin_386.go +++ b/src/pkg/syscall/zsyscall_darwin_386.go @@ -85,7 +85,7 @@ func getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (errn // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) { +func setsockopt(s int, level int, name int, val uintptr, vallen uintptr) (errno int) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) errno = int(e1) return @@ -154,6 +154,23 @@ func sendto(s int, buf []byte, flags int, to uintptr, addrlen _Socklen) (errno i // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func recvmsg(s int, msg *Msghdr, flags int) (n int, errno int) { + r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + errno = int(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendmsg(s int, msg *Msghdr, flags int) (errno int) { + _, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + errno = int(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func kevent(kq int, change uintptr, nchange int, event uintptr, nevent int, timeout *Timespec) (n int, errno int) { r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) @@ -219,6 +236,14 @@ func munmap(addr uintptr, length uintptr) (errno int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ptrace(request int, pid int, addr uintptr, data uintptr) (errno int) { + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + errno = int(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func kill(pid int, signum int, posix int) (errno int) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) errno = int(e1) diff --git a/src/pkg/syscall/zsyscall_darwin_amd64.go b/src/pkg/syscall/zsyscall_darwin_amd64.go index 995c710b4..1ba4c3cfe 100644 --- a/src/pkg/syscall/zsyscall_darwin_amd64.go +++ b/src/pkg/syscall/zsyscall_darwin_amd64.go @@ -85,7 +85,7 @@ func getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (errn // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) { +func setsockopt(s int, level int, name int, val uintptr, vallen uintptr) (errno int) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) errno = int(e1) return @@ -154,6 +154,23 @@ func sendto(s int, buf []byte, flags int, to uintptr, addrlen _Socklen) (errno i // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func recvmsg(s int, msg *Msghdr, flags int) (n int, errno int) { + r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + errno = int(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendmsg(s int, msg *Msghdr, flags int) (errno int) { + _, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + errno = int(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func kevent(kq int, change uintptr, nchange int, event uintptr, nevent int, timeout *Timespec) (n int, errno int) { r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) @@ -219,6 +236,14 @@ func munmap(addr uintptr, length uintptr) (errno int) { // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func ptrace(request int, pid int, addr uintptr, data uintptr) (errno int) { + _, _, e1 := Syscall6(SYS_PTRACE, uintptr(request), uintptr(pid), uintptr(addr), uintptr(data), 0, 0) + errno = int(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func kill(pid int, signum int, posix int) (errno int) { _, _, e1 := Syscall(SYS_KILL, uintptr(pid), uintptr(signum), uintptr(posix)) errno = int(e1) diff --git a/src/pkg/syscall/zsyscall_freebsd_386.go b/src/pkg/syscall/zsyscall_freebsd_386.go index 0ffb9a4b9..d152e4380 100644 --- a/src/pkg/syscall/zsyscall_freebsd_386.go +++ b/src/pkg/syscall/zsyscall_freebsd_386.go @@ -85,7 +85,7 @@ func getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (errn // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) { +func setsockopt(s int, level int, name int, val uintptr, vallen uintptr) (errno int) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) errno = int(e1) return @@ -154,6 +154,23 @@ func sendto(s int, buf []byte, flags int, to uintptr, addrlen _Socklen) (errno i // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func recvmsg(s int, msg *Msghdr, flags int) (n int, errno int) { + r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + errno = int(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendmsg(s int, msg *Msghdr, flags int) (errno int) { + _, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + errno = int(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func kevent(kq int, change uintptr, nchange int, event uintptr, nevent int, timeout *Timespec) (n int, errno int) { r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) diff --git a/src/pkg/syscall/zsyscall_freebsd_amd64.go b/src/pkg/syscall/zsyscall_freebsd_amd64.go index 38a06ae3b..156b087e3 100644 --- a/src/pkg/syscall/zsyscall_freebsd_amd64.go +++ b/src/pkg/syscall/zsyscall_freebsd_amd64.go @@ -85,7 +85,7 @@ func getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (errn // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) { +func setsockopt(s int, level int, name int, val uintptr, vallen uintptr) (errno int) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) errno = int(e1) return @@ -154,6 +154,23 @@ func sendto(s int, buf []byte, flags int, to uintptr, addrlen _Socklen) (errno i // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func recvmsg(s int, msg *Msghdr, flags int) (n int, errno int) { + r0, _, e1 := Syscall(SYS_RECVMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + n = int(r0) + errno = int(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func sendmsg(s int, msg *Msghdr, flags int) (errno int) { + _, _, e1 := Syscall(SYS_SENDMSG, uintptr(s), uintptr(unsafe.Pointer(msg)), uintptr(flags)) + errno = int(e1) + return +} + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func kevent(kq int, change uintptr, nchange int, event uintptr, nevent int, timeout *Timespec) (n int, errno int) { r0, _, e1 := Syscall6(SYS_KEVENT, uintptr(kq), uintptr(change), uintptr(nchange), uintptr(event), uintptr(nevent), uintptr(unsafe.Pointer(timeout))) n = int(r0) diff --git a/src/pkg/syscall/zsyscall_linux_amd64.go b/src/pkg/syscall/zsyscall_linux_amd64.go index d6e287967..fa20ff57a 100644 --- a/src/pkg/syscall/zsyscall_linux_amd64.go +++ b/src/pkg/syscall/zsyscall_linux_amd64.go @@ -1169,7 +1169,7 @@ func getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (errn // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) { +func setsockopt(s int, level int, name int, val uintptr, vallen uintptr) (errno int) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) errno = int(e1) return diff --git a/src/pkg/syscall/zsyscall_linux_arm.go b/src/pkg/syscall/zsyscall_linux_arm.go index af5f7c50c..560a65b12 100644 --- a/src/pkg/syscall/zsyscall_linux_arm.go +++ b/src/pkg/syscall/zsyscall_linux_arm.go @@ -895,7 +895,7 @@ func getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (errn // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT -func setsockopt(s int, level int, name int, val uintptr, vallen int) (errno int) { +func setsockopt(s int, level int, name int, val uintptr, vallen uintptr) (errno int) { _, _, e1 := Syscall6(SYS_SETSOCKOPT, uintptr(s), uintptr(level), uintptr(name), uintptr(val), uintptr(vallen), 0) errno = int(e1) return diff --git a/src/pkg/syscall/zsyscall_windows_386.go b/src/pkg/syscall/zsyscall_windows_386.go index 447b09043..350ad232a 100644 --- a/src/pkg/syscall/zsyscall_windows_386.go +++ b/src/pkg/syscall/zsyscall_windows_386.go @@ -12,6 +12,7 @@ var ( modwsock32 = loadDll("wsock32.dll") modws2_32 = loadDll("ws2_32.dll") moddnsapi = loadDll("dnsapi.dll") + modiphlpapi = loadDll("iphlpapi.dll") procGetLastError = getSysProcAddr(modkernel32, "GetLastError") procLoadLibraryW = getSysProcAddr(modkernel32, "LoadLibraryW") @@ -77,8 +78,10 @@ var ( procFlushViewOfFile = getSysProcAddr(modkernel32, "FlushViewOfFile") procVirtualLock = getSysProcAddr(modkernel32, "VirtualLock") procVirtualUnlock = getSysProcAddr(modkernel32, "VirtualUnlock") + procTransmitFile = getSysProcAddr(modwsock32, "TransmitFile") procWSAStartup = getSysProcAddr(modwsock32, "WSAStartup") procWSACleanup = getSysProcAddr(modwsock32, "WSACleanup") + procWSAIoctl = getSysProcAddr(modws2_32, "WSAIoctl") procsocket = getSysProcAddr(modwsock32, "socket") procsetsockopt = getSysProcAddr(modwsock32, "setsockopt") procbind = getSysProcAddr(modwsock32, "bind") @@ -99,6 +102,8 @@ var ( procntohs = getSysProcAddr(modws2_32, "ntohs") procDnsQuery_W = getSysProcAddr(moddnsapi, "DnsQuery_W") procDnsRecordListFree = getSysProcAddr(moddnsapi, "DnsRecordListFree") + procGetIfEntry = getSysProcAddr(modiphlpapi, "GetIfEntry") + procGetAdaptersInfo = getSysProcAddr(modiphlpapi, "GetAdaptersInfo") ) func GetLastError() (lasterrno int) { @@ -107,9 +112,9 @@ func GetLastError() (lasterrno int) { return } -func LoadLibrary(libname string) (handle uint32, errno int) { +func LoadLibrary(libname string) (handle Handle, errno int) { r0, _, e1 := Syscall(procLoadLibraryW, 1, uintptr(unsafe.Pointer(StringToUTF16Ptr(libname))), 0, 0) - handle = uint32(r0) + handle = Handle(r0) if handle == 0 { if e1 != 0 { errno = int(e1) @@ -122,7 +127,7 @@ func LoadLibrary(libname string) (handle uint32, errno int) { return } -func FreeLibrary(handle uint32) (errno int) { +func FreeLibrary(handle Handle) (errno int) { r1, _, e1 := Syscall(procFreeLibrary, 1, uintptr(handle), 0, 0) if int(r1) == 0 { if e1 != 0 { @@ -136,9 +141,9 @@ func FreeLibrary(handle uint32) (errno int) { return } -func GetProcAddress(module uint32, procname string) (proc uint32, errno int) { +func GetProcAddress(module Handle, procname string) (proc Handle, errno int) { r0, _, e1 := Syscall(procGetProcAddress, 2, uintptr(module), uintptr(unsafe.Pointer(StringBytePtr(procname))), 0) - proc = uint32(r0) + proc = Handle(r0) if proc == 0 { if e1 != 0 { errno = int(e1) @@ -190,10 +195,10 @@ func ExitProcess(exitcode uint32) { return } -func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle int32, errno int) { +func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, errno int) { r0, _, e1 := Syscall9(procCreateFileW, 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0) - handle = int32(r0) - if handle == -1 { + handle = Handle(r0) + if handle == InvalidHandle { if e1 != 0 { errno = int(e1) } else { @@ -205,7 +210,7 @@ func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes return } -func ReadFile(handle int32, buf []byte, done *uint32, overlapped *Overlapped) (errno int) { +func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (errno int) { var _p0 *byte if len(buf) > 0 { _p0 = &buf[0] @@ -223,7 +228,7 @@ func ReadFile(handle int32, buf []byte, done *uint32, overlapped *Overlapped) (e return } -func WriteFile(handle int32, buf []byte, done *uint32, overlapped *Overlapped) (errno int) { +func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (errno int) { var _p0 *byte if len(buf) > 0 { _p0 = &buf[0] @@ -241,7 +246,7 @@ func WriteFile(handle int32, buf []byte, done *uint32, overlapped *Overlapped) ( return } -func SetFilePointer(handle int32, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, errno int) { +func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, errno int) { r0, _, e1 := Syscall6(procSetFilePointer, 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0) newlowoffset = uint32(r0) if newlowoffset == 0xffffffff { @@ -256,7 +261,7 @@ func SetFilePointer(handle int32, lowoffset int32, highoffsetptr *int32, whence return } -func CloseHandle(handle int32) (errno int) { +func CloseHandle(handle Handle) (errno int) { r1, _, e1 := Syscall(procCloseHandle, 1, uintptr(handle), 0, 0) if int(r1) == 0 { if e1 != 0 { @@ -270,10 +275,10 @@ func CloseHandle(handle int32) (errno int) { return } -func GetStdHandle(stdhandle int32) (handle int32, errno int) { +func GetStdHandle(stdhandle int) (handle Handle, errno int) { r0, _, e1 := Syscall(procGetStdHandle, 1, uintptr(stdhandle), 0, 0) - handle = int32(r0) - if handle == -1 { + handle = Handle(r0) + if handle == InvalidHandle { if e1 != 0 { errno = int(e1) } else { @@ -285,10 +290,10 @@ func GetStdHandle(stdhandle int32) (handle int32, errno int) { return } -func FindFirstFile(name *uint16, data *Win32finddata) (handle int32, errno int) { +func FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, errno int) { r0, _, e1 := Syscall(procFindFirstFileW, 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0) - handle = int32(r0) - if handle == -1 { + handle = Handle(r0) + if handle == InvalidHandle { if e1 != 0 { errno = int(e1) } else { @@ -300,7 +305,7 @@ func FindFirstFile(name *uint16, data *Win32finddata) (handle int32, errno int) return } -func FindNextFile(handle int32, data *Win32finddata) (errno int) { +func FindNextFile(handle Handle, data *Win32finddata) (errno int) { r1, _, e1 := Syscall(procFindNextFileW, 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) if int(r1) == 0 { if e1 != 0 { @@ -314,7 +319,7 @@ func FindNextFile(handle int32, data *Win32finddata) (errno int) { return } -func FindClose(handle int32) (errno int) { +func FindClose(handle Handle) (errno int) { r1, _, e1 := Syscall(procFindClose, 1, uintptr(handle), 0, 0) if int(r1) == 0 { if e1 != 0 { @@ -328,7 +333,7 @@ func FindClose(handle int32) (errno int) { return } -func GetFileInformationByHandle(handle int32, data *ByHandleFileInformation) (errno int) { +func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (errno int) { r1, _, e1 := Syscall(procGetFileInformationByHandle, 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) if int(r1) == 0 { if e1 != 0 { @@ -441,7 +446,7 @@ func GetComputerName(buf *uint16, n *uint32) (errno int) { return } -func SetEndOfFile(handle int32) (errno int) { +func SetEndOfFile(handle Handle) (errno int) { r1, _, e1 := Syscall(procSetEndOfFile, 1, uintptr(handle), 0, 0) if int(r1) == 0 { if e1 != 0 { @@ -480,9 +485,9 @@ func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, errno int) { return } -func CreateIoCompletionPort(filehandle int32, cphandle int32, key uint32, threadcnt uint32) (handle int32, errno int) { +func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, errno int) { r0, _, e1 := Syscall6(procCreateIoCompletionPort, 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0) - handle = int32(r0) + handle = Handle(r0) if handle == 0 { if e1 != 0 { errno = int(e1) @@ -495,7 +500,7 @@ func CreateIoCompletionPort(filehandle int32, cphandle int32, key uint32, thread return } -func GetQueuedCompletionStatus(cphandle int32, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (errno int) { +func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (errno int) { r1, _, e1 := Syscall6(procGetQueuedCompletionStatus, 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0) if int(r1) == 0 { if e1 != 0 { @@ -509,7 +514,7 @@ func GetQueuedCompletionStatus(cphandle int32, qty *uint32, key *uint32, overlap return } -func CancelIo(s uint32) (errno int) { +func CancelIo(s Handle) (errno int) { r1, _, e1 := Syscall(procCancelIo, 1, uintptr(s), 0, 0) if int(r1) == 0 { if e1 != 0 { @@ -543,7 +548,7 @@ func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityA return } -func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle int32, errno int) { +func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, errno int) { var _p0 uint32 if inheritHandle { _p0 = 1 @@ -551,7 +556,7 @@ func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle int32, errno _p0 = 0 } r0, _, e1 := Syscall(procOpenProcess, 3, uintptr(da), uintptr(_p0), uintptr(pid)) - handle = int32(r0) + handle = Handle(r0) if handle == 0 { if e1 != 0 { errno = int(e1) @@ -564,7 +569,7 @@ func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle int32, errno return } -func TerminateProcess(handle int32, exitcode uint32) (errno int) { +func TerminateProcess(handle Handle, exitcode uint32) (errno int) { r1, _, e1 := Syscall(procTerminateProcess, 2, uintptr(handle), uintptr(exitcode), 0) if int(r1) == 0 { if e1 != 0 { @@ -578,7 +583,7 @@ func TerminateProcess(handle int32, exitcode uint32) (errno int) { return } -func GetExitCodeProcess(handle int32, exitcode *uint32) (errno int) { +func GetExitCodeProcess(handle Handle, exitcode *uint32) (errno int) { r1, _, e1 := Syscall(procGetExitCodeProcess, 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0) if int(r1) == 0 { if e1 != 0 { @@ -606,9 +611,9 @@ func GetStartupInfo(startupInfo *StartupInfo) (errno int) { return } -func GetCurrentProcess() (pseudoHandle int32, errno int) { +func GetCurrentProcess() (pseudoHandle Handle, errno int) { r0, _, e1 := Syscall(procGetCurrentProcess, 0, 0, 0, 0) - pseudoHandle = int32(r0) + pseudoHandle = Handle(r0) if pseudoHandle == 0 { if e1 != 0 { errno = int(e1) @@ -621,7 +626,7 @@ func GetCurrentProcess() (pseudoHandle int32, errno int) { return } -func DuplicateHandle(hSourceProcessHandle int32, hSourceHandle int32, hTargetProcessHandle int32, lpTargetHandle *int32, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (errno int) { +func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (errno int) { var _p0 uint32 if bInheritHandle { _p0 = 1 @@ -641,7 +646,7 @@ func DuplicateHandle(hSourceProcessHandle int32, hSourceHandle int32, hTargetPro return } -func WaitForSingleObject(handle int32, waitMilliseconds uint32) (event uint32, errno int) { +func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, errno int) { r0, _, e1 := Syscall(procWaitForSingleObject, 2, uintptr(handle), uintptr(waitMilliseconds), 0) event = uint32(r0) if event == 0xffffffff { @@ -671,7 +676,7 @@ func GetTempPath(buflen uint32, buf *uint16) (n uint32, errno int) { return } -func CreatePipe(readhandle *uint32, writehandle *uint32, sa *SecurityAttributes, size uint32) (errno int) { +func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (errno int) { r1, _, e1 := Syscall6(procCreatePipe, 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0) if int(r1) == 0 { if e1 != 0 { @@ -685,7 +690,7 @@ func CreatePipe(readhandle *uint32, writehandle *uint32, sa *SecurityAttributes, return } -func GetFileType(filehandle uint32) (n uint32, errno int) { +func GetFileType(filehandle Handle) (n uint32, errno int) { r0, _, e1 := Syscall(procGetFileType, 1, uintptr(filehandle), 0, 0) n = uint32(r0) if n == 0 { @@ -700,7 +705,7 @@ func GetFileType(filehandle uint32) (n uint32, errno int) { return } -func CryptAcquireContext(provhandle *uint32, container *uint16, provider *uint16, provtype uint32, flags uint32) (errno int) { +func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (errno int) { r1, _, e1 := Syscall6(procCryptAcquireContextW, 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0) if int(r1) == 0 { if e1 != 0 { @@ -714,7 +719,7 @@ func CryptAcquireContext(provhandle *uint32, container *uint16, provider *uint16 return } -func CryptReleaseContext(provhandle uint32, flags uint32) (errno int) { +func CryptReleaseContext(provhandle Handle, flags uint32) (errno int) { r1, _, e1 := Syscall(procCryptReleaseContext, 2, uintptr(provhandle), uintptr(flags), 0) if int(r1) == 0 { if e1 != 0 { @@ -728,7 +733,7 @@ func CryptReleaseContext(provhandle uint32, flags uint32) (errno int) { return } -func CryptGenRandom(provhandle uint32, buflen uint32, buf *byte) (errno int) { +func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (errno int) { r1, _, e1 := Syscall(procCryptGenRandom, 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf))) if int(r1) == 0 { if e1 != 0 { @@ -800,7 +805,7 @@ func SetEnvironmentVariable(name *uint16, value *uint16) (errno int) { return } -func SetFileTime(handle int32, ctime *Filetime, atime *Filetime, wtime *Filetime) (errno int) { +func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (errno int) { r1, _, e1 := Syscall6(procSetFileTime, 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) if int(r1) == 0 { if e1 != 0 { @@ -864,9 +869,9 @@ func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err return } -func LocalFree(hmem uint32) (handle uint32, errno int) { +func LocalFree(hmem Handle) (handle Handle, errno int) { r0, _, e1 := Syscall(procLocalFree, 1, uintptr(hmem), 0, 0) - handle = uint32(r0) + handle = Handle(r0) if handle != 0 { if e1 != 0 { errno = int(e1) @@ -879,7 +884,7 @@ func LocalFree(hmem uint32) (handle uint32, errno int) { return } -func SetHandleInformation(handle int32, mask uint32, flags uint32) (errno int) { +func SetHandleInformation(handle Handle, mask uint32, flags uint32) (errno int) { r1, _, e1 := Syscall(procSetHandleInformation, 3, uintptr(handle), uintptr(mask), uintptr(flags)) if int(r1) == 0 { if e1 != 0 { @@ -893,7 +898,7 @@ func SetHandleInformation(handle int32, mask uint32, flags uint32) (errno int) { return } -func FlushFileBuffers(handle int32) (errno int) { +func FlushFileBuffers(handle Handle) (errno int) { r1, _, e1 := Syscall(procFlushFileBuffers, 1, uintptr(handle), 0, 0) if int(r1) == 0 { if e1 != 0 { @@ -922,9 +927,9 @@ func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) ( return } -func CreateFileMapping(fhandle int32, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle int32, errno int) { +func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, errno int) { r0, _, e1 := Syscall6(procCreateFileMappingW, 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) - handle = int32(r0) + handle = Handle(r0) if handle == 0 { if e1 != 0 { errno = int(e1) @@ -937,7 +942,7 @@ func CreateFileMapping(fhandle int32, sa *SecurityAttributes, prot uint32, maxSi return } -func MapViewOfFile(handle int32, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, errno int) { +func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, errno int) { r0, _, e1 := Syscall6(procMapViewOfFile, 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0) addr = uintptr(r0) if addr == 0 { @@ -1008,6 +1013,20 @@ func VirtualUnlock(addr uintptr, length uintptr) (errno int) { return } +func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (errno int) { + r1, _, e1 := Syscall9(procTransmitFile, 7, uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + func WSAStartup(verreq uint32, data *WSAData) (sockerrno int) { r0, _, _ := Syscall(procWSAStartup, 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0) sockerrno = int(r0) @@ -1028,10 +1047,24 @@ func WSACleanup() (errno int) { return } -func socket(af int32, typ int32, protocol int32) (handle int32, errno int) { +func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (errno int) { + r1, _, e1 := Syscall9(procWSAIoctl, 9, uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) + if int(r1) == -1 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func socket(af int32, typ int32, protocol int32) (handle Handle, errno int) { r0, _, e1 := Syscall(procsocket, 3, uintptr(af), uintptr(typ), uintptr(protocol)) - handle = int32(r0) - if handle == -1 { + handle = Handle(r0) + if handle == InvalidHandle { if e1 != 0 { errno = int(e1) } else { @@ -1043,7 +1076,7 @@ func socket(af int32, typ int32, protocol int32) (handle int32, errno int) { return } -func setsockopt(s int32, level int32, optname int32, optval *byte, optlen int32) (errno int) { +func setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (errno int) { r1, _, e1 := Syscall6(procsetsockopt, 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0) if int(r1) == -1 { if e1 != 0 { @@ -1057,7 +1090,7 @@ func setsockopt(s int32, level int32, optname int32, optval *byte, optlen int32) return } -func bind(s int32, name uintptr, namelen int32) (errno int) { +func bind(s Handle, name uintptr, namelen int32) (errno int) { r1, _, e1 := Syscall(procbind, 3, uintptr(s), uintptr(name), uintptr(namelen)) if int(r1) == -1 { if e1 != 0 { @@ -1071,7 +1104,7 @@ func bind(s int32, name uintptr, namelen int32) (errno int) { return } -func connect(s int32, name uintptr, namelen int32) (errno int) { +func connect(s Handle, name uintptr, namelen int32) (errno int) { r1, _, e1 := Syscall(procconnect, 3, uintptr(s), uintptr(name), uintptr(namelen)) if int(r1) == -1 { if e1 != 0 { @@ -1085,7 +1118,7 @@ func connect(s int32, name uintptr, namelen int32) (errno int) { return } -func getsockname(s int32, rsa *RawSockaddrAny, addrlen *int32) (errno int) { +func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (errno int) { r1, _, e1 := Syscall(procgetsockname, 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if int(r1) == -1 { if e1 != 0 { @@ -1099,7 +1132,7 @@ func getsockname(s int32, rsa *RawSockaddrAny, addrlen *int32) (errno int) { return } -func getpeername(s int32, rsa *RawSockaddrAny, addrlen *int32) (errno int) { +func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (errno int) { r1, _, e1 := Syscall(procgetpeername, 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) if int(r1) == -1 { if e1 != 0 { @@ -1113,7 +1146,7 @@ func getpeername(s int32, rsa *RawSockaddrAny, addrlen *int32) (errno int) { return } -func listen(s int32, backlog int32) (errno int) { +func listen(s Handle, backlog int32) (errno int) { r1, _, e1 := Syscall(proclisten, 2, uintptr(s), uintptr(backlog), 0) if int(r1) == -1 { if e1 != 0 { @@ -1127,7 +1160,7 @@ func listen(s int32, backlog int32) (errno int) { return } -func shutdown(s int32, how int32) (errno int) { +func shutdown(s Handle, how int32) (errno int) { r1, _, e1 := Syscall(procshutdown, 2, uintptr(s), uintptr(how), 0) if int(r1) == -1 { if e1 != 0 { @@ -1141,7 +1174,7 @@ func shutdown(s int32, how int32) (errno int) { return } -func Closesocket(s int32) (errno int) { +func Closesocket(s Handle) (errno int) { r1, _, e1 := Syscall(procclosesocket, 1, uintptr(s), 0, 0) if int(r1) == -1 { if e1 != 0 { @@ -1155,7 +1188,7 @@ func Closesocket(s int32) (errno int) { return } -func AcceptEx(ls uint32, as uint32, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (errno int) { +func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (errno int) { r1, _, e1 := Syscall9(procAcceptEx, 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0) if int(r1) == 0 { if e1 != 0 { @@ -1174,7 +1207,7 @@ func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen return } -func WSARecv(s uint32, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (errno int) { +func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (errno int) { r1, _, e1 := Syscall9(procWSARecv, 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) if int(r1) == -1 { if e1 != 0 { @@ -1188,7 +1221,7 @@ func WSARecv(s uint32, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32 return } -func WSASend(s uint32, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (errno int) { +func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (errno int) { r1, _, e1 := Syscall9(procWSASend, 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) if int(r1) == -1 { if e1 != 0 { @@ -1202,7 +1235,7 @@ func WSASend(s uint32, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, return } -func WSARecvFrom(s uint32, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (errno int) { +func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (errno int) { r1, _, e1 := Syscall9(procWSARecvFrom, 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if int(r1) == -1 { if e1 != 0 { @@ -1216,7 +1249,7 @@ func WSARecvFrom(s uint32, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *ui return } -func WSASendTo(s uint32, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (errno int) { +func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (errno int) { r1, _, e1 := Syscall9(procWSASendTo, 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) if int(r1) == -1 { if e1 != 0 { @@ -1276,3 +1309,15 @@ func DnsRecordListFree(rl *DNSRecord, freetype uint32) { Syscall(procDnsRecordListFree, 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0) return } + +func GetIfEntry(pIfRow *MibIfRow) (errcode int) { + r0, _, _ := Syscall(procGetIfEntry, 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0) + errcode = int(r0) + return +} + +func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode int) { + r0, _, _ := Syscall(procGetAdaptersInfo, 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0) + errcode = int(r0) + return +} diff --git a/src/pkg/syscall/zsyscall_windows_amd64.go b/src/pkg/syscall/zsyscall_windows_amd64.go new file mode 100644 index 000000000..e7d09fbc2 --- /dev/null +++ b/src/pkg/syscall/zsyscall_windows_amd64.go @@ -0,0 +1,1323 @@ +// mksyscall_windows.pl syscall_windows.go syscall_windows_amd64.go +// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT + +package syscall + +import "unsafe" + +var ( + modkernel32 = loadDll("kernel32.dll") + modadvapi32 = loadDll("advapi32.dll") + modshell32 = loadDll("shell32.dll") + modwsock32 = loadDll("wsock32.dll") + modws2_32 = loadDll("ws2_32.dll") + moddnsapi = loadDll("dnsapi.dll") + modiphlpapi = loadDll("iphlpapi.dll") + + procGetLastError = getSysProcAddr(modkernel32, "GetLastError") + procLoadLibraryW = getSysProcAddr(modkernel32, "LoadLibraryW") + procFreeLibrary = getSysProcAddr(modkernel32, "FreeLibrary") + procGetProcAddress = getSysProcAddr(modkernel32, "GetProcAddress") + procGetVersion = getSysProcAddr(modkernel32, "GetVersion") + procFormatMessageW = getSysProcAddr(modkernel32, "FormatMessageW") + procExitProcess = getSysProcAddr(modkernel32, "ExitProcess") + procCreateFileW = getSysProcAddr(modkernel32, "CreateFileW") + procReadFile = getSysProcAddr(modkernel32, "ReadFile") + procWriteFile = getSysProcAddr(modkernel32, "WriteFile") + procSetFilePointer = getSysProcAddr(modkernel32, "SetFilePointer") + procCloseHandle = getSysProcAddr(modkernel32, "CloseHandle") + procGetStdHandle = getSysProcAddr(modkernel32, "GetStdHandle") + procFindFirstFileW = getSysProcAddr(modkernel32, "FindFirstFileW") + procFindNextFileW = getSysProcAddr(modkernel32, "FindNextFileW") + procFindClose = getSysProcAddr(modkernel32, "FindClose") + procGetFileInformationByHandle = getSysProcAddr(modkernel32, "GetFileInformationByHandle") + procGetCurrentDirectoryW = getSysProcAddr(modkernel32, "GetCurrentDirectoryW") + procSetCurrentDirectoryW = getSysProcAddr(modkernel32, "SetCurrentDirectoryW") + procCreateDirectoryW = getSysProcAddr(modkernel32, "CreateDirectoryW") + procRemoveDirectoryW = getSysProcAddr(modkernel32, "RemoveDirectoryW") + procDeleteFileW = getSysProcAddr(modkernel32, "DeleteFileW") + procMoveFileW = getSysProcAddr(modkernel32, "MoveFileW") + procGetComputerNameW = getSysProcAddr(modkernel32, "GetComputerNameW") + procSetEndOfFile = getSysProcAddr(modkernel32, "SetEndOfFile") + procGetSystemTimeAsFileTime = getSysProcAddr(modkernel32, "GetSystemTimeAsFileTime") + procSleep = getSysProcAddr(modkernel32, "Sleep") + procGetTimeZoneInformation = getSysProcAddr(modkernel32, "GetTimeZoneInformation") + procCreateIoCompletionPort = getSysProcAddr(modkernel32, "CreateIoCompletionPort") + procGetQueuedCompletionStatus = getSysProcAddr(modkernel32, "GetQueuedCompletionStatus") + procCancelIo = getSysProcAddr(modkernel32, "CancelIo") + procCreateProcessW = getSysProcAddr(modkernel32, "CreateProcessW") + procOpenProcess = getSysProcAddr(modkernel32, "OpenProcess") + procTerminateProcess = getSysProcAddr(modkernel32, "TerminateProcess") + procGetExitCodeProcess = getSysProcAddr(modkernel32, "GetExitCodeProcess") + procGetStartupInfoW = getSysProcAddr(modkernel32, "GetStartupInfoW") + procGetCurrentProcess = getSysProcAddr(modkernel32, "GetCurrentProcess") + procDuplicateHandle = getSysProcAddr(modkernel32, "DuplicateHandle") + procWaitForSingleObject = getSysProcAddr(modkernel32, "WaitForSingleObject") + procGetTempPathW = getSysProcAddr(modkernel32, "GetTempPathW") + procCreatePipe = getSysProcAddr(modkernel32, "CreatePipe") + procGetFileType = getSysProcAddr(modkernel32, "GetFileType") + procCryptAcquireContextW = getSysProcAddr(modadvapi32, "CryptAcquireContextW") + procCryptReleaseContext = getSysProcAddr(modadvapi32, "CryptReleaseContext") + procCryptGenRandom = getSysProcAddr(modadvapi32, "CryptGenRandom") + procGetEnvironmentStringsW = getSysProcAddr(modkernel32, "GetEnvironmentStringsW") + procFreeEnvironmentStringsW = getSysProcAddr(modkernel32, "FreeEnvironmentStringsW") + procGetEnvironmentVariableW = getSysProcAddr(modkernel32, "GetEnvironmentVariableW") + procSetEnvironmentVariableW = getSysProcAddr(modkernel32, "SetEnvironmentVariableW") + procSetFileTime = getSysProcAddr(modkernel32, "SetFileTime") + procGetFileAttributesW = getSysProcAddr(modkernel32, "GetFileAttributesW") + procSetFileAttributesW = getSysProcAddr(modkernel32, "SetFileAttributesW") + procGetCommandLineW = getSysProcAddr(modkernel32, "GetCommandLineW") + procCommandLineToArgvW = getSysProcAddr(modshell32, "CommandLineToArgvW") + procLocalFree = getSysProcAddr(modkernel32, "LocalFree") + procSetHandleInformation = getSysProcAddr(modkernel32, "SetHandleInformation") + procFlushFileBuffers = getSysProcAddr(modkernel32, "FlushFileBuffers") + procGetFullPathNameW = getSysProcAddr(modkernel32, "GetFullPathNameW") + procCreateFileMappingW = getSysProcAddr(modkernel32, "CreateFileMappingW") + procMapViewOfFile = getSysProcAddr(modkernel32, "MapViewOfFile") + procUnmapViewOfFile = getSysProcAddr(modkernel32, "UnmapViewOfFile") + procFlushViewOfFile = getSysProcAddr(modkernel32, "FlushViewOfFile") + procVirtualLock = getSysProcAddr(modkernel32, "VirtualLock") + procVirtualUnlock = getSysProcAddr(modkernel32, "VirtualUnlock") + procTransmitFile = getSysProcAddr(modwsock32, "TransmitFile") + procWSAStartup = getSysProcAddr(modwsock32, "WSAStartup") + procWSACleanup = getSysProcAddr(modwsock32, "WSACleanup") + procWSAIoctl = getSysProcAddr(modws2_32, "WSAIoctl") + procsocket = getSysProcAddr(modwsock32, "socket") + procsetsockopt = getSysProcAddr(modwsock32, "setsockopt") + procbind = getSysProcAddr(modwsock32, "bind") + procconnect = getSysProcAddr(modwsock32, "connect") + procgetsockname = getSysProcAddr(modwsock32, "getsockname") + procgetpeername = getSysProcAddr(modwsock32, "getpeername") + proclisten = getSysProcAddr(modwsock32, "listen") + procshutdown = getSysProcAddr(modwsock32, "shutdown") + procclosesocket = getSysProcAddr(modwsock32, "closesocket") + procAcceptEx = getSysProcAddr(modwsock32, "AcceptEx") + procGetAcceptExSockaddrs = getSysProcAddr(modwsock32, "GetAcceptExSockaddrs") + procWSARecv = getSysProcAddr(modws2_32, "WSARecv") + procWSASend = getSysProcAddr(modws2_32, "WSASend") + procWSARecvFrom = getSysProcAddr(modws2_32, "WSARecvFrom") + procWSASendTo = getSysProcAddr(modws2_32, "WSASendTo") + procgethostbyname = getSysProcAddr(modws2_32, "gethostbyname") + procgetservbyname = getSysProcAddr(modws2_32, "getservbyname") + procntohs = getSysProcAddr(modws2_32, "ntohs") + procDnsQuery_W = getSysProcAddr(moddnsapi, "DnsQuery_W") + procDnsRecordListFree = getSysProcAddr(moddnsapi, "DnsRecordListFree") + procGetIfEntry = getSysProcAddr(modiphlpapi, "GetIfEntry") + procGetAdaptersInfo = getSysProcAddr(modiphlpapi, "GetAdaptersInfo") +) + +func GetLastError() (lasterrno int) { + r0, _, _ := Syscall(procGetLastError, 0, 0, 0, 0) + lasterrno = int(r0) + return +} + +func LoadLibrary(libname string) (handle Handle, errno int) { + r0, _, e1 := Syscall(procLoadLibraryW, 1, uintptr(unsafe.Pointer(StringToUTF16Ptr(libname))), 0, 0) + handle = Handle(r0) + if handle == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func FreeLibrary(handle Handle) (errno int) { + r1, _, e1 := Syscall(procFreeLibrary, 1, uintptr(handle), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetProcAddress(module Handle, procname string) (proc Handle, errno int) { + r0, _, e1 := Syscall(procGetProcAddress, 2, uintptr(module), uintptr(unsafe.Pointer(StringBytePtr(procname))), 0) + proc = Handle(r0) + if proc == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetVersion() (ver uint32, errno int) { + r0, _, e1 := Syscall(procGetVersion, 0, 0, 0, 0) + ver = uint32(r0) + if ver == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func FormatMessage(flags uint32, msgsrc uint32, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, errno int) { + var _p0 *uint16 + if len(buf) > 0 { + _p0 = &buf[0] + } + r0, _, e1 := Syscall9(procFormatMessageW, 7, uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args)), 0, 0) + n = uint32(r0) + if n == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func ExitProcess(exitcode uint32) { + Syscall(procExitProcess, 1, uintptr(exitcode), 0, 0) + return +} + +func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, errno int) { + r0, _, e1 := Syscall9(procCreateFileW, 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0) + handle = Handle(r0) + if handle == InvalidHandle { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (errno int) { + var _p0 *byte + if len(buf) > 0 { + _p0 = &buf[0] + } + r1, _, e1 := Syscall6(procReadFile, 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (errno int) { + var _p0 *byte + if len(buf) > 0 { + _p0 = &buf[0] + } + r1, _, e1 := Syscall6(procWriteFile, 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, errno int) { + r0, _, e1 := Syscall6(procSetFilePointer, 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0) + newlowoffset = uint32(r0) + if newlowoffset == 0xffffffff { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func CloseHandle(handle Handle) (errno int) { + r1, _, e1 := Syscall(procCloseHandle, 1, uintptr(handle), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetStdHandle(stdhandle int) (handle Handle, errno int) { + r0, _, e1 := Syscall(procGetStdHandle, 1, uintptr(stdhandle), 0, 0) + handle = Handle(r0) + if handle == InvalidHandle { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, errno int) { + r0, _, e1 := Syscall(procFindFirstFileW, 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0) + handle = Handle(r0) + if handle == InvalidHandle { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func FindNextFile(handle Handle, data *Win32finddata) (errno int) { + r1, _, e1 := Syscall(procFindNextFileW, 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func FindClose(handle Handle) (errno int) { + r1, _, e1 := Syscall(procFindClose, 1, uintptr(handle), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (errno int) { + r1, _, e1 := Syscall(procGetFileInformationByHandle, 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, errno int) { + r0, _, e1 := Syscall(procGetCurrentDirectoryW, 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) + n = uint32(r0) + if n == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func SetCurrentDirectory(path *uint16) (errno int) { + r1, _, e1 := Syscall(procSetCurrentDirectoryW, 1, uintptr(unsafe.Pointer(path)), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func CreateDirectory(path *uint16, sa *SecurityAttributes) (errno int) { + r1, _, e1 := Syscall(procCreateDirectoryW, 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func RemoveDirectory(path *uint16) (errno int) { + r1, _, e1 := Syscall(procRemoveDirectoryW, 1, uintptr(unsafe.Pointer(path)), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func DeleteFile(path *uint16) (errno int) { + r1, _, e1 := Syscall(procDeleteFileW, 1, uintptr(unsafe.Pointer(path)), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func MoveFile(from *uint16, to *uint16) (errno int) { + r1, _, e1 := Syscall(procMoveFileW, 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetComputerName(buf *uint16, n *uint32) (errno int) { + r1, _, e1 := Syscall(procGetComputerNameW, 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func SetEndOfFile(handle Handle) (errno int) { + r1, _, e1 := Syscall(procSetEndOfFile, 1, uintptr(handle), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetSystemTimeAsFileTime(time *Filetime) { + Syscall(procGetSystemTimeAsFileTime, 1, uintptr(unsafe.Pointer(time)), 0, 0) + return +} + +func sleep(msec uint32) { + Syscall(procSleep, 1, uintptr(msec), 0, 0) + return +} + +func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, errno int) { + r0, _, e1 := Syscall(procGetTimeZoneInformation, 1, uintptr(unsafe.Pointer(tzi)), 0, 0) + rc = uint32(r0) + if rc == 0xffffffff { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, errno int) { + r0, _, e1 := Syscall6(procCreateIoCompletionPort, 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0) + handle = Handle(r0) + if handle == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (errno int) { + r1, _, e1 := Syscall6(procGetQueuedCompletionStatus, 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func CancelIo(s Handle) (errno int) { + r1, _, e1 := Syscall(procCancelIo, 1, uintptr(s), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (errno int) { + var _p0 uint32 + if inheritHandles { + _p0 = 1 + } else { + _p0 = 0 + } + r1, _, e1 := Syscall12(procCreateProcessW, 10, uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, errno int) { + var _p0 uint32 + if inheritHandle { + _p0 = 1 + } else { + _p0 = 0 + } + r0, _, e1 := Syscall(procOpenProcess, 3, uintptr(da), uintptr(_p0), uintptr(pid)) + handle = Handle(r0) + if handle == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func TerminateProcess(handle Handle, exitcode uint32) (errno int) { + r1, _, e1 := Syscall(procTerminateProcess, 2, uintptr(handle), uintptr(exitcode), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetExitCodeProcess(handle Handle, exitcode *uint32) (errno int) { + r1, _, e1 := Syscall(procGetExitCodeProcess, 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetStartupInfo(startupInfo *StartupInfo) (errno int) { + r1, _, e1 := Syscall(procGetStartupInfoW, 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetCurrentProcess() (pseudoHandle Handle, errno int) { + r0, _, e1 := Syscall(procGetCurrentProcess, 0, 0, 0, 0) + pseudoHandle = Handle(r0) + if pseudoHandle == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (errno int) { + var _p0 uint32 + if bInheritHandle { + _p0 = 1 + } else { + _p0 = 0 + } + r1, _, e1 := Syscall9(procDuplicateHandle, 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, errno int) { + r0, _, e1 := Syscall(procWaitForSingleObject, 2, uintptr(handle), uintptr(waitMilliseconds), 0) + event = uint32(r0) + if event == 0xffffffff { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetTempPath(buflen uint32, buf *uint16) (n uint32, errno int) { + r0, _, e1 := Syscall(procGetTempPathW, 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) + n = uint32(r0) + if n == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (errno int) { + r1, _, e1 := Syscall6(procCreatePipe, 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetFileType(filehandle Handle) (n uint32, errno int) { + r0, _, e1 := Syscall(procGetFileType, 1, uintptr(filehandle), 0, 0) + n = uint32(r0) + if n == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (errno int) { + r1, _, e1 := Syscall6(procCryptAcquireContextW, 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func CryptReleaseContext(provhandle Handle, flags uint32) (errno int) { + r1, _, e1 := Syscall(procCryptReleaseContext, 2, uintptr(provhandle), uintptr(flags), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (errno int) { + r1, _, e1 := Syscall(procCryptGenRandom, 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf))) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetEnvironmentStrings() (envs *uint16, errno int) { + r0, _, e1 := Syscall(procGetEnvironmentStringsW, 0, 0, 0, 0) + envs = (*uint16)(unsafe.Pointer(r0)) + if envs == nil { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func FreeEnvironmentStrings(envs *uint16) (errno int) { + r1, _, e1 := Syscall(procFreeEnvironmentStringsW, 1, uintptr(unsafe.Pointer(envs)), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, errno int) { + r0, _, e1 := Syscall(procGetEnvironmentVariableW, 3, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size)) + n = uint32(r0) + if n == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func SetEnvironmentVariable(name *uint16, value *uint16) (errno int) { + r1, _, e1 := Syscall(procSetEnvironmentVariableW, 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (errno int) { + r1, _, e1 := Syscall6(procSetFileTime, 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetFileAttributes(name *uint16) (attrs uint32, errno int) { + r0, _, e1 := Syscall(procGetFileAttributesW, 1, uintptr(unsafe.Pointer(name)), 0, 0) + attrs = uint32(r0) + if attrs == INVALID_FILE_ATTRIBUTES { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func SetFileAttributes(name *uint16, attrs uint32) (errno int) { + r1, _, e1 := Syscall(procSetFileAttributesW, 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetCommandLine() (cmd *uint16) { + r0, _, _ := Syscall(procGetCommandLineW, 0, 0, 0, 0) + cmd = (*uint16)(unsafe.Pointer(r0)) + return +} + +func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, errno int) { + r0, _, e1 := Syscall(procCommandLineToArgvW, 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0) + argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0)) + if argv == nil { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func LocalFree(hmem Handle) (handle Handle, errno int) { + r0, _, e1 := Syscall(procLocalFree, 1, uintptr(hmem), 0, 0) + handle = Handle(r0) + if handle != 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func SetHandleInformation(handle Handle, mask uint32, flags uint32) (errno int) { + r1, _, e1 := Syscall(procSetHandleInformation, 3, uintptr(handle), uintptr(mask), uintptr(flags)) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func FlushFileBuffers(handle Handle) (errno int) { + r1, _, e1 := Syscall(procFlushFileBuffers, 1, uintptr(handle), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, errno int) { + r0, _, e1 := Syscall6(procGetFullPathNameW, 4, uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname)), 0, 0) + n = uint32(r0) + if n == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, errno int) { + r0, _, e1 := Syscall6(procCreateFileMappingW, 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) + handle = Handle(r0) + if handle == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, errno int) { + r0, _, e1 := Syscall6(procMapViewOfFile, 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0) + addr = uintptr(r0) + if addr == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func UnmapViewOfFile(addr uintptr) (errno int) { + r1, _, e1 := Syscall(procUnmapViewOfFile, 1, uintptr(addr), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func FlushViewOfFile(addr uintptr, length uintptr) (errno int) { + r1, _, e1 := Syscall(procFlushViewOfFile, 2, uintptr(addr), uintptr(length), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func VirtualLock(addr uintptr, length uintptr) (errno int) { + r1, _, e1 := Syscall(procVirtualLock, 2, uintptr(addr), uintptr(length), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func VirtualUnlock(addr uintptr, length uintptr) (errno int) { + r1, _, e1 := Syscall(procVirtualUnlock, 2, uintptr(addr), uintptr(length), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (errno int) { + r1, _, e1 := Syscall9(procTransmitFile, 7, uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags), 0, 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func WSAStartup(verreq uint32, data *WSAData) (sockerrno int) { + r0, _, _ := Syscall(procWSAStartup, 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0) + sockerrno = int(r0) + return +} + +func WSACleanup() (errno int) { + r1, _, e1 := Syscall(procWSACleanup, 0, 0, 0, 0) + if int(r1) == -1 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (errno int) { + r1, _, e1 := Syscall9(procWSAIoctl, 9, uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) + if int(r1) == -1 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func socket(af int32, typ int32, protocol int32) (handle Handle, errno int) { + r0, _, e1 := Syscall(procsocket, 3, uintptr(af), uintptr(typ), uintptr(protocol)) + handle = Handle(r0) + if handle == InvalidHandle { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (errno int) { + r1, _, e1 := Syscall6(procsetsockopt, 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0) + if int(r1) == -1 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func bind(s Handle, name uintptr, namelen int32) (errno int) { + r1, _, e1 := Syscall(procbind, 3, uintptr(s), uintptr(name), uintptr(namelen)) + if int(r1) == -1 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func connect(s Handle, name uintptr, namelen int32) (errno int) { + r1, _, e1 := Syscall(procconnect, 3, uintptr(s), uintptr(name), uintptr(namelen)) + if int(r1) == -1 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (errno int) { + r1, _, e1 := Syscall(procgetsockname, 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if int(r1) == -1 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (errno int) { + r1, _, e1 := Syscall(procgetpeername, 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) + if int(r1) == -1 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func listen(s Handle, backlog int32) (errno int) { + r1, _, e1 := Syscall(proclisten, 2, uintptr(s), uintptr(backlog), 0) + if int(r1) == -1 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func shutdown(s Handle, how int32) (errno int) { + r1, _, e1 := Syscall(procshutdown, 2, uintptr(s), uintptr(how), 0) + if int(r1) == -1 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func Closesocket(s Handle) (errno int) { + r1, _, e1 := Syscall(procclosesocket, 1, uintptr(s), 0, 0) + if int(r1) == -1 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (errno int) { + r1, _, e1 := Syscall9(procAcceptEx, 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0) + if int(r1) == 0 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) { + Syscall9(procGetAcceptExSockaddrs, 8, uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen)), 0) + return +} + +func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (errno int) { + r1, _, e1 := Syscall9(procWSARecv, 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) + if int(r1) == -1 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (errno int) { + r1, _, e1 := Syscall9(procWSASend, 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) + if int(r1) == -1 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (errno int) { + r1, _, e1 := Syscall9(procWSARecvFrom, 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + if int(r1) == -1 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (errno int) { + r1, _, e1 := Syscall9(procWSASendTo, 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) + if int(r1) == -1 { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetHostByName(name string) (h *Hostent, errno int) { + r0, _, e1 := Syscall(procgethostbyname, 1, uintptr(unsafe.Pointer(StringBytePtr(name))), 0, 0) + h = (*Hostent)(unsafe.Pointer(r0)) + if h == nil { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func GetServByName(name string, proto string) (s *Servent, errno int) { + r0, _, e1 := Syscall(procgetservbyname, 2, uintptr(unsafe.Pointer(StringBytePtr(name))), uintptr(unsafe.Pointer(StringBytePtr(proto))), 0) + s = (*Servent)(unsafe.Pointer(r0)) + if s == nil { + if e1 != 0 { + errno = int(e1) + } else { + errno = EINVAL + } + } else { + errno = 0 + } + return +} + +func Ntohs(netshort uint16) (u uint16) { + r0, _, _ := Syscall(procntohs, 1, uintptr(netshort), 0, 0) + u = uint16(r0) + return +} + +func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status uint32) { + r0, _, _ := Syscall6(procDnsQuery_W, 6, uintptr(unsafe.Pointer(StringToUTF16Ptr(name))), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr))) + status = uint32(r0) + return +} + +func DnsRecordListFree(rl *DNSRecord, freetype uint32) { + Syscall(procDnsRecordListFree, 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0) + return +} + +func GetIfEntry(pIfRow *MibIfRow) (errcode int) { + r0, _, _ := Syscall(procGetIfEntry, 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0) + errcode = int(r0) + return +} + +func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode int) { + r0, _, _ := Syscall(procGetAdaptersInfo, 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0) + errcode = int(r0) + return +} diff --git a/src/pkg/syscall/zsysnum_darwin_386.go b/src/pkg/syscall/zsysnum_darwin_386.go index 8d5c93478..50aec39f1 100644 --- a/src/pkg/syscall/zsysnum_darwin_386.go +++ b/src/pkg/syscall/zsysnum_darwin_386.go @@ -1,485 +1,355 @@ -// mksysnum_darwin.sh /home/rsc/pub/xnu-1228/bsd/kern/syscalls.master +// mksysnum_darwin.pl /usr/include/sys/syscall.h // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT package syscall const ( - // SYS_NOSYS = 0; // { int nosys(void); } { indirect syscall } - SYS_EXIT = 1 // { void exit(int rval); } - SYS_FORK = 2 // { int fork(void); } - SYS_READ = 3 // { user_ssize_t read(int fd, user_addr_t cbuf, user_size_t nbyte); } - SYS_WRITE = 4 // { user_ssize_t write(int fd, user_addr_t cbuf, user_size_t nbyte); } - SYS_OPEN = 5 // { int open(user_addr_t path, int flags, int mode); } - SYS_CLOSE = 6 // { int close(int fd); } - SYS_WAIT4 = 7 // { int wait4(int pid, user_addr_t status, int options, user_addr_t rusage); } - // SYS_NOSYS = 8; // { int nosys(void); } { old creat } - SYS_LINK = 9 // { int link(user_addr_t path, user_addr_t link); } - SYS_UNLINK = 10 // { int unlink(user_addr_t path); } - // SYS_NOSYS = 11; // { int nosys(void); } { old execv } - SYS_CHDIR = 12 // { int chdir(user_addr_t path); } - SYS_FCHDIR = 13 // { int fchdir(int fd); } - SYS_MKNOD = 14 // { int mknod(user_addr_t path, int mode, int dev); } - SYS_CHMOD = 15 // { int chmod(user_addr_t path, int mode); } - SYS_CHOWN = 16 // { int chown(user_addr_t path, int uid, int gid); } - SYS_OGETFSSTAT = 18 // { int ogetfsstat(user_addr_t buf, int bufsize, int flags); } - SYS_GETFSSTAT = 18 // { int getfsstat(user_addr_t buf, int bufsize, int flags); } - // SYS_NOSYS = 19; // { int nosys(void); } { old lseek } - SYS_GETPID = 20 // { int getpid(void); } - // SYS_NOSYS = 21; // { int nosys(void); } { old mount } - // SYS_NOSYS = 22; // { int nosys(void); } { old umount } - SYS_SETUID = 23 // { int setuid(uid_t uid); } - SYS_GETUID = 24 // { int getuid(void); } - SYS_GETEUID = 25 // { int geteuid(void); } - SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); } - SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); } - SYS_SENDMSG = 28 // { int sendmsg(int s, caddr_t msg, int flags); } - SYS_RECVFROM = 29 // { int recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, int *fromlenaddr); } - SYS_ACCEPT = 30 // { int accept(int s, caddr_t name, socklen_t *anamelen); } - SYS_GETPEERNAME = 31 // { int getpeername(int fdes, caddr_t asa, socklen_t *alen); } - SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, caddr_t asa, socklen_t *alen); } - // SYS_NOSYS = 27; // { int nosys(void); } - // SYS_NOSYS = 28; // { int nosys(void); } - // SYS_NOSYS = 29; // { int nosys(void); } - // SYS_NOSYS = 30; // { int nosys(void); } - // SYS_NOSYS = 31; // { int nosys(void); } - // SYS_NOSYS = 32; // { int nosys(void); } - SYS_ACCESS = 33 // { int access(user_addr_t path, int flags); } - SYS_CHFLAGS = 34 // { int chflags(char *path, int flags); } - SYS_FCHFLAGS = 35 // { int fchflags(int fd, int flags); } - SYS_SYNC = 36 // { int sync(void); } - SYS_KILL = 37 // { int kill(int pid, int signum, int posix); } - // SYS_NOSYS = 38; // { int nosys(void); } { old stat } - SYS_GETPPID = 39 // { int getppid(void); } - // SYS_NOSYS = 40; // { int nosys(void); } { old lstat } - SYS_DUP = 41 // { int dup(u_int fd); } - SYS_PIPE = 42 // { int pipe(void); } - SYS_GETEGID = 43 // { int getegid(void); } - SYS_PROFIL = 44 // { int profil(short *bufbase, size_t bufsize, u_long pcoffset, u_int pcscale); } - // SYS_NOSYS = 45; // { int nosys(void); } { old ktrace } - SYS_SIGACTION = 46 // { int sigaction(int signum, struct __sigaction *nsa, struct sigaction *osa); } - SYS_GETGID = 47 // { int getgid(void); } - SYS_SIGPROCMASK = 48 // { int sigprocmask(int how, user_addr_t mask, user_addr_t omask); } - SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int namelen); } - SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } - SYS_ACCT = 51 // { int acct(char *path); } - SYS_SIGPENDING = 52 // { int sigpending(struct sigvec *osv); } - SYS_SIGALTSTACK = 53 // { int sigaltstack(struct sigaltstack *nss, struct sigaltstack *oss); } - SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); } - SYS_REBOOT = 55 // { int reboot(int opt, char *command); } - SYS_REVOKE = 56 // { int revoke(char *path); } - SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } - SYS_READLINK = 58 // { int readlink(char *path, char *buf, int count); } - SYS_EXECVE = 59 // { int execve(char *fname, char **argp, char **envp); } - SYS_UMASK = 60 // { int umask(int newmask); } - SYS_CHROOT = 61 // { int chroot(user_addr_t path); } - // SYS_NOSYS = 62; // { int nosys(void); } { old fstat } - // SYS_NOSYS = 63; // { int nosys(void); } { used internally, reserved } - // SYS_NOSYS = 64; // { int nosys(void); } { old getpagesize } - SYS_MSYNC = 65 // { int msync(caddr_t addr, size_t len, int flags); } - SYS_VFORK = 66 // { int vfork(void); } - // SYS_NOSYS = 67; // { int nosys(void); } { old vread } - // SYS_NOSYS = 68; // { int nosys(void); } { old vwrite } - SYS_SBRK = 69 // { int sbrk(int incr) NO_SYSCALL_STUB; } - SYS_SSTK = 70 // { int sstk(int incr) NO_SYSCALL_STUB; } - // SYS_NOSYS = 71; // { int nosys(void); } { old mmap } - SYS_OVADVISE = 72 // { int ovadvise(void) NO_SYSCALL_STUB; } { old vadvise } - SYS_MUNMAP = 73 // { int munmap(caddr_t addr, size_t len); } - SYS_MPROTECT = 74 // { int mprotect(caddr_t addr, size_t len, int prot); } - SYS_MADVISE = 75 // { int madvise(caddr_t addr, size_t len, int behav); } - // SYS_NOSYS = 76; // { int nosys(void); } { old vhangup } - // SYS_NOSYS = 77; // { int nosys(void); } { old vlimit } - SYS_MINCORE = 78 // { int mincore(user_addr_t addr, user_size_t len, user_addr_t vec); } - SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } - SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); } - SYS_GETPGRP = 81 // { int getpgrp(void); } - SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } - SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); } - // SYS_NOSYS = 84; // { int nosys(void); } { old wait } - SYS_SWAPON = 85 // { int swapon(void); } - SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); } - // SYS_NOSYS = 87; // { int nosys(void); } { old gethostname } - // SYS_NOSYS = 88; // { int nosys(void); } { old sethostname } - SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } - SYS_DUP2 = 90 // { int dup2(u_int from, u_int to); } - // SYS_NOSYS = 91; // { int nosys(void); } { old getdopt } - SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } - SYS_SELECT = 93 // { int select(int nd, u_int32_t *in, u_int32_t *ou, u_int32_t *ex, struct timeval *tv); } - // SYS_NOSYS = 94; // { int nosys(void); } { old setdopt } - SYS_FSYNC = 95 // { int fsync(int fd); } - SYS_SETPRIORITY = 96 // { int setpriority(int which, id_t who, int prio); } - SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); } - SYS_CONNECT = 98 // { int connect(int s, caddr_t name, socklen_t namelen); } - // SYS_NOSYS = 97; // { int nosys(void); } - // SYS_NOSYS = 98; // { int nosys(void); } - // SYS_NOSYS = 99; // { int nosys(void); } { old accept } - SYS_GETPRIORITY = 100 // { int getpriority(int which, id_t who); } - // SYS_NOSYS = 101; // { int nosys(void); } { old send } - // SYS_NOSYS = 102; // { int nosys(void); } { old recv } - // SYS_NOSYS = 103; // { int nosys(void); } { old sigreturn } - SYS_BIND = 104 // { int bind(int s, caddr_t name, socklen_t namelen); } - SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, socklen_t valsize); } - SYS_LISTEN = 106 // { int listen(int s, int backlog); } - // SYS_NOSYS = 104; // { int nosys(void); } - // SYS_NOSYS = 105; // { int nosys(void); } - // SYS_NOSYS = 106; // { int nosys(void); } - // SYS_NOSYS = 107; // { int nosys(void); } { old vtimes } - // SYS_NOSYS = 108; // { int nosys(void); } { old sigvec } - // SYS_NOSYS = 109; // { int nosys(void); } { old sigblock } - // SYS_NOSYS = 110; // { int nosys(void); } { old sigsetmask } - SYS_SIGSUSPEND = 111 // { int sigsuspend(sigset_t mask); } - // SYS_NOSYS = 112; // { int nosys(void); } { old sigstack } - // SYS_NOSYS = 113; // { int nosys(void); } { old recvmsg } - // SYS_NOSYS = 114; // { int nosys(void); } { old sendmsg } - // SYS_NOSYS = 113; // { int nosys(void); } - // SYS_NOSYS = 114; // { int nosys(void); } - // SYS_NOSYS = 115; // { int nosys(void); } { old vtrace } - SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); } - SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); } - SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, socklen_t *avalsize); } - // SYS_NOSYS = 118; // { int nosys(void); } - // SYS_NOSYS = 119; // { int nosys(void); } { old resuba } - SYS_READV = 120 // { user_ssize_t readv(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_WRITEV = 121 // { user_ssize_t writev(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); } - SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } - SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } - // SYS_NOSYS = 125; // { int nosys(void); } { old recvfrom } - SYS_SETREUID = 126 // { int setreuid(uid_t ruid, uid_t euid); } - SYS_SETREGID = 127 // { int setregid(gid_t rgid, gid_t egid); } - SYS_RENAME = 128 // { int rename(char *from, char *to); } - // SYS_NOSYS = 129; // { int nosys(void); } { old truncate } - // SYS_NOSYS = 130; // { int nosys(void); } { old ftruncate } - SYS_FLOCK = 131 // { int flock(int fd, int how); } - SYS_MKFIFO = 132 // { int mkfifo(user_addr_t path, int mode); } - SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, socklen_t tolen); } - SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } - SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); } - // SYS_NOSYS = 133; // { int nosys(void); } - // SYS_NOSYS = 134; // { int nosys(void); } - // SYS_NOSYS = 135; // { int nosys(void); } - SYS_MKDIR = 136 // { int mkdir(user_addr_t path, int mode); } - SYS_RMDIR = 137 // { int rmdir(char *path); } - SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); } - SYS_FUTIMES = 139 // { int futimes(int fd, struct timeval *tptr); } - SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); } - // SYS_NOSYS = 141; // { int nosys(void); } { old getpeername } - SYS_GETHOSTUUID = 142 // { int gethostuuid(unsigned char *uuid_buf, const struct timespec *timeoutp); } - // SYS_NOSYS = 143; // { int nosys(void); } { old sethostid } - // SYS_NOSYS = 144; // { int nosys(void); } { old getrlimit } - // SYS_NOSYS = 145; // { int nosys(void); } { old setrlimit } - // SYS_NOSYS = 146; // { int nosys(void); } { old killpg } - SYS_SETSID = 147 // { int setsid(void); } - // SYS_NOSYS = 148; // { int nosys(void); } { old setquota } - // SYS_NOSYS = 149; // { int nosys(void); } { old qquota } - // SYS_NOSYS = 150; // { int nosys(void); } { old getsockname } - SYS_GETPGID = 151 // { int getpgid(pid_t pid); } - SYS_SETPRIVEXEC = 152 // { int setprivexec(int flag); } - SYS_PREAD = 153 // { user_ssize_t pread(int fd, user_addr_t buf, user_size_t nbyte, off_t offset); } - SYS_PWRITE = 154 // { user_ssize_t pwrite(int fd, user_addr_t buf, user_size_t nbyte, off_t offset); } - SYS_NFSSVC = 155 // { int nfssvc(int flag, caddr_t argp); } - // SYS_NOSYS = 155; // { int nosys(void); } - // SYS_NOSYS = 156; // { int nosys(void); } { old getdirentries } - SYS_STATFS = 157 // { int statfs(char *path, struct statfs *buf); } - SYS_FSTATFS = 158 // { int fstatfs(int fd, struct statfs *buf); } - SYS_UNMOUNT = 159 // { int unmount(user_addr_t path, int flags); } - // SYS_NOSYS = 160; // { int nosys(void); } { old async_daemon } - SYS_GETFH = 161 // { int getfh(char *fname, fhandle_t *fhp); } - // SYS_NOSYS = 161; // { int nosys(void); } - // SYS_NOSYS = 162; // { int nosys(void); } { old getdomainname } - // SYS_NOSYS = 163; // { int nosys(void); } { old setdomainname } - // SYS_NOSYS = 164; // { int nosys(void); } - SYS_QUOTACTL = 165 // { int quotactl(const char *path, int cmd, int uid, caddr_t arg); } - // SYS_NOSYS = 166; // { int nosys(void); } { old exportfs } - SYS_MOUNT = 167 // { int mount(char *type, char *path, int flags, caddr_t data); } - // SYS_NOSYS = 168; // { int nosys(void); } { old ustat } - SYS_CSOPS = 169 // { int csops(pid_t pid, uint32_t ops, user_addr_t useraddr, user_size_t usersize); } - // SYS_NOSYS = 171; // { int nosys(void); } { old wait3 } - // SYS_NOSYS = 172; // { int nosys(void); } { old rpause } - SYS_WAITID = 173 // { int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options); } - // SYS_NOSYS = 174; // { int nosys(void); } { old getdents } - // SYS_NOSYS = 175; // { int nosys(void); } { old gc_control } - SYS_ADD_PROFIL = 176 // { int add_profil(short *bufbase, size_t bufsize, u_long pcoffset, u_int pcscale); } - // SYS_NOSYS = 177; // { int nosys(void); } - // SYS_NOSYS = 178; // { int nosys(void); } - // SYS_NOSYS = 179; // { int nosys(void); } - SYS_KDEBUG_TRACE = 180 // { int kdebug_trace(int code, int arg1, int arg2, int arg3, int arg4, int arg5) NO_SYSCALL_STUB; } - SYS_SETGID = 181 // { int setgid(gid_t gid); } - SYS_SETEGID = 182 // { int setegid(gid_t egid); } - SYS_SETEUID = 183 // { int seteuid(uid_t euid); } - SYS_SIGRETURN = 184 // { int sigreturn(struct ucontext *uctx, int infostyle); } - // SYS_NOSYS = 186; // { int nosys(void); } - // SYS_NOSYS = 187; // { int nosys(void); } - SYS_STAT = 188 // { int stat(user_addr_t path, user_addr_t ub); } - SYS_FSTAT = 189 // { int fstat(int fd, user_addr_t ub); } - SYS_LSTAT = 190 // { int lstat(user_addr_t path, user_addr_t ub); } - SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } - SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } - // SYS_NOSYS = 193; // { int nosys(void); } - SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } - SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } - SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); } - SYS_MMAP = 197 // { user_addr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos); } - // SYS_NOSYS = 198; // { int nosys(void); } { __syscall } - SYS_LSEEK = 199 // { off_t lseek(int fd, off_t offset, int whence); } - SYS_TRUNCATE = 200 // { int truncate(char *path, off_t length); } - SYS_FTRUNCATE = 201 // { int ftruncate(int fd, off_t length); } - SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } - SYS_MLOCK = 203 // { int mlock(caddr_t addr, size_t len); } - SYS_MUNLOCK = 204 // { int munlock(caddr_t addr, size_t len); } - SYS_UNDELETE = 205 // { int undelete(user_addr_t path); } - SYS_ATSOCKET = 206 // { int ATsocket(int proto); } - // SYS_NOSYS = 213; // { int nosys(void); } { Reserved for AppleTalk } - // SYS_NOSYS = 206; // { int nosys(void); } - // SYS_NOSYS = 207; // { int nosys(void); } - // SYS_NOSYS = 208; // { int nosys(void); } - // SYS_NOSYS = 209; // { int nosys(void); } - // SYS_NOSYS = 210; // { int nosys(void); } - // SYS_NOSYS = 211; // { int nosys(void); } - // SYS_NOSYS = 212; // { int nosys(void); } - // SYS_NOSYS = 213; // { int nosys(void); } { Reserved for AppleTalk } - SYS_KQUEUE_FROM_PORTSET_NP = 214 // { int kqueue_from_portset_np(int portset); } - SYS_KQUEUE_PORTSET_NP = 215 // { int kqueue_portset_np(int fd); } - SYS_GETATTRLIST = 220 // { int getattrlist(const char *path, struct attrlist *alist, void *attributeBuffer, size_t bufferSize, u_long options); } - SYS_SETATTRLIST = 221 // { int setattrlist(const char *path, struct attrlist *alist, void *attributeBuffer, size_t bufferSize, u_long options); } - SYS_GETDIRENTRIESATTR = 222 // { int getdirentriesattr(int fd, struct attrlist *alist, void *buffer, size_t buffersize, u_long *count, u_long *basep, u_long *newstate, u_long options); } - SYS_EXCHANGEDATA = 223 // { int exchangedata(const char *path1, const char *path2, u_long options); } - // SYS_NOSYS = 224; // { int nosys(void); } { was checkuseraccess } - SYS_SEARCHFS = 225 // { int searchfs(const char *path, struct fssearchblock *searchblock, u_long *nummatches, u_long scriptcode, u_long options, struct searchstate *state); } - SYS_DELETE = 226 // { int delete(user_addr_t path) NO_SYSCALL_STUB; } { private delete (Carbon semantics) } - SYS_COPYFILE = 227 // { int copyfile(char *from, char *to, int mode, int flags) NO_SYSCALL_STUB; } - // SYS_NOSYS = 228; // { int nosys(void); } - // SYS_NOSYS = 229; // { int nosys(void); } - SYS_POLL = 230 // { int poll(struct pollfd *fds, u_int nfds, int timeout); } - SYS_WATCHEVENT = 231 // { int watchevent(struct eventreq *u_req, int u_eventmask); } - SYS_WAITEVENT = 232 // { int waitevent(struct eventreq *u_req, struct timeval *tv); } - SYS_MODWATCH = 233 // { int modwatch(struct eventreq *u_req, int u_eventmask); } - SYS_GETXATTR = 234 // { user_ssize_t getxattr(user_addr_t path, user_addr_t attrname, user_addr_t value, size_t size, uint32_t position, int options); } - SYS_FGETXATTR = 235 // { user_ssize_t fgetxattr(int fd, user_addr_t attrname, user_addr_t value, size_t size, uint32_t position, int options); } - SYS_SETXATTR = 236 // { int setxattr(user_addr_t path, user_addr_t attrname, user_addr_t value, size_t size, uint32_t position, int options); } - SYS_FSETXATTR = 237 // { int fsetxattr(int fd, user_addr_t attrname, user_addr_t value, size_t size, uint32_t position, int options); } - SYS_REMOVEXATTR = 238 // { int removexattr(user_addr_t path, user_addr_t attrname, int options); } - SYS_FREMOVEXATTR = 239 // { int fremovexattr(int fd, user_addr_t attrname, int options); } - SYS_LISTXATTR = 240 // { user_ssize_t listxattr(user_addr_t path, user_addr_t namebuf, size_t bufsize, int options); } - SYS_FLISTXATTR = 241 // { user_ssize_t flistxattr(int fd, user_addr_t namebuf, size_t bufsize, int options); } - SYS_FSCTL = 242 // { int fsctl(const char *path, u_long cmd, caddr_t data, u_long options); } - SYS_INITGROUPS = 243 // { int initgroups(u_int gidsetsize, gid_t *gidset, int gmuid); } - SYS_POSIX_SPAWN = 244 // { int posix_spawn(pid_t *pid, const char *path, const struct _posix_spawn_args_desc *adesc, char **argv, char **envp); } - // SYS_NOSYS = 245; // { int nosys(void); } - // SYS_NOSYS = 246; // { int nosys(void); } - SYS_NFSCLNT = 247 // { int nfsclnt(int flag, caddr_t argp); } - // SYS_NOSYS = 247; // { int nosys(void); } - SYS_FHOPEN = 248 // { int fhopen(const struct fhandle *u_fhp, int flags); } - // SYS_NOSYS = 248; // { int nosys(void); } - // SYS_NOSYS = 249; // { int nosys(void); } - SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } - SYS_SEMSYS = 251 // { int semsys(u_int which, int a2, int a3, int a4, int a5); } - // SYS_NOSYS = 251; // { int nosys(void); } - SYS_MSGSYS = 252 // { int msgsys(u_int which, int a2, int a3, int a4, int a5); } - // SYS_NOSYS = 252; // { int nosys(void); } - SYS_SHMSYS = 253 // { int shmsys(u_int which, int a2, int a3, int a4); } - // SYS_NOSYS = 253; // { int nosys(void); } - SYS_SEMCTL = 254 // { int semctl(int semid, int semnum, int cmd, semun_t arg); } - SYS_SEMGET = 255 // { int semget(key_t key, int nsems, int semflg); } - SYS_SEMOP = 256 // { int semop(int semid, struct sembuf *sops, int nsops); } - // SYS_NOSYS = 257; // { int nosys(void); } - // SYS_NOSYS = 254; // { int nosys(void); } - // SYS_NOSYS = 255; // { int nosys(void); } - // SYS_NOSYS = 256; // { int nosys(void); } - // SYS_NOSYS = 257; // { int nosys(void); } - SYS_MSGCTL = 258 // { int msgctl(int msqid, int cmd, struct msqid_ds *buf); } - SYS_MSGGET = 259 // { int msgget(key_t key, int msgflg); } - SYS_MSGSND = 260 // { int msgsnd(int msqid, void *msgp, size_t msgsz, int msgflg); } - SYS_MSGRCV = 261 // { user_ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } - // SYS_NOSYS = 258; // { int nosys(void); } - // SYS_NOSYS = 259; // { int nosys(void); } - // SYS_NOSYS = 260; // { int nosys(void); } - // SYS_NOSYS = 261; // { int nosys(void); } - SYS_SHMAT = 262 // { user_addr_t shmat(int shmid, void *shmaddr, int shmflg); } - SYS_SHMCTL = 263 // { int shmctl(int shmid, int cmd, struct shmid_ds *buf); } - SYS_SHMDT = 264 // { int shmdt(void *shmaddr); } - SYS_SHMGET = 265 // { int shmget(key_t key, size_t size, int shmflg); } - // SYS_NOSYS = 262; // { int nosys(void); } - // SYS_NOSYS = 263; // { int nosys(void); } - // SYS_NOSYS = 264; // { int nosys(void); } - // SYS_NOSYS = 265; // { int nosys(void); } - SYS_SHM_OPEN = 266 // { int shm_open(const char *name, int oflag, int mode); } - SYS_SHM_UNLINK = 267 // { int shm_unlink(const char *name); } - SYS_SEM_OPEN = 268 // { user_addr_t sem_open(const char *name, int oflag, int mode, int value); } - SYS_SEM_CLOSE = 269 // { int sem_close(sem_t *sem); } - SYS_SEM_UNLINK = 270 // { int sem_unlink(const char *name); } - SYS_SEM_WAIT = 271 // { int sem_wait(sem_t *sem); } - SYS_SEM_TRYWAIT = 272 // { int sem_trywait(sem_t *sem); } - SYS_SEM_POST = 273 // { int sem_post(sem_t *sem); } - SYS_SEM_GETVALUE = 274 // { int sem_getvalue(sem_t *sem, int *sval); } - SYS_SEM_INIT = 275 // { int sem_init(sem_t *sem, int phsared, u_int value); } - SYS_SEM_DESTROY = 276 // { int sem_destroy(sem_t *sem); } - SYS_OPEN_EXTENDED = 277 // { int open_extended(user_addr_t path, int flags, uid_t uid, gid_t gid, int mode, user_addr_t xsecurity) NO_SYSCALL_STUB; } - SYS_UMASK_EXTENDED = 278 // { int umask_extended(int newmask, user_addr_t xsecurity) NO_SYSCALL_STUB; } - SYS_STAT_EXTENDED = 279 // { int stat_extended(user_addr_t path, user_addr_t ub, user_addr_t xsecurity, user_addr_t xsecurity_size) NO_SYSCALL_STUB; } - SYS_LSTAT_EXTENDED = 280 // { int lstat_extended(user_addr_t path, user_addr_t ub, user_addr_t xsecurity, user_addr_t xsecurity_size) NO_SYSCALL_STUB; } - SYS_FSTAT_EXTENDED = 281 // { int fstat_extended(int fd, user_addr_t ub, user_addr_t xsecurity, user_addr_t xsecurity_size) NO_SYSCALL_STUB; } - SYS_CHMOD_EXTENDED = 282 // { int chmod_extended(user_addr_t path, uid_t uid, gid_t gid, int mode, user_addr_t xsecurity) NO_SYSCALL_STUB; } - SYS_FCHMOD_EXTENDED = 283 // { int fchmod_extended(int fd, uid_t uid, gid_t gid, int mode, user_addr_t xsecurity) NO_SYSCALL_STUB; } - SYS_ACCESS_EXTENDED = 284 // { int access_extended(user_addr_t entries, size_t size, user_addr_t results, uid_t uid) NO_SYSCALL_STUB; } - SYS_SETTID = 285 // { int settid(uid_t uid, gid_t gid) NO_SYSCALL_STUB; } - SYS_GETTID = 286 // { int gettid(uid_t *uidp, gid_t *gidp) NO_SYSCALL_STUB; } - SYS_SETSGROUPS = 287 // { int setsgroups(int setlen, user_addr_t guidset) NO_SYSCALL_STUB; } - SYS_GETSGROUPS = 288 // { int getsgroups(user_addr_t setlen, user_addr_t guidset) NO_SYSCALL_STUB; } - SYS_SETWGROUPS = 289 // { int setwgroups(int setlen, user_addr_t guidset) NO_SYSCALL_STUB; } - SYS_GETWGROUPS = 290 // { int getwgroups(user_addr_t setlen, user_addr_t guidset) NO_SYSCALL_STUB; } - SYS_MKFIFO_EXTENDED = 291 // { int mkfifo_extended(user_addr_t path, uid_t uid, gid_t gid, int mode, user_addr_t xsecurity) NO_SYSCALL_STUB; } - SYS_MKDIR_EXTENDED = 292 // { int mkdir_extended(user_addr_t path, uid_t uid, gid_t gid, int mode, user_addr_t xsecurity) NO_SYSCALL_STUB; } - SYS_IDENTITYSVC = 293 // { int identitysvc(int opcode, user_addr_t message) NO_SYSCALL_STUB; } - SYS_SHARED_REGION_CHECK_NP = 294 // { int shared_region_check_np(uint64_t *start_address) NO_SYSCALL_STUB; } - SYS_SHARED_REGION_MAP_NP = 295 // { int shared_region_map_np(int fd, uint32_t count, const struct shared_file_mapping_np *mappings) NO_SYSCALL_STUB; } - // SYS_NOSYS = 296; // { int nosys(void); } { old load_shared_file } - // SYS_NOSYS = 297; // { int nosys(void); } { old reset_shared_file } - // SYS_NOSYS = 298; // { int nosys(void); } { old new_system_shared_regions } - // SYS_ENOSYS = 299; // { int enosys(void); } { old shared_region_map_file_np } - // SYS_ENOSYS = 300; // { int enosys(void); } { old shared_region_make_private_np } - SYS___PTHREAD_MUTEX_DESTROY = 301 // { int __pthread_mutex_destroy(int mutexid); } - SYS___PTHREAD_MUTEX_INIT = 302 // { int __pthread_mutex_init(user_addr_t mutex, user_addr_t attr); } - SYS___PTHREAD_MUTEX_LOCK = 303 // { int __pthread_mutex_lock(int mutexid); } - SYS___PTHREAD_MUTEX_TRYLOCK = 304 // { int __pthread_mutex_trylock(int mutexid); } - SYS___PTHREAD_MUTEX_UNLOCK = 305 // { int __pthread_mutex_unlock(int mutexid); } - SYS___PTHREAD_COND_INIT = 306 // { int __pthread_cond_init(user_addr_t cond, user_addr_t attr); } - SYS___PTHREAD_COND_DESTROY = 307 // { int __pthread_cond_destroy(int condid); } - SYS___PTHREAD_COND_BROADCAST = 308 // { int __pthread_cond_broadcast(int condid); } - SYS___PTHREAD_COND_SIGNAL = 309 // { int __pthread_cond_signal(int condid); } - SYS_GETSID = 310 // { int getsid(pid_t pid); } - SYS_SETTID_WITH_PID = 311 // { int settid_with_pid(pid_t pid, int assume) NO_SYSCALL_STUB; } - SYS___PTHREAD_COND_TIMEDWAIT = 312 // { int __pthread_cond_timedwait(int condid, int mutexid, user_addr_t abstime); } - SYS_AIO_FSYNC = 313 // { int aio_fsync(int op, user_addr_t aiocbp); } - SYS_AIO_RETURN = 314 // { user_ssize_t aio_return(user_addr_t aiocbp); } - SYS_AIO_SUSPEND = 315 // { int aio_suspend(user_addr_t aiocblist, int nent, user_addr_t timeoutp); } - SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, user_addr_t aiocbp); } - SYS_AIO_ERROR = 317 // { int aio_error(user_addr_t aiocbp); } - SYS_AIO_READ = 318 // { int aio_read(user_addr_t aiocbp); } - SYS_AIO_WRITE = 319 // { int aio_write(user_addr_t aiocbp); } - SYS_LIO_LISTIO = 320 // { int lio_listio(int mode, user_addr_t aiocblist, int nent, user_addr_t sigp); } - SYS___PTHREAD_COND_WAIT = 321 // { int __pthread_cond_wait(int condid, int mutexid); } - SYS_IOPOLICYSYS = 322 // { int iopolicysys(int cmd, void *arg) NO_SYSCALL_STUB; } - // SYS_NOSYS = 323; // { int nosys(void); } - SYS_MLOCKALL = 324 // { int mlockall(int how); } - SYS_MUNLOCKALL = 325 // { int munlockall(int how); } - // SYS_NOSYS = 326; // { int nosys(void); } - SYS_ISSETUGID = 327 // { int issetugid(void); } - SYS___PTHREAD_KILL = 328 // { int __pthread_kill(int thread_port, int sig); } - SYS___PTHREAD_SIGMASK = 329 // { int __pthread_sigmask(int how, user_addr_t set, user_addr_t oset); } - SYS___SIGWAIT = 330 // { int __sigwait(user_addr_t set, user_addr_t sig); } - SYS___DISABLE_THREADSIGNAL = 331 // { int __disable_threadsignal(int value); } - SYS___PTHREAD_MARKCANCEL = 332 // { int __pthread_markcancel(int thread_port); } - SYS___PTHREAD_CANCELED = 333 // { int __pthread_canceled(int action); } - SYS___SEMWAIT_SIGNAL = 334 // { int __semwait_signal(int cond_sem, int mutex_sem, int timeout, int relative, time_t tv_sec, int32_t tv_nsec); } - // SYS_NOSYS = 335; // { int nosys(void); } { old utrace } - SYS_PROC_INFO = 336 // { int proc_info(int32_t callnum,int32_t pid,uint32_t flavor, uint64_t arg,user_addr_t buffer,int32_t buffersize) NO_SYSCALL_STUB; } - SYS_SENDFILE = 337 // { int sendfile(int fd, int s, off_t offset, off_t *nbytes, struct sf_hdtr *hdtr, int flags); } - // SYS_NOSYS = 337; // { int nosys(void); } - SYS_STAT64 = 338 // { int stat64(user_addr_t path, user_addr_t ub); } - SYS_FSTAT64 = 339 // { int fstat64(int fd, user_addr_t ub); } - SYS_LSTAT64 = 340 // { int lstat64(user_addr_t path, user_addr_t ub); } - SYS_STAT64_EXTENDED = 341 // { int stat64_extended(user_addr_t path, user_addr_t ub, user_addr_t xsecurity, user_addr_t xsecurity_size) NO_SYSCALL_STUB; } - SYS_LSTAT64_EXTENDED = 342 // { int lstat64_extended(user_addr_t path, user_addr_t ub, user_addr_t xsecurity, user_addr_t xsecurity_size) NO_SYSCALL_STUB; } - SYS_FSTAT64_EXTENDED = 343 // { int fstat64_extended(int fd, user_addr_t ub, user_addr_t xsecurity, user_addr_t xsecurity_size) NO_SYSCALL_STUB; } - SYS_GETDIRENTRIES64 = 344 // { user_ssize_t getdirentries64(int fd, void *buf, user_size_t bufsize, off_t *position) NO_SYSCALL_STUB; } - SYS_STATFS64 = 345 // { int statfs64(char *path, struct statfs64 *buf); } - SYS_FSTATFS64 = 346 // { int fstatfs64(int fd, struct statfs64 *buf); } - SYS_GETFSSTAT64 = 347 // { int getfsstat64(user_addr_t buf, int bufsize, int flags); } - SYS___PTHREAD_CHDIR = 348 // { int __pthread_chdir(user_addr_t path); } - SYS___PTHREAD_FCHDIR = 349 // { int __pthread_fchdir(int fd); } - SYS_AUDIT = 350 // { int audit(void *record, int length); } - SYS_AUDITON = 351 // { int auditon(int cmd, void *data, int length); } - // SYS_NOSYS = 352; // { int nosys(void); } - SYS_GETAUID = 353 // { int getauid(au_id_t *auid); } - SYS_SETAUID = 354 // { int setauid(au_id_t *auid); } - SYS_GETAUDIT = 355 // { int getaudit(struct auditinfo *auditinfo); } - SYS_SETAUDIT = 356 // { int setaudit(struct auditinfo *auditinfo); } - SYS_GETAUDIT_ADDR = 357 // { int getaudit_addr(struct auditinfo_addr *auditinfo_addr, int length); } - SYS_SETAUDIT_ADDR = 358 // { int setaudit_addr(struct auditinfo_addr *auditinfo_addr, int length); } - SYS_AUDITCTL = 359 // { int auditctl(char *path); } - // SYS_NOSYS = 350; // { int nosys(void); } - // SYS_NOSYS = 351; // { int nosys(void); } - // SYS_NOSYS = 352; // { int nosys(void); } - // SYS_NOSYS = 353; // { int nosys(void); } - // SYS_NOSYS = 354; // { int nosys(void); } - // SYS_NOSYS = 355; // { int nosys(void); } - // SYS_NOSYS = 356; // { int nosys(void); } - // SYS_NOSYS = 357; // { int nosys(void); } - // SYS_NOSYS = 358; // { int nosys(void); } - // SYS_NOSYS = 359; // { int nosys(void); } - SYS_BSDTHREAD_CREATE = 360 // { user_addr_t bsdthread_create(user_addr_t func, user_addr_t func_arg, user_addr_t stack, user_addr_t pthread, uint32_t flags) NO_SYSCALL_STUB; } - SYS_BSDTHREAD_TERMINATE = 361 // { int bsdthread_terminate(user_addr_t stackaddr, size_t freesize, uint32_t port, uint32_t sem) NO_SYSCALL_STUB; } - SYS_KQUEUE = 362 // { int kqueue(void); } - SYS_KEVENT = 363 // { int kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } - SYS_LCHOWN = 364 // { int lchown(user_addr_t path, uid_t owner, gid_t group); } - SYS_STACK_SNAPSHOT = 365 // { int stack_snapshot(pid_t pid, user_addr_t tracebuf, uint32_t tracebuf_size, uint32_t options) NO_SYSCALL_STUB; } - SYS_BSDTHREAD_REGISTER = 366 // { int bsdthread_register(user_addr_t threadstart, user_addr_t wqthread, int pthsize) NO_SYSCALL_STUB; } - SYS_WORKQ_OPEN = 367 // { int workq_open(void) NO_SYSCALL_STUB; } - SYS_WORKQ_OPS = 368 // { int workq_ops(int options, user_addr_t item, int prio) NO_SYSCALL_STUB; } - // SYS_NOSYS = 369; // { int nosys(void); } - // SYS_NOSYS = 370; // { int nosys(void); } - // SYS_NOSYS = 371; // { int nosys(void); } - // SYS_NOSYS = 372; // { int nosys(void); } - // SYS_NOSYS = 373; // { int nosys(void); } - // SYS_NOSYS = 374; // { int nosys(void); } - // SYS_NOSYS = 375; // { int nosys(void); } - // SYS_NOSYS = 376; // { int nosys(void); } - // SYS_NOSYS = 377; // { int nosys(void); } - // SYS_NOSYS = 378; // { int nosys(void); } - // SYS_NOSYS = 379; // { int nosys(void); } - SYS___MAC_EXECVE = 380 // { int __mac_execve(char *fname, char **argp, char **envp, struct mac *mac_p); } - SYS___MAC_SYSCALL = 381 // { int __mac_syscall(char *policy, int call, user_addr_t arg); } - SYS___MAC_GET_FILE = 382 // { int __mac_get_file(char *path_p, struct mac *mac_p); } - SYS___MAC_SET_FILE = 383 // { int __mac_set_file(char *path_p, struct mac *mac_p); } - SYS___MAC_GET_LINK = 384 // { int __mac_get_link(char *path_p, struct mac *mac_p); } - SYS___MAC_SET_LINK = 385 // { int __mac_set_link(char *path_p, struct mac *mac_p); } - SYS___MAC_GET_PROC = 386 // { int __mac_get_proc(struct mac *mac_p); } - SYS___MAC_SET_PROC = 387 // { int __mac_set_proc(struct mac *mac_p); } - SYS___MAC_GET_FD = 388 // { int __mac_get_fd(int fd, struct mac *mac_p); } - SYS___MAC_SET_FD = 389 // { int __mac_set_fd(int fd, struct mac *mac_p); } - SYS___MAC_GET_PID = 390 // { int __mac_get_pid(pid_t pid, struct mac *mac_p); } - SYS___MAC_GET_LCID = 391 // { int __mac_get_lcid(pid_t lcid, struct mac *mac_p); } - SYS___MAC_GET_LCTX = 392 // { int __mac_get_lctx(struct mac *mac_p); } - SYS___MAC_SET_LCTX = 393 // { int __mac_set_lctx(struct mac *mac_p); } - SYS_SETLCID = 394 // { int setlcid(pid_t pid, pid_t lcid) NO_SYSCALL_STUB; } - SYS_GETLCID = 395 // { int getlcid(pid_t pid) NO_SYSCALL_STUB; } - SYS_READ_NOCANCEL = 396 // { user_ssize_t read_nocancel(int fd, user_addr_t cbuf, user_size_t nbyte) NO_SYSCALL_STUB; } - SYS_WRITE_NOCANCEL = 397 // { user_ssize_t write_nocancel(int fd, user_addr_t cbuf, user_size_t nbyte) NO_SYSCALL_STUB; } - SYS_OPEN_NOCANCEL = 398 // { int open_nocancel(user_addr_t path, int flags, int mode) NO_SYSCALL_STUB; } - SYS_CLOSE_NOCANCEL = 399 // { int close_nocancel(int fd) NO_SYSCALL_STUB; } - SYS_WAIT4_NOCANCEL = 400 // { int wait4_nocancel(int pid, user_addr_t status, int options, user_addr_t rusage) NO_SYSCALL_STUB; } - SYS_RECVMSG_NOCANCEL = 401 // { int recvmsg_nocancel(int s, struct msghdr *msg, int flags) NO_SYSCALL_STUB; } - SYS_SENDMSG_NOCANCEL = 402 // { int sendmsg_nocancel(int s, caddr_t msg, int flags) NO_SYSCALL_STUB; } - SYS_RECVFROM_NOCANCEL = 403 // { int recvfrom_nocancel(int s, void *buf, size_t len, int flags, struct sockaddr *from, int *fromlenaddr) NO_SYSCALL_STUB; } - SYS_ACCEPT_NOCANCEL = 404 // { int accept_nocancel(int s, caddr_t name, socklen_t *anamelen) NO_SYSCALL_STUB; } - // SYS_NOSYS = 401; // { int nosys(void); } - // SYS_NOSYS = 402; // { int nosys(void); } - // SYS_NOSYS = 403; // { int nosys(void); } - // SYS_NOSYS = 404; // { int nosys(void); } - SYS_MSYNC_NOCANCEL = 405 // { int msync_nocancel(caddr_t addr, size_t len, int flags) NO_SYSCALL_STUB; } - SYS_FCNTL_NOCANCEL = 406 // { int fcntl_nocancel(int fd, int cmd, long arg) NO_SYSCALL_STUB; } - SYS_SELECT_NOCANCEL = 407 // { int select_nocancel(int nd, u_int32_t *in, u_int32_t *ou, u_int32_t *ex, struct timeval *tv) NO_SYSCALL_STUB; } - SYS_FSYNC_NOCANCEL = 408 // { int fsync_nocancel(int fd) NO_SYSCALL_STUB; } - SYS_CONNECT_NOCANCEL = 409 // { int connect_nocancel(int s, caddr_t name, socklen_t namelen) NO_SYSCALL_STUB; } - // SYS_NOSYS = 409; // { int nosys(void); } - SYS_SIGSUSPEND_NOCANCEL = 410 // { int sigsuspend_nocancel(sigset_t mask) NO_SYSCALL_STUB; } - SYS_READV_NOCANCEL = 411 // { user_ssize_t readv_nocancel(int fd, struct iovec *iovp, u_int iovcnt) NO_SYSCALL_STUB; } - SYS_WRITEV_NOCANCEL = 412 // { user_ssize_t writev_nocancel(int fd, struct iovec *iovp, u_int iovcnt) NO_SYSCALL_STUB; } - SYS_SENDTO_NOCANCEL = 413 // { int sendto_nocancel(int s, caddr_t buf, size_t len, int flags, caddr_t to, socklen_t tolen) NO_SYSCALL_STUB; } - // SYS_NOSYS = 413; // { int nosys(void); } - SYS_PREAD_NOCANCEL = 414 // { user_ssize_t pread_nocancel(int fd, user_addr_t buf, user_size_t nbyte, off_t offset) NO_SYSCALL_STUB; } - SYS_PWRITE_NOCANCEL = 415 // { user_ssize_t pwrite_nocancel(int fd, user_addr_t buf, user_size_t nbyte, off_t offset) NO_SYSCALL_STUB; } - SYS_WAITID_NOCANCEL = 416 // { int waitid_nocancel(idtype_t idtype, id_t id, siginfo_t *infop, int options) NO_SYSCALL_STUB; } - SYS_POLL_NOCANCEL = 417 // { int poll_nocancel(struct pollfd *fds, u_int nfds, int timeout) NO_SYSCALL_STUB; } - SYS_MSGSND_NOCANCEL = 418 // { int msgsnd_nocancel(int msqid, void *msgp, size_t msgsz, int msgflg) NO_SYSCALL_STUB; } - SYS_MSGRCV_NOCANCEL = 419 // { user_ssize_t msgrcv_nocancel(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg) NO_SYSCALL_STUB; } - // SYS_NOSYS = 418; // { int nosys(void); } - // SYS_NOSYS = 419; // { int nosys(void); } - SYS_SEM_WAIT_NOCANCEL = 420 // { int sem_wait_nocancel(sem_t *sem) NO_SYSCALL_STUB; } - SYS_AIO_SUSPEND_NOCANCEL = 421 // { int aio_suspend_nocancel(user_addr_t aiocblist, int nent, user_addr_t timeoutp) NO_SYSCALL_STUB; } - SYS___SIGWAIT_NOCANCEL = 422 // { int __sigwait_nocancel(user_addr_t set, user_addr_t sig) NO_SYSCALL_STUB; } - SYS___SEMWAIT_SIGNAL_NOCANCEL = 423 // { int __semwait_signal_nocancel(int cond_sem, int mutex_sem, int timeout, int relative, time_t tv_sec, int32_t tv_nsec) NO_SYSCALL_STUB; } - SYS___MAC_MOUNT = 424 // { int __mac_mount(char *type, char *path, int flags, caddr_t data, struct mac *mac_p); } - SYS___MAC_GET_MOUNT = 425 // { int __mac_get_mount(char *path, struct mac *mac_p); } - SYS___MAC_GETFSSTAT = 426 // { int __mac_getfsstat(user_addr_t buf, int bufsize, user_addr_t mac, int macsize, int flags); } + SYS_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_WAIT4 = 7 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_CHDIR = 12 + SYS_FCHDIR = 13 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_CHOWN = 16 + SYS_GETFSSTAT = 18 + SYS_GETPID = 20 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_GETEUID = 25 + SYS_PTRACE = 26 + SYS_RECVMSG = 27 + SYS_SENDMSG = 28 + SYS_RECVFROM = 29 + SYS_ACCEPT = 30 + SYS_GETPEERNAME = 31 + SYS_GETSOCKNAME = 32 + SYS_ACCESS = 33 + SYS_CHFLAGS = 34 + SYS_FCHFLAGS = 35 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_GETPPID = 39 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_GETEGID = 43 + SYS_PROFIL = 44 + SYS_SIGACTION = 46 + SYS_GETGID = 47 + SYS_SIGPROCMASK = 48 + SYS_GETLOGIN = 49 + SYS_SETLOGIN = 50 + SYS_ACCT = 51 + SYS_SIGPENDING = 52 + SYS_SIGALTSTACK = 53 + SYS_IOCTL = 54 + SYS_REBOOT = 55 + SYS_REVOKE = 56 + SYS_SYMLINK = 57 + SYS_READLINK = 58 + SYS_EXECVE = 59 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_MSYNC = 65 + SYS_VFORK = 66 + SYS_MUNMAP = 73 + SYS_MPROTECT = 74 + SYS_MADVISE = 75 + SYS_MINCORE = 78 + SYS_GETGROUPS = 79 + SYS_SETGROUPS = 80 + SYS_GETPGRP = 81 + SYS_SETPGID = 82 + SYS_SETITIMER = 83 + SYS_SWAPON = 85 + SYS_GETITIMER = 86 + SYS_GETDTABLESIZE = 89 + SYS_DUP2 = 90 + SYS_FCNTL = 92 + SYS_SELECT = 93 + SYS_FSYNC = 95 + SYS_SETPRIORITY = 96 + SYS_SOCKET = 97 + SYS_CONNECT = 98 + SYS_GETPRIORITY = 100 + SYS_BIND = 104 + SYS_SETSOCKOPT = 105 + SYS_LISTEN = 106 + SYS_SIGSUSPEND = 111 + SYS_GETTIMEOFDAY = 116 + SYS_GETRUSAGE = 117 + SYS_GETSOCKOPT = 118 + SYS_READV = 120 + SYS_WRITEV = 121 + SYS_SETTIMEOFDAY = 122 + SYS_FCHOWN = 123 + SYS_FCHMOD = 124 + SYS_SETREUID = 126 + SYS_SETREGID = 127 + SYS_RENAME = 128 + SYS_FLOCK = 131 + SYS_MKFIFO = 132 + SYS_SENDTO = 133 + SYS_SHUTDOWN = 134 + SYS_SOCKETPAIR = 135 + SYS_MKDIR = 136 + SYS_RMDIR = 137 + SYS_UTIMES = 138 + SYS_FUTIMES = 139 + SYS_ADJTIME = 140 + SYS_GETHOSTUUID = 142 + SYS_SETSID = 147 + SYS_GETPGID = 151 + SYS_SETPRIVEXEC = 152 + SYS_PREAD = 153 + SYS_PWRITE = 154 + SYS_NFSSVC = 155 + SYS_STATFS = 157 + SYS_FSTATFS = 158 + SYS_UNMOUNT = 159 + SYS_GETFH = 161 + SYS_QUOTACTL = 165 + SYS_MOUNT = 167 + SYS_CSOPS = 169 + SYS_WAITID = 173 + SYS_ADD_PROFIL = 176 + SYS_KDEBUG_TRACE = 180 + SYS_SETGID = 181 + SYS_SETEGID = 182 + SYS_SETEUID = 183 + SYS_SIGRETURN = 184 + SYS_CHUD = 185 + SYS_FDATASYNC = 187 + SYS_STAT = 188 + SYS_FSTAT = 189 + SYS_LSTAT = 190 + SYS_PATHCONF = 191 + SYS_FPATHCONF = 192 + SYS_GETRLIMIT = 194 + SYS_SETRLIMIT = 195 + SYS_GETDIRENTRIES = 196 + SYS_MMAP = 197 + SYS_LSEEK = 199 + SYS_TRUNCATE = 200 + SYS_FTRUNCATE = 201 + SYS___SYSCTL = 202 + SYS_MLOCK = 203 + SYS_MUNLOCK = 204 + SYS_UNDELETE = 205 + SYS_ATSOCKET = 206 + SYS_ATGETMSG = 207 + SYS_ATPUTMSG = 208 + SYS_ATPSNDREQ = 209 + SYS_ATPSNDRSP = 210 + SYS_ATPGETREQ = 211 + SYS_ATPGETRSP = 212 + SYS_MKCOMPLEX = 216 + SYS_STATV = 217 + SYS_LSTATV = 218 + SYS_FSTATV = 219 + SYS_GETATTRLIST = 220 + SYS_SETATTRLIST = 221 + SYS_GETDIRENTRIESATTR = 222 + SYS_EXCHANGEDATA = 223 + SYS_SEARCHFS = 225 + SYS_DELETE = 226 + SYS_COPYFILE = 227 + SYS_FGETATTRLIST = 228 + SYS_FSETATTRLIST = 229 + SYS_POLL = 230 + SYS_WATCHEVENT = 231 + SYS_WAITEVENT = 232 + SYS_MODWATCH = 233 + SYS_GETXATTR = 234 + SYS_FGETXATTR = 235 + SYS_SETXATTR = 236 + SYS_FSETXATTR = 237 + SYS_REMOVEXATTR = 238 + SYS_FREMOVEXATTR = 239 + SYS_LISTXATTR = 240 + SYS_FLISTXATTR = 241 + SYS_FSCTL = 242 + SYS_INITGROUPS = 243 + SYS_POSIX_SPAWN = 244 + SYS_FFSCTL = 245 + SYS_NFSCLNT = 247 + SYS_FHOPEN = 248 + SYS_MINHERIT = 250 + SYS_SEMSYS = 251 + SYS_MSGSYS = 252 + SYS_SHMSYS = 253 + SYS_SEMCTL = 254 + SYS_SEMGET = 255 + SYS_SEMOP = 256 + SYS_MSGCTL = 258 + SYS_MSGGET = 259 + SYS_MSGSND = 260 + SYS_MSGRCV = 261 + SYS_SHMAT = 262 + SYS_SHMCTL = 263 + SYS_SHMDT = 264 + SYS_SHMGET = 265 + SYS_SHM_OPEN = 266 + SYS_SHM_UNLINK = 267 + SYS_SEM_OPEN = 268 + SYS_SEM_CLOSE = 269 + SYS_SEM_UNLINK = 270 + SYS_SEM_WAIT = 271 + SYS_SEM_TRYWAIT = 272 + SYS_SEM_POST = 273 + SYS_SEM_GETVALUE = 274 + SYS_SEM_INIT = 275 + SYS_SEM_DESTROY = 276 + SYS_OPEN_EXTENDED = 277 + SYS_UMASK_EXTENDED = 278 + SYS_STAT_EXTENDED = 279 + SYS_LSTAT_EXTENDED = 280 + SYS_FSTAT_EXTENDED = 281 + SYS_CHMOD_EXTENDED = 282 + SYS_FCHMOD_EXTENDED = 283 + SYS_ACCESS_EXTENDED = 284 + SYS_SETTID = 285 + SYS_GETTID = 286 + SYS_SETSGROUPS = 287 + SYS_GETSGROUPS = 288 + SYS_SETWGROUPS = 289 + SYS_GETWGROUPS = 290 + SYS_MKFIFO_EXTENDED = 291 + SYS_MKDIR_EXTENDED = 292 + SYS_IDENTITYSVC = 293 + SYS_SHARED_REGION_CHECK_NP = 294 + SYS_SHARED_REGION_MAP_NP = 295 + SYS_VM_PRESSURE_MONITOR = 296 + SYS_PSYNCH_RW_LONGRDLOCK = 297 + SYS_PSYNCH_RW_YIELDWRLOCK = 298 + SYS_PSYNCH_RW_DOWNGRADE = 299 + SYS_PSYNCH_RW_UPGRADE = 300 + SYS_PSYNCH_MUTEXWAIT = 301 + SYS_PSYNCH_MUTEXDROP = 302 + SYS_PSYNCH_CVBROAD = 303 + SYS_PSYNCH_CVSIGNAL = 304 + SYS_PSYNCH_CVWAIT = 305 + SYS_PSYNCH_RW_RDLOCK = 306 + SYS_PSYNCH_RW_WRLOCK = 307 + SYS_PSYNCH_RW_UNLOCK = 308 + SYS_PSYNCH_RW_UNLOCK2 = 309 + SYS_GETSID = 310 + SYS_SETTID_WITH_PID = 311 + SYS_AIO_FSYNC = 313 + SYS_AIO_RETURN = 314 + SYS_AIO_SUSPEND = 315 + SYS_AIO_CANCEL = 316 + SYS_AIO_ERROR = 317 + SYS_AIO_READ = 318 + SYS_AIO_WRITE = 319 + SYS_LIO_LISTIO = 320 + SYS_IOPOLICYSYS = 322 + SYS_MLOCKALL = 324 + SYS_MUNLOCKALL = 325 + SYS_ISSETUGID = 327 + SYS___PTHREAD_KILL = 328 + SYS___PTHREAD_SIGMASK = 329 + SYS___SIGWAIT = 330 + SYS___DISABLE_THREADSIGNAL = 331 + SYS___PTHREAD_MARKCANCEL = 332 + SYS___PTHREAD_CANCELED = 333 + SYS___SEMWAIT_SIGNAL = 334 + SYS_PROC_INFO = 336 + SYS_SENDFILE = 337 + SYS_STAT64 = 338 + SYS_FSTAT64 = 339 + SYS_LSTAT64 = 340 + SYS_STAT64_EXTENDED = 341 + SYS_LSTAT64_EXTENDED = 342 + SYS_FSTAT64_EXTENDED = 343 + SYS_GETDIRENTRIES64 = 344 + SYS_STATFS64 = 345 + SYS_FSTATFS64 = 346 + SYS_GETFSSTAT64 = 347 + SYS___PTHREAD_CHDIR = 348 + SYS___PTHREAD_FCHDIR = 349 + SYS_AUDIT = 350 + SYS_AUDITON = 351 + SYS_GETAUID = 353 + SYS_SETAUID = 354 + SYS_GETAUDIT = 355 + SYS_SETAUDIT = 356 + SYS_GETAUDIT_ADDR = 357 + SYS_SETAUDIT_ADDR = 358 + SYS_AUDITCTL = 359 + SYS_BSDTHREAD_CREATE = 360 + SYS_BSDTHREAD_TERMINATE = 361 + SYS_KQUEUE = 362 + SYS_KEVENT = 363 + SYS_LCHOWN = 364 + SYS_STACK_SNAPSHOT = 365 + SYS_BSDTHREAD_REGISTER = 366 + SYS_WORKQ_OPEN = 367 + SYS_WORKQ_KERNRETURN = 368 + SYS_KEVENT64 = 369 + SYS___OLD_SEMWAIT_SIGNAL = 370 + SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 + SYS_THREAD_SELFID = 372 + SYS___MAC_EXECVE = 380 + SYS___MAC_SYSCALL = 381 + SYS___MAC_GET_FILE = 382 + SYS___MAC_SET_FILE = 383 + SYS___MAC_GET_LINK = 384 + SYS___MAC_SET_LINK = 385 + SYS___MAC_GET_PROC = 386 + SYS___MAC_SET_PROC = 387 + SYS___MAC_GET_FD = 388 + SYS___MAC_SET_FD = 389 + SYS___MAC_GET_PID = 390 + SYS___MAC_GET_LCID = 391 + SYS___MAC_GET_LCTX = 392 + SYS___MAC_SET_LCTX = 393 + SYS_SETLCID = 394 + SYS_GETLCID = 395 + SYS_READ_NOCANCEL = 396 + SYS_WRITE_NOCANCEL = 397 + SYS_OPEN_NOCANCEL = 398 + SYS_CLOSE_NOCANCEL = 399 + SYS_WAIT4_NOCANCEL = 400 + SYS_RECVMSG_NOCANCEL = 401 + SYS_SENDMSG_NOCANCEL = 402 + SYS_RECVFROM_NOCANCEL = 403 + SYS_ACCEPT_NOCANCEL = 404 + SYS_MSYNC_NOCANCEL = 405 + SYS_FCNTL_NOCANCEL = 406 + SYS_SELECT_NOCANCEL = 407 + SYS_FSYNC_NOCANCEL = 408 + SYS_CONNECT_NOCANCEL = 409 + SYS_SIGSUSPEND_NOCANCEL = 410 + SYS_READV_NOCANCEL = 411 + SYS_WRITEV_NOCANCEL = 412 + SYS_SENDTO_NOCANCEL = 413 + SYS_PREAD_NOCANCEL = 414 + SYS_PWRITE_NOCANCEL = 415 + SYS_WAITID_NOCANCEL = 416 + SYS_POLL_NOCANCEL = 417 + SYS_MSGSND_NOCANCEL = 418 + SYS_MSGRCV_NOCANCEL = 419 + SYS_SEM_WAIT_NOCANCEL = 420 + SYS_AIO_SUSPEND_NOCANCEL = 421 + SYS___SIGWAIT_NOCANCEL = 422 + SYS___SEMWAIT_SIGNAL_NOCANCEL = 423 + SYS___MAC_MOUNT = 424 + SYS___MAC_GET_MOUNT = 425 + SYS___MAC_GETFSSTAT = 426 + SYS_FSGETPATH = 427 + SYS_AUDIT_SESSION_SELF = 428 + SYS_AUDIT_SESSION_JOIN = 429 + SYS_PID_SUSPEND = 430 + SYS_PID_RESUME = 431 + SYS_FILEPORT_MAKEPORT = 432 + SYS_FILEPORT_MAKEFD = 433 + SYS_MAXSYSCALL = 434 ) diff --git a/src/pkg/syscall/zsysnum_darwin_amd64.go b/src/pkg/syscall/zsysnum_darwin_amd64.go index f9c6e077d..50aec39f1 100644 --- a/src/pkg/syscall/zsysnum_darwin_amd64.go +++ b/src/pkg/syscall/zsysnum_darwin_amd64.go @@ -1,485 +1,355 @@ -// mksysnum_darwin.pl /home/rsc/pub/xnu-1228/bsd/kern/syscalls.master +// mksysnum_darwin.pl /usr/include/sys/syscall.h // MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT package syscall const ( - // SYS_NOSYS = 0; // { int nosys(void); } { indirect syscall } - SYS_EXIT = 1 // { void exit(int rval); } - SYS_FORK = 2 // { int fork(void); } - SYS_READ = 3 // { user_ssize_t read(int fd, user_addr_t cbuf, user_size_t nbyte); } - SYS_WRITE = 4 // { user_ssize_t write(int fd, user_addr_t cbuf, user_size_t nbyte); } - SYS_OPEN = 5 // { int open(user_addr_t path, int flags, int mode); } - SYS_CLOSE = 6 // { int close(int fd); } - SYS_WAIT4 = 7 // { int wait4(int pid, user_addr_t status, int options, user_addr_t rusage); } - // SYS_NOSYS = 8; // { int nosys(void); } { old creat } - SYS_LINK = 9 // { int link(user_addr_t path, user_addr_t link); } - SYS_UNLINK = 10 // { int unlink(user_addr_t path); } - // SYS_NOSYS = 11; // { int nosys(void); } { old execv } - SYS_CHDIR = 12 // { int chdir(user_addr_t path); } - SYS_FCHDIR = 13 // { int fchdir(int fd); } - SYS_MKNOD = 14 // { int mknod(user_addr_t path, int mode, int dev); } - SYS_CHMOD = 15 // { int chmod(user_addr_t path, int mode); } - SYS_CHOWN = 16 // { int chown(user_addr_t path, int uid, int gid); } - SYS_OGETFSSTAT = 18 // { int ogetfsstat(user_addr_t buf, int bufsize, int flags); } - SYS_GETFSSTAT = 18 // { int getfsstat(user_addr_t buf, int bufsize, int flags); } - // SYS_NOSYS = 19; // { int nosys(void); } { old lseek } - SYS_GETPID = 20 // { int getpid(void); } - // SYS_NOSYS = 21; // { int nosys(void); } { old mount } - // SYS_NOSYS = 22; // { int nosys(void); } { old umount } - SYS_SETUID = 23 // { int setuid(uid_t uid); } - SYS_GETUID = 24 // { int getuid(void); } - SYS_GETEUID = 25 // { int geteuid(void); } - SYS_PTRACE = 26 // { int ptrace(int req, pid_t pid, caddr_t addr, int data); } - SYS_RECVMSG = 27 // { int recvmsg(int s, struct msghdr *msg, int flags); } - SYS_SENDMSG = 28 // { int sendmsg(int s, caddr_t msg, int flags); } - SYS_RECVFROM = 29 // { int recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, int *fromlenaddr); } - SYS_ACCEPT = 30 // { int accept(int s, caddr_t name, socklen_t *anamelen); } - SYS_GETPEERNAME = 31 // { int getpeername(int fdes, caddr_t asa, socklen_t *alen); } - SYS_GETSOCKNAME = 32 // { int getsockname(int fdes, caddr_t asa, socklen_t *alen); } - // SYS_NOSYS = 27; // { int nosys(void); } - // SYS_NOSYS = 28; // { int nosys(void); } - // SYS_NOSYS = 29; // { int nosys(void); } - // SYS_NOSYS = 30; // { int nosys(void); } - // SYS_NOSYS = 31; // { int nosys(void); } - // SYS_NOSYS = 32; // { int nosys(void); } - SYS_ACCESS = 33 // { int access(user_addr_t path, int flags); } - SYS_CHFLAGS = 34 // { int chflags(char *path, int flags); } - SYS_FCHFLAGS = 35 // { int fchflags(int fd, int flags); } - SYS_SYNC = 36 // { int sync(void); } - SYS_KILL = 37 // { int kill(int pid, int signum, int posix); } - // SYS_NOSYS = 38; // { int nosys(void); } { old stat } - SYS_GETPPID = 39 // { int getppid(void); } - // SYS_NOSYS = 40; // { int nosys(void); } { old lstat } - SYS_DUP = 41 // { int dup(u_int fd); } - SYS_PIPE = 42 // { int pipe(void); } - SYS_GETEGID = 43 // { int getegid(void); } - SYS_PROFIL = 44 // { int profil(short *bufbase, size_t bufsize, u_long pcoffset, u_int pcscale); } - // SYS_NOSYS = 45; // { int nosys(void); } { old ktrace } - SYS_SIGACTION = 46 // { int sigaction(int signum, struct __sigaction *nsa, struct sigaction *osa); } - SYS_GETGID = 47 // { int getgid(void); } - SYS_SIGPROCMASK = 48 // { int sigprocmask(int how, user_addr_t mask, user_addr_t omask); } - SYS_GETLOGIN = 49 // { int getlogin(char *namebuf, u_int namelen); } - SYS_SETLOGIN = 50 // { int setlogin(char *namebuf); } - SYS_ACCT = 51 // { int acct(char *path); } - SYS_SIGPENDING = 52 // { int sigpending(struct sigvec *osv); } - SYS_SIGALTSTACK = 53 // { int sigaltstack(struct sigaltstack *nss, struct sigaltstack *oss); } - SYS_IOCTL = 54 // { int ioctl(int fd, u_long com, caddr_t data); } - SYS_REBOOT = 55 // { int reboot(int opt, char *command); } - SYS_REVOKE = 56 // { int revoke(char *path); } - SYS_SYMLINK = 57 // { int symlink(char *path, char *link); } - SYS_READLINK = 58 // { int readlink(char *path, char *buf, int count); } - SYS_EXECVE = 59 // { int execve(char *fname, char **argp, char **envp); } - SYS_UMASK = 60 // { int umask(int newmask); } - SYS_CHROOT = 61 // { int chroot(user_addr_t path); } - // SYS_NOSYS = 62; // { int nosys(void); } { old fstat } - // SYS_NOSYS = 63; // { int nosys(void); } { used internally, reserved } - // SYS_NOSYS = 64; // { int nosys(void); } { old getpagesize } - SYS_MSYNC = 65 // { int msync(caddr_t addr, size_t len, int flags); } - SYS_VFORK = 66 // { int vfork(void); } - // SYS_NOSYS = 67; // { int nosys(void); } { old vread } - // SYS_NOSYS = 68; // { int nosys(void); } { old vwrite } - SYS_SBRK = 69 // { int sbrk(int incr) NO_SYSCALL_STUB; } - SYS_SSTK = 70 // { int sstk(int incr) NO_SYSCALL_STUB; } - // SYS_NOSYS = 71; // { int nosys(void); } { old mmap } - SYS_OVADVISE = 72 // { int ovadvise(void) NO_SYSCALL_STUB; } { old vadvise } - SYS_MUNMAP = 73 // { int munmap(caddr_t addr, size_t len); } - SYS_MPROTECT = 74 // { int mprotect(caddr_t addr, size_t len, int prot); } - SYS_MADVISE = 75 // { int madvise(caddr_t addr, size_t len, int behav); } - // SYS_NOSYS = 76; // { int nosys(void); } { old vhangup } - // SYS_NOSYS = 77; // { int nosys(void); } { old vlimit } - SYS_MINCORE = 78 // { int mincore(user_addr_t addr, user_size_t len, user_addr_t vec); } - SYS_GETGROUPS = 79 // { int getgroups(u_int gidsetsize, gid_t *gidset); } - SYS_SETGROUPS = 80 // { int setgroups(u_int gidsetsize, gid_t *gidset); } - SYS_GETPGRP = 81 // { int getpgrp(void); } - SYS_SETPGID = 82 // { int setpgid(int pid, int pgid); } - SYS_SETITIMER = 83 // { int setitimer(u_int which, struct itimerval *itv, struct itimerval *oitv); } - // SYS_NOSYS = 84; // { int nosys(void); } { old wait } - SYS_SWAPON = 85 // { int swapon(void); } - SYS_GETITIMER = 86 // { int getitimer(u_int which, struct itimerval *itv); } - // SYS_NOSYS = 87; // { int nosys(void); } { old gethostname } - // SYS_NOSYS = 88; // { int nosys(void); } { old sethostname } - SYS_GETDTABLESIZE = 89 // { int getdtablesize(void); } - SYS_DUP2 = 90 // { int dup2(u_int from, u_int to); } - // SYS_NOSYS = 91; // { int nosys(void); } { old getdopt } - SYS_FCNTL = 92 // { int fcntl(int fd, int cmd, long arg); } - SYS_SELECT = 93 // { int select(int nd, u_int32_t *in, u_int32_t *ou, u_int32_t *ex, struct timeval *tv); } - // SYS_NOSYS = 94; // { int nosys(void); } { old setdopt } - SYS_FSYNC = 95 // { int fsync(int fd); } - SYS_SETPRIORITY = 96 // { int setpriority(int which, id_t who, int prio); } - SYS_SOCKET = 97 // { int socket(int domain, int type, int protocol); } - SYS_CONNECT = 98 // { int connect(int s, caddr_t name, socklen_t namelen); } - // SYS_NOSYS = 97; // { int nosys(void); } - // SYS_NOSYS = 98; // { int nosys(void); } - // SYS_NOSYS = 99; // { int nosys(void); } { old accept } - SYS_GETPRIORITY = 100 // { int getpriority(int which, id_t who); } - // SYS_NOSYS = 101; // { int nosys(void); } { old send } - // SYS_NOSYS = 102; // { int nosys(void); } { old recv } - // SYS_NOSYS = 103; // { int nosys(void); } { old sigreturn } - SYS_BIND = 104 // { int bind(int s, caddr_t name, socklen_t namelen); } - SYS_SETSOCKOPT = 105 // { int setsockopt(int s, int level, int name, caddr_t val, socklen_t valsize); } - SYS_LISTEN = 106 // { int listen(int s, int backlog); } - // SYS_NOSYS = 104; // { int nosys(void); } - // SYS_NOSYS = 105; // { int nosys(void); } - // SYS_NOSYS = 106; // { int nosys(void); } - // SYS_NOSYS = 107; // { int nosys(void); } { old vtimes } - // SYS_NOSYS = 108; // { int nosys(void); } { old sigvec } - // SYS_NOSYS = 109; // { int nosys(void); } { old sigblock } - // SYS_NOSYS = 110; // { int nosys(void); } { old sigsetmask } - SYS_SIGSUSPEND = 111 // { int sigsuspend(sigset_t mask); } - // SYS_NOSYS = 112; // { int nosys(void); } { old sigstack } - // SYS_NOSYS = 113; // { int nosys(void); } { old recvmsg } - // SYS_NOSYS = 114; // { int nosys(void); } { old sendmsg } - // SYS_NOSYS = 113; // { int nosys(void); } - // SYS_NOSYS = 114; // { int nosys(void); } - // SYS_NOSYS = 115; // { int nosys(void); } { old vtrace } - SYS_GETTIMEOFDAY = 116 // { int gettimeofday(struct timeval *tp, struct timezone *tzp); } - SYS_GETRUSAGE = 117 // { int getrusage(int who, struct rusage *rusage); } - SYS_GETSOCKOPT = 118 // { int getsockopt(int s, int level, int name, caddr_t val, socklen_t *avalsize); } - // SYS_NOSYS = 118; // { int nosys(void); } - // SYS_NOSYS = 119; // { int nosys(void); } { old resuba } - SYS_READV = 120 // { user_ssize_t readv(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_WRITEV = 121 // { user_ssize_t writev(int fd, struct iovec *iovp, u_int iovcnt); } - SYS_SETTIMEOFDAY = 122 // { int settimeofday(struct timeval *tv, struct timezone *tzp); } - SYS_FCHOWN = 123 // { int fchown(int fd, int uid, int gid); } - SYS_FCHMOD = 124 // { int fchmod(int fd, int mode); } - // SYS_NOSYS = 125; // { int nosys(void); } { old recvfrom } - SYS_SETREUID = 126 // { int setreuid(uid_t ruid, uid_t euid); } - SYS_SETREGID = 127 // { int setregid(gid_t rgid, gid_t egid); } - SYS_RENAME = 128 // { int rename(char *from, char *to); } - // SYS_NOSYS = 129; // { int nosys(void); } { old truncate } - // SYS_NOSYS = 130; // { int nosys(void); } { old ftruncate } - SYS_FLOCK = 131 // { int flock(int fd, int how); } - SYS_MKFIFO = 132 // { int mkfifo(user_addr_t path, int mode); } - SYS_SENDTO = 133 // { int sendto(int s, caddr_t buf, size_t len, int flags, caddr_t to, socklen_t tolen); } - SYS_SHUTDOWN = 134 // { int shutdown(int s, int how); } - SYS_SOCKETPAIR = 135 // { int socketpair(int domain, int type, int protocol, int *rsv); } - // SYS_NOSYS = 133; // { int nosys(void); } - // SYS_NOSYS = 134; // { int nosys(void); } - // SYS_NOSYS = 135; // { int nosys(void); } - SYS_MKDIR = 136 // { int mkdir(user_addr_t path, int mode); } - SYS_RMDIR = 137 // { int rmdir(char *path); } - SYS_UTIMES = 138 // { int utimes(char *path, struct timeval *tptr); } - SYS_FUTIMES = 139 // { int futimes(int fd, struct timeval *tptr); } - SYS_ADJTIME = 140 // { int adjtime(struct timeval *delta, struct timeval *olddelta); } - // SYS_NOSYS = 141; // { int nosys(void); } { old getpeername } - SYS_GETHOSTUUID = 142 // { int gethostuuid(unsigned char *uuid_buf, const struct timespec *timeoutp); } - // SYS_NOSYS = 143; // { int nosys(void); } { old sethostid } - // SYS_NOSYS = 144; // { int nosys(void); } { old getrlimit } - // SYS_NOSYS = 145; // { int nosys(void); } { old setrlimit } - // SYS_NOSYS = 146; // { int nosys(void); } { old killpg } - SYS_SETSID = 147 // { int setsid(void); } - // SYS_NOSYS = 148; // { int nosys(void); } { old setquota } - // SYS_NOSYS = 149; // { int nosys(void); } { old qquota } - // SYS_NOSYS = 150; // { int nosys(void); } { old getsockname } - SYS_GETPGID = 151 // { int getpgid(pid_t pid); } - SYS_SETPRIVEXEC = 152 // { int setprivexec(int flag); } - SYS_PREAD = 153 // { user_ssize_t pread(int fd, user_addr_t buf, user_size_t nbyte, off_t offset); } - SYS_PWRITE = 154 // { user_ssize_t pwrite(int fd, user_addr_t buf, user_size_t nbyte, off_t offset); } - SYS_NFSSVC = 155 // { int nfssvc(int flag, caddr_t argp); } - // SYS_NOSYS = 155; // { int nosys(void); } - // SYS_NOSYS = 156; // { int nosys(void); } { old getdirentries } - SYS_STATFS = 157 // { int statfs(char *path, struct statfs *buf); } - SYS_FSTATFS = 158 // { int fstatfs(int fd, struct statfs *buf); } - SYS_UNMOUNT = 159 // { int unmount(user_addr_t path, int flags); } - // SYS_NOSYS = 160; // { int nosys(void); } { old async_daemon } - SYS_GETFH = 161 // { int getfh(char *fname, fhandle_t *fhp); } - // SYS_NOSYS = 161; // { int nosys(void); } - // SYS_NOSYS = 162; // { int nosys(void); } { old getdomainname } - // SYS_NOSYS = 163; // { int nosys(void); } { old setdomainname } - // SYS_NOSYS = 164; // { int nosys(void); } - SYS_QUOTACTL = 165 // { int quotactl(const char *path, int cmd, int uid, caddr_t arg); } - // SYS_NOSYS = 166; // { int nosys(void); } { old exportfs } - SYS_MOUNT = 167 // { int mount(char *type, char *path, int flags, caddr_t data); } - // SYS_NOSYS = 168; // { int nosys(void); } { old ustat } - SYS_CSOPS = 169 // { int csops(pid_t pid, uint32_t ops, user_addr_t useraddr, user_size_t usersize); } - // SYS_NOSYS = 171; // { int nosys(void); } { old wait3 } - // SYS_NOSYS = 172; // { int nosys(void); } { old rpause } - SYS_WAITID = 173 // { int waitid(idtype_t idtype, id_t id, siginfo_t *infop, int options); } - // SYS_NOSYS = 174; // { int nosys(void); } { old getdents } - // SYS_NOSYS = 175; // { int nosys(void); } { old gc_control } - SYS_ADD_PROFIL = 176 // { int add_profil(short *bufbase, size_t bufsize, u_long pcoffset, u_int pcscale); } - // SYS_NOSYS = 177; // { int nosys(void); } - // SYS_NOSYS = 178; // { int nosys(void); } - // SYS_NOSYS = 179; // { int nosys(void); } - SYS_KDEBUG_TRACE = 180 // { int kdebug_trace(int code, int arg1, int arg2, int arg3, int arg4, int arg5) NO_SYSCALL_STUB; } - SYS_SETGID = 181 // { int setgid(gid_t gid); } - SYS_SETEGID = 182 // { int setegid(gid_t egid); } - SYS_SETEUID = 183 // { int seteuid(uid_t euid); } - SYS_SIGRETURN = 184 // { int sigreturn(struct ucontext *uctx, int infostyle); } - // SYS_NOSYS = 186; // { int nosys(void); } - // SYS_NOSYS = 187; // { int nosys(void); } - SYS_STAT = 188 // { int stat(user_addr_t path, user_addr_t ub); } - SYS_FSTAT = 189 // { int fstat(int fd, user_addr_t ub); } - SYS_LSTAT = 190 // { int lstat(user_addr_t path, user_addr_t ub); } - SYS_PATHCONF = 191 // { int pathconf(char *path, int name); } - SYS_FPATHCONF = 192 // { int fpathconf(int fd, int name); } - // SYS_NOSYS = 193; // { int nosys(void); } - SYS_GETRLIMIT = 194 // { int getrlimit(u_int which, struct rlimit *rlp); } - SYS_SETRLIMIT = 195 // { int setrlimit(u_int which, struct rlimit *rlp); } - SYS_GETDIRENTRIES = 196 // { int getdirentries(int fd, char *buf, u_int count, long *basep); } - SYS_MMAP = 197 // { user_addr_t mmap(caddr_t addr, size_t len, int prot, int flags, int fd, off_t pos); } - // SYS_NOSYS = 198; // { int nosys(void); } { __syscall } - SYS_LSEEK = 199 // { off_t lseek(int fd, off_t offset, int whence); } - SYS_TRUNCATE = 200 // { int truncate(char *path, off_t length); } - SYS_FTRUNCATE = 201 // { int ftruncate(int fd, off_t length); } - SYS___SYSCTL = 202 // { int __sysctl(int *name, u_int namelen, void *old, size_t *oldlenp, void *new, size_t newlen); } - SYS_MLOCK = 203 // { int mlock(caddr_t addr, size_t len); } - SYS_MUNLOCK = 204 // { int munlock(caddr_t addr, size_t len); } - SYS_UNDELETE = 205 // { int undelete(user_addr_t path); } - SYS_ATSOCKET = 206 // { int ATsocket(int proto); } - // SYS_NOSYS = 213; // { int nosys(void); } { Reserved for AppleTalk } - // SYS_NOSYS = 206; // { int nosys(void); } - // SYS_NOSYS = 207; // { int nosys(void); } - // SYS_NOSYS = 208; // { int nosys(void); } - // SYS_NOSYS = 209; // { int nosys(void); } - // SYS_NOSYS = 210; // { int nosys(void); } - // SYS_NOSYS = 211; // { int nosys(void); } - // SYS_NOSYS = 212; // { int nosys(void); } - // SYS_NOSYS = 213; // { int nosys(void); } { Reserved for AppleTalk } - SYS_KQUEUE_FROM_PORTSET_NP = 214 // { int kqueue_from_portset_np(int portset); } - SYS_KQUEUE_PORTSET_NP = 215 // { int kqueue_portset_np(int fd); } - SYS_GETATTRLIST = 220 // { int getattrlist(const char *path, struct attrlist *alist, void *attributeBuffer, size_t bufferSize, u_long options); } - SYS_SETATTRLIST = 221 // { int setattrlist(const char *path, struct attrlist *alist, void *attributeBuffer, size_t bufferSize, u_long options); } - SYS_GETDIRENTRIESATTR = 222 // { int getdirentriesattr(int fd, struct attrlist *alist, void *buffer, size_t buffersize, u_long *count, u_long *basep, u_long *newstate, u_long options); } - SYS_EXCHANGEDATA = 223 // { int exchangedata(const char *path1, const char *path2, u_long options); } - // SYS_NOSYS = 224; // { int nosys(void); } { was checkuseraccess } - SYS_SEARCHFS = 225 // { int searchfs(const char *path, struct fssearchblock *searchblock, u_long *nummatches, u_long scriptcode, u_long options, struct searchstate *state); } - SYS_DELETE = 226 // { int delete(user_addr_t path) NO_SYSCALL_STUB; } { private delete (Carbon semantics) } - SYS_COPYFILE = 227 // { int copyfile(char *from, char *to, int mode, int flags) NO_SYSCALL_STUB; } - // SYS_NOSYS = 228; // { int nosys(void); } - // SYS_NOSYS = 229; // { int nosys(void); } - SYS_POLL = 230 // { int poll(struct pollfd *fds, u_int nfds, int timeout); } - SYS_WATCHEVENT = 231 // { int watchevent(struct eventreq *u_req, int u_eventmask); } - SYS_WAITEVENT = 232 // { int waitevent(struct eventreq *u_req, struct timeval *tv); } - SYS_MODWATCH = 233 // { int modwatch(struct eventreq *u_req, int u_eventmask); } - SYS_GETXATTR = 234 // { user_ssize_t getxattr(user_addr_t path, user_addr_t attrname, user_addr_t value, size_t size, uint32_t position, int options); } - SYS_FGETXATTR = 235 // { user_ssize_t fgetxattr(int fd, user_addr_t attrname, user_addr_t value, size_t size, uint32_t position, int options); } - SYS_SETXATTR = 236 // { int setxattr(user_addr_t path, user_addr_t attrname, user_addr_t value, size_t size, uint32_t position, int options); } - SYS_FSETXATTR = 237 // { int fsetxattr(int fd, user_addr_t attrname, user_addr_t value, size_t size, uint32_t position, int options); } - SYS_REMOVEXATTR = 238 // { int removexattr(user_addr_t path, user_addr_t attrname, int options); } - SYS_FREMOVEXATTR = 239 // { int fremovexattr(int fd, user_addr_t attrname, int options); } - SYS_LISTXATTR = 240 // { user_ssize_t listxattr(user_addr_t path, user_addr_t namebuf, size_t bufsize, int options); } - SYS_FLISTXATTR = 241 // { user_ssize_t flistxattr(int fd, user_addr_t namebuf, size_t bufsize, int options); } - SYS_FSCTL = 242 // { int fsctl(const char *path, u_long cmd, caddr_t data, u_long options); } - SYS_INITGROUPS = 243 // { int initgroups(u_int gidsetsize, gid_t *gidset, int gmuid); } - SYS_POSIX_SPAWN = 244 // { int posix_spawn(pid_t *pid, const char *path, const struct _posix_spawn_args_desc *adesc, char **argv, char **envp); } - // SYS_NOSYS = 245; // { int nosys(void); } - // SYS_NOSYS = 246; // { int nosys(void); } - SYS_NFSCLNT = 247 // { int nfsclnt(int flag, caddr_t argp); } - // SYS_NOSYS = 247; // { int nosys(void); } - SYS_FHOPEN = 248 // { int fhopen(const struct fhandle *u_fhp, int flags); } - // SYS_NOSYS = 248; // { int nosys(void); } - // SYS_NOSYS = 249; // { int nosys(void); } - SYS_MINHERIT = 250 // { int minherit(void *addr, size_t len, int inherit); } - SYS_SEMSYS = 251 // { int semsys(u_int which, int a2, int a3, int a4, int a5); } - // SYS_NOSYS = 251; // { int nosys(void); } - SYS_MSGSYS = 252 // { int msgsys(u_int which, int a2, int a3, int a4, int a5); } - // SYS_NOSYS = 252; // { int nosys(void); } - SYS_SHMSYS = 253 // { int shmsys(u_int which, int a2, int a3, int a4); } - // SYS_NOSYS = 253; // { int nosys(void); } - SYS_SEMCTL = 254 // { int semctl(int semid, int semnum, int cmd, semun_t arg); } - SYS_SEMGET = 255 // { int semget(key_t key, int nsems, int semflg); } - SYS_SEMOP = 256 // { int semop(int semid, struct sembuf *sops, int nsops); } - // SYS_NOSYS = 257; // { int nosys(void); } - // SYS_NOSYS = 254; // { int nosys(void); } - // SYS_NOSYS = 255; // { int nosys(void); } - // SYS_NOSYS = 256; // { int nosys(void); } - // SYS_NOSYS = 257; // { int nosys(void); } - SYS_MSGCTL = 258 // { int msgctl(int msqid, int cmd, struct msqid_ds *buf); } - SYS_MSGGET = 259 // { int msgget(key_t key, int msgflg); } - SYS_MSGSND = 260 // { int msgsnd(int msqid, void *msgp, size_t msgsz, int msgflg); } - SYS_MSGRCV = 261 // { user_ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg); } - // SYS_NOSYS = 258; // { int nosys(void); } - // SYS_NOSYS = 259; // { int nosys(void); } - // SYS_NOSYS = 260; // { int nosys(void); } - // SYS_NOSYS = 261; // { int nosys(void); } - SYS_SHMAT = 262 // { user_addr_t shmat(int shmid, void *shmaddr, int shmflg); } - SYS_SHMCTL = 263 // { int shmctl(int shmid, int cmd, struct shmid_ds *buf); } - SYS_SHMDT = 264 // { int shmdt(void *shmaddr); } - SYS_SHMGET = 265 // { int shmget(key_t key, size_t size, int shmflg); } - // SYS_NOSYS = 262; // { int nosys(void); } - // SYS_NOSYS = 263; // { int nosys(void); } - // SYS_NOSYS = 264; // { int nosys(void); } - // SYS_NOSYS = 265; // { int nosys(void); } - SYS_SHM_OPEN = 266 // { int shm_open(const char *name, int oflag, int mode); } - SYS_SHM_UNLINK = 267 // { int shm_unlink(const char *name); } - SYS_SEM_OPEN = 268 // { user_addr_t sem_open(const char *name, int oflag, int mode, int value); } - SYS_SEM_CLOSE = 269 // { int sem_close(sem_t *sem); } - SYS_SEM_UNLINK = 270 // { int sem_unlink(const char *name); } - SYS_SEM_WAIT = 271 // { int sem_wait(sem_t *sem); } - SYS_SEM_TRYWAIT = 272 // { int sem_trywait(sem_t *sem); } - SYS_SEM_POST = 273 // { int sem_post(sem_t *sem); } - SYS_SEM_GETVALUE = 274 // { int sem_getvalue(sem_t *sem, int *sval); } - SYS_SEM_INIT = 275 // { int sem_init(sem_t *sem, int phsared, u_int value); } - SYS_SEM_DESTROY = 276 // { int sem_destroy(sem_t *sem); } - SYS_OPEN_EXTENDED = 277 // { int open_extended(user_addr_t path, int flags, uid_t uid, gid_t gid, int mode, user_addr_t xsecurity) NO_SYSCALL_STUB; } - SYS_UMASK_EXTENDED = 278 // { int umask_extended(int newmask, user_addr_t xsecurity) NO_SYSCALL_STUB; } - SYS_STAT_EXTENDED = 279 // { int stat_extended(user_addr_t path, user_addr_t ub, user_addr_t xsecurity, user_addr_t xsecurity_size) NO_SYSCALL_STUB; } - SYS_LSTAT_EXTENDED = 280 // { int lstat_extended(user_addr_t path, user_addr_t ub, user_addr_t xsecurity, user_addr_t xsecurity_size) NO_SYSCALL_STUB; } - SYS_FSTAT_EXTENDED = 281 // { int fstat_extended(int fd, user_addr_t ub, user_addr_t xsecurity, user_addr_t xsecurity_size) NO_SYSCALL_STUB; } - SYS_CHMOD_EXTENDED = 282 // { int chmod_extended(user_addr_t path, uid_t uid, gid_t gid, int mode, user_addr_t xsecurity) NO_SYSCALL_STUB; } - SYS_FCHMOD_EXTENDED = 283 // { int fchmod_extended(int fd, uid_t uid, gid_t gid, int mode, user_addr_t xsecurity) NO_SYSCALL_STUB; } - SYS_ACCESS_EXTENDED = 284 // { int access_extended(user_addr_t entries, size_t size, user_addr_t results, uid_t uid) NO_SYSCALL_STUB; } - SYS_SETTID = 285 // { int settid(uid_t uid, gid_t gid) NO_SYSCALL_STUB; } - SYS_GETTID = 286 // { int gettid(uid_t *uidp, gid_t *gidp) NO_SYSCALL_STUB; } - SYS_SETSGROUPS = 287 // { int setsgroups(int setlen, user_addr_t guidset) NO_SYSCALL_STUB; } - SYS_GETSGROUPS = 288 // { int getsgroups(user_addr_t setlen, user_addr_t guidset) NO_SYSCALL_STUB; } - SYS_SETWGROUPS = 289 // { int setwgroups(int setlen, user_addr_t guidset) NO_SYSCALL_STUB; } - SYS_GETWGROUPS = 290 // { int getwgroups(user_addr_t setlen, user_addr_t guidset) NO_SYSCALL_STUB; } - SYS_MKFIFO_EXTENDED = 291 // { int mkfifo_extended(user_addr_t path, uid_t uid, gid_t gid, int mode, user_addr_t xsecurity) NO_SYSCALL_STUB; } - SYS_MKDIR_EXTENDED = 292 // { int mkdir_extended(user_addr_t path, uid_t uid, gid_t gid, int mode, user_addr_t xsecurity) NO_SYSCALL_STUB; } - SYS_IDENTITYSVC = 293 // { int identitysvc(int opcode, user_addr_t message) NO_SYSCALL_STUB; } - SYS_SHARED_REGION_CHECK_NP = 294 // { int shared_region_check_np(uint64_t *start_address) NO_SYSCALL_STUB; } - SYS_SHARED_REGION_MAP_NP = 295 // { int shared_region_map_np(int fd, uint32_t count, const struct shared_file_mapping_np *mappings) NO_SYSCALL_STUB; } - // SYS_NOSYS = 296; // { int nosys(void); } { old load_shared_file } - // SYS_NOSYS = 297; // { int nosys(void); } { old reset_shared_file } - // SYS_NOSYS = 298; // { int nosys(void); } { old new_system_shared_regions } - // SYS_ENOSYS = 299; // { int enosys(void); } { old shared_region_map_file_np } - // SYS_ENOSYS = 300; // { int enosys(void); } { old shared_region_make_private_np } - SYS___PTHREAD_MUTEX_DESTROY = 301 // { int __pthread_mutex_destroy(int mutexid); } - SYS___PTHREAD_MUTEX_INIT = 302 // { int __pthread_mutex_init(user_addr_t mutex, user_addr_t attr); } - SYS___PTHREAD_MUTEX_LOCK = 303 // { int __pthread_mutex_lock(int mutexid); } - SYS___PTHREAD_MUTEX_TRYLOCK = 304 // { int __pthread_mutex_trylock(int mutexid); } - SYS___PTHREAD_MUTEX_UNLOCK = 305 // { int __pthread_mutex_unlock(int mutexid); } - SYS___PTHREAD_COND_INIT = 306 // { int __pthread_cond_init(user_addr_t cond, user_addr_t attr); } - SYS___PTHREAD_COND_DESTROY = 307 // { int __pthread_cond_destroy(int condid); } - SYS___PTHREAD_COND_BROADCAST = 308 // { int __pthread_cond_broadcast(int condid); } - SYS___PTHREAD_COND_SIGNAL = 309 // { int __pthread_cond_signal(int condid); } - SYS_GETSID = 310 // { int getsid(pid_t pid); } - SYS_SETTID_WITH_PID = 311 // { int settid_with_pid(pid_t pid, int assume) NO_SYSCALL_STUB; } - SYS___PTHREAD_COND_TIMEDWAIT = 312 // { int __pthread_cond_timedwait(int condid, int mutexid, user_addr_t abstime); } - SYS_AIO_FSYNC = 313 // { int aio_fsync(int op, user_addr_t aiocbp); } - SYS_AIO_RETURN = 314 // { user_ssize_t aio_return(user_addr_t aiocbp); } - SYS_AIO_SUSPEND = 315 // { int aio_suspend(user_addr_t aiocblist, int nent, user_addr_t timeoutp); } - SYS_AIO_CANCEL = 316 // { int aio_cancel(int fd, user_addr_t aiocbp); } - SYS_AIO_ERROR = 317 // { int aio_error(user_addr_t aiocbp); } - SYS_AIO_READ = 318 // { int aio_read(user_addr_t aiocbp); } - SYS_AIO_WRITE = 319 // { int aio_write(user_addr_t aiocbp); } - SYS_LIO_LISTIO = 320 // { int lio_listio(int mode, user_addr_t aiocblist, int nent, user_addr_t sigp); } - SYS___PTHREAD_COND_WAIT = 321 // { int __pthread_cond_wait(int condid, int mutexid); } - SYS_IOPOLICYSYS = 322 // { int iopolicysys(int cmd, void *arg) NO_SYSCALL_STUB; } - // SYS_NOSYS = 323; // { int nosys(void); } - SYS_MLOCKALL = 324 // { int mlockall(int how); } - SYS_MUNLOCKALL = 325 // { int munlockall(int how); } - // SYS_NOSYS = 326; // { int nosys(void); } - SYS_ISSETUGID = 327 // { int issetugid(void); } - SYS___PTHREAD_KILL = 328 // { int __pthread_kill(int thread_port, int sig); } - SYS___PTHREAD_SIGMASK = 329 // { int __pthread_sigmask(int how, user_addr_t set, user_addr_t oset); } - SYS___SIGWAIT = 330 // { int __sigwait(user_addr_t set, user_addr_t sig); } - SYS___DISABLE_THREADSIGNAL = 331 // { int __disable_threadsignal(int value); } - SYS___PTHREAD_MARKCANCEL = 332 // { int __pthread_markcancel(int thread_port); } - SYS___PTHREAD_CANCELED = 333 // { int __pthread_canceled(int action); } - SYS___SEMWAIT_SIGNAL = 334 // { int __semwait_signal(int cond_sem, int mutex_sem, int timeout, int relative, time_t tv_sec, int32_t tv_nsec); } - // SYS_NOSYS = 335; // { int nosys(void); } { old utrace } - SYS_PROC_INFO = 336 // { int proc_info(int32_t callnum,int32_t pid,uint32_t flavor, uint64_t arg,user_addr_t buffer,int32_t buffersize) NO_SYSCALL_STUB; } - SYS_SENDFILE = 337 // { int sendfile(int fd, int s, off_t offset, off_t *nbytes, struct sf_hdtr *hdtr, int flags); } - // SYS_NOSYS = 337; // { int nosys(void); } - SYS_STAT64 = 338 // { int stat64(user_addr_t path, user_addr_t ub); } - SYS_FSTAT64 = 339 // { int fstat64(int fd, user_addr_t ub); } - SYS_LSTAT64 = 340 // { int lstat64(user_addr_t path, user_addr_t ub); } - SYS_STAT64_EXTENDED = 341 // { int stat64_extended(user_addr_t path, user_addr_t ub, user_addr_t xsecurity, user_addr_t xsecurity_size) NO_SYSCALL_STUB; } - SYS_LSTAT64_EXTENDED = 342 // { int lstat64_extended(user_addr_t path, user_addr_t ub, user_addr_t xsecurity, user_addr_t xsecurity_size) NO_SYSCALL_STUB; } - SYS_FSTAT64_EXTENDED = 343 // { int fstat64_extended(int fd, user_addr_t ub, user_addr_t xsecurity, user_addr_t xsecurity_size) NO_SYSCALL_STUB; } - SYS_GETDIRENTRIES64 = 344 // { user_ssize_t getdirentries64(int fd, void *buf, user_size_t bufsize, off_t *position) NO_SYSCALL_STUB; } - SYS_STATFS64 = 345 // { int statfs64(char *path, struct statfs64 *buf); } - SYS_FSTATFS64 = 346 // { int fstatfs64(int fd, struct statfs64 *buf); } - SYS_GETFSSTAT64 = 347 // { int getfsstat64(user_addr_t buf, int bufsize, int flags); } - SYS___PTHREAD_CHDIR = 348 // { int __pthread_chdir(user_addr_t path); } - SYS___PTHREAD_FCHDIR = 349 // { int __pthread_fchdir(int fd); } - SYS_AUDIT = 350 // { int audit(void *record, int length); } - SYS_AUDITON = 351 // { int auditon(int cmd, void *data, int length); } - // SYS_NOSYS = 352; // { int nosys(void); } - SYS_GETAUID = 353 // { int getauid(au_id_t *auid); } - SYS_SETAUID = 354 // { int setauid(au_id_t *auid); } - SYS_GETAUDIT = 355 // { int getaudit(struct auditinfo *auditinfo); } - SYS_SETAUDIT = 356 // { int setaudit(struct auditinfo *auditinfo); } - SYS_GETAUDIT_ADDR = 357 // { int getaudit_addr(struct auditinfo_addr *auditinfo_addr, int length); } - SYS_SETAUDIT_ADDR = 358 // { int setaudit_addr(struct auditinfo_addr *auditinfo_addr, int length); } - SYS_AUDITCTL = 359 // { int auditctl(char *path); } - // SYS_NOSYS = 350; // { int nosys(void); } - // SYS_NOSYS = 351; // { int nosys(void); } - // SYS_NOSYS = 352; // { int nosys(void); } - // SYS_NOSYS = 353; // { int nosys(void); } - // SYS_NOSYS = 354; // { int nosys(void); } - // SYS_NOSYS = 355; // { int nosys(void); } - // SYS_NOSYS = 356; // { int nosys(void); } - // SYS_NOSYS = 357; // { int nosys(void); } - // SYS_NOSYS = 358; // { int nosys(void); } - // SYS_NOSYS = 359; // { int nosys(void); } - SYS_BSDTHREAD_CREATE = 360 // { user_addr_t bsdthread_create(user_addr_t func, user_addr_t func_arg, user_addr_t stack, user_addr_t pthread, uint32_t flags) NO_SYSCALL_STUB; } - SYS_BSDTHREAD_TERMINATE = 361 // { int bsdthread_terminate(user_addr_t stackaddr, size_t freesize, uint32_t port, uint32_t sem) NO_SYSCALL_STUB; } - SYS_KQUEUE = 362 // { int kqueue(void); } - SYS_KEVENT = 363 // { int kevent(int fd, const struct kevent *changelist, int nchanges, struct kevent *eventlist, int nevents, const struct timespec *timeout); } - SYS_LCHOWN = 364 // { int lchown(user_addr_t path, uid_t owner, gid_t group); } - SYS_STACK_SNAPSHOT = 365 // { int stack_snapshot(pid_t pid, user_addr_t tracebuf, uint32_t tracebuf_size, uint32_t options) NO_SYSCALL_STUB; } - SYS_BSDTHREAD_REGISTER = 366 // { int bsdthread_register(user_addr_t threadstart, user_addr_t wqthread, int pthsize) NO_SYSCALL_STUB; } - SYS_WORKQ_OPEN = 367 // { int workq_open(void) NO_SYSCALL_STUB; } - SYS_WORKQ_OPS = 368 // { int workq_ops(int options, user_addr_t item, int prio) NO_SYSCALL_STUB; } - // SYS_NOSYS = 369; // { int nosys(void); } - // SYS_NOSYS = 370; // { int nosys(void); } - // SYS_NOSYS = 371; // { int nosys(void); } - // SYS_NOSYS = 372; // { int nosys(void); } - // SYS_NOSYS = 373; // { int nosys(void); } - // SYS_NOSYS = 374; // { int nosys(void); } - // SYS_NOSYS = 375; // { int nosys(void); } - // SYS_NOSYS = 376; // { int nosys(void); } - // SYS_NOSYS = 377; // { int nosys(void); } - // SYS_NOSYS = 378; // { int nosys(void); } - // SYS_NOSYS = 379; // { int nosys(void); } - SYS___MAC_EXECVE = 380 // { int __mac_execve(char *fname, char **argp, char **envp, struct mac *mac_p); } - SYS___MAC_SYSCALL = 381 // { int __mac_syscall(char *policy, int call, user_addr_t arg); } - SYS___MAC_GET_FILE = 382 // { int __mac_get_file(char *path_p, struct mac *mac_p); } - SYS___MAC_SET_FILE = 383 // { int __mac_set_file(char *path_p, struct mac *mac_p); } - SYS___MAC_GET_LINK = 384 // { int __mac_get_link(char *path_p, struct mac *mac_p); } - SYS___MAC_SET_LINK = 385 // { int __mac_set_link(char *path_p, struct mac *mac_p); } - SYS___MAC_GET_PROC = 386 // { int __mac_get_proc(struct mac *mac_p); } - SYS___MAC_SET_PROC = 387 // { int __mac_set_proc(struct mac *mac_p); } - SYS___MAC_GET_FD = 388 // { int __mac_get_fd(int fd, struct mac *mac_p); } - SYS___MAC_SET_FD = 389 // { int __mac_set_fd(int fd, struct mac *mac_p); } - SYS___MAC_GET_PID = 390 // { int __mac_get_pid(pid_t pid, struct mac *mac_p); } - SYS___MAC_GET_LCID = 391 // { int __mac_get_lcid(pid_t lcid, struct mac *mac_p); } - SYS___MAC_GET_LCTX = 392 // { int __mac_get_lctx(struct mac *mac_p); } - SYS___MAC_SET_LCTX = 393 // { int __mac_set_lctx(struct mac *mac_p); } - SYS_SETLCID = 394 // { int setlcid(pid_t pid, pid_t lcid) NO_SYSCALL_STUB; } - SYS_GETLCID = 395 // { int getlcid(pid_t pid) NO_SYSCALL_STUB; } - SYS_READ_NOCANCEL = 396 // { user_ssize_t read_nocancel(int fd, user_addr_t cbuf, user_size_t nbyte) NO_SYSCALL_STUB; } - SYS_WRITE_NOCANCEL = 397 // { user_ssize_t write_nocancel(int fd, user_addr_t cbuf, user_size_t nbyte) NO_SYSCALL_STUB; } - SYS_OPEN_NOCANCEL = 398 // { int open_nocancel(user_addr_t path, int flags, int mode) NO_SYSCALL_STUB; } - SYS_CLOSE_NOCANCEL = 399 // { int close_nocancel(int fd) NO_SYSCALL_STUB; } - SYS_WAIT4_NOCANCEL = 400 // { int wait4_nocancel(int pid, user_addr_t status, int options, user_addr_t rusage) NO_SYSCALL_STUB; } - SYS_RECVMSG_NOCANCEL = 401 // { int recvmsg_nocancel(int s, struct msghdr *msg, int flags) NO_SYSCALL_STUB; } - SYS_SENDMSG_NOCANCEL = 402 // { int sendmsg_nocancel(int s, caddr_t msg, int flags) NO_SYSCALL_STUB; } - SYS_RECVFROM_NOCANCEL = 403 // { int recvfrom_nocancel(int s, void *buf, size_t len, int flags, struct sockaddr *from, int *fromlenaddr) NO_SYSCALL_STUB; } - SYS_ACCEPT_NOCANCEL = 404 // { int accept_nocancel(int s, caddr_t name, socklen_t *anamelen) NO_SYSCALL_STUB; } - // SYS_NOSYS = 401; // { int nosys(void); } - // SYS_NOSYS = 402; // { int nosys(void); } - // SYS_NOSYS = 403; // { int nosys(void); } - // SYS_NOSYS = 404; // { int nosys(void); } - SYS_MSYNC_NOCANCEL = 405 // { int msync_nocancel(caddr_t addr, size_t len, int flags) NO_SYSCALL_STUB; } - SYS_FCNTL_NOCANCEL = 406 // { int fcntl_nocancel(int fd, int cmd, long arg) NO_SYSCALL_STUB; } - SYS_SELECT_NOCANCEL = 407 // { int select_nocancel(int nd, u_int32_t *in, u_int32_t *ou, u_int32_t *ex, struct timeval *tv) NO_SYSCALL_STUB; } - SYS_FSYNC_NOCANCEL = 408 // { int fsync_nocancel(int fd) NO_SYSCALL_STUB; } - SYS_CONNECT_NOCANCEL = 409 // { int connect_nocancel(int s, caddr_t name, socklen_t namelen) NO_SYSCALL_STUB; } - // SYS_NOSYS = 409; // { int nosys(void); } - SYS_SIGSUSPEND_NOCANCEL = 410 // { int sigsuspend_nocancel(sigset_t mask) NO_SYSCALL_STUB; } - SYS_READV_NOCANCEL = 411 // { user_ssize_t readv_nocancel(int fd, struct iovec *iovp, u_int iovcnt) NO_SYSCALL_STUB; } - SYS_WRITEV_NOCANCEL = 412 // { user_ssize_t writev_nocancel(int fd, struct iovec *iovp, u_int iovcnt) NO_SYSCALL_STUB; } - SYS_SENDTO_NOCANCEL = 413 // { int sendto_nocancel(int s, caddr_t buf, size_t len, int flags, caddr_t to, socklen_t tolen) NO_SYSCALL_STUB; } - // SYS_NOSYS = 413; // { int nosys(void); } - SYS_PREAD_NOCANCEL = 414 // { user_ssize_t pread_nocancel(int fd, user_addr_t buf, user_size_t nbyte, off_t offset) NO_SYSCALL_STUB; } - SYS_PWRITE_NOCANCEL = 415 // { user_ssize_t pwrite_nocancel(int fd, user_addr_t buf, user_size_t nbyte, off_t offset) NO_SYSCALL_STUB; } - SYS_WAITID_NOCANCEL = 416 // { int waitid_nocancel(idtype_t idtype, id_t id, siginfo_t *infop, int options) NO_SYSCALL_STUB; } - SYS_POLL_NOCANCEL = 417 // { int poll_nocancel(struct pollfd *fds, u_int nfds, int timeout) NO_SYSCALL_STUB; } - SYS_MSGSND_NOCANCEL = 418 // { int msgsnd_nocancel(int msqid, void *msgp, size_t msgsz, int msgflg) NO_SYSCALL_STUB; } - SYS_MSGRCV_NOCANCEL = 419 // { user_ssize_t msgrcv_nocancel(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg) NO_SYSCALL_STUB; } - // SYS_NOSYS = 418; // { int nosys(void); } - // SYS_NOSYS = 419; // { int nosys(void); } - SYS_SEM_WAIT_NOCANCEL = 420 // { int sem_wait_nocancel(sem_t *sem) NO_SYSCALL_STUB; } - SYS_AIO_SUSPEND_NOCANCEL = 421 // { int aio_suspend_nocancel(user_addr_t aiocblist, int nent, user_addr_t timeoutp) NO_SYSCALL_STUB; } - SYS___SIGWAIT_NOCANCEL = 422 // { int __sigwait_nocancel(user_addr_t set, user_addr_t sig) NO_SYSCALL_STUB; } - SYS___SEMWAIT_SIGNAL_NOCANCEL = 423 // { int __semwait_signal_nocancel(int cond_sem, int mutex_sem, int timeout, int relative, time_t tv_sec, int32_t tv_nsec) NO_SYSCALL_STUB; } - SYS___MAC_MOUNT = 424 // { int __mac_mount(char *type, char *path, int flags, caddr_t data, struct mac *mac_p); } - SYS___MAC_GET_MOUNT = 425 // { int __mac_get_mount(char *path, struct mac *mac_p); } - SYS___MAC_GETFSSTAT = 426 // { int __mac_getfsstat(user_addr_t buf, int bufsize, user_addr_t mac, int macsize, int flags); } + SYS_SYSCALL = 0 + SYS_EXIT = 1 + SYS_FORK = 2 + SYS_READ = 3 + SYS_WRITE = 4 + SYS_OPEN = 5 + SYS_CLOSE = 6 + SYS_WAIT4 = 7 + SYS_LINK = 9 + SYS_UNLINK = 10 + SYS_CHDIR = 12 + SYS_FCHDIR = 13 + SYS_MKNOD = 14 + SYS_CHMOD = 15 + SYS_CHOWN = 16 + SYS_GETFSSTAT = 18 + SYS_GETPID = 20 + SYS_SETUID = 23 + SYS_GETUID = 24 + SYS_GETEUID = 25 + SYS_PTRACE = 26 + SYS_RECVMSG = 27 + SYS_SENDMSG = 28 + SYS_RECVFROM = 29 + SYS_ACCEPT = 30 + SYS_GETPEERNAME = 31 + SYS_GETSOCKNAME = 32 + SYS_ACCESS = 33 + SYS_CHFLAGS = 34 + SYS_FCHFLAGS = 35 + SYS_SYNC = 36 + SYS_KILL = 37 + SYS_GETPPID = 39 + SYS_DUP = 41 + SYS_PIPE = 42 + SYS_GETEGID = 43 + SYS_PROFIL = 44 + SYS_SIGACTION = 46 + SYS_GETGID = 47 + SYS_SIGPROCMASK = 48 + SYS_GETLOGIN = 49 + SYS_SETLOGIN = 50 + SYS_ACCT = 51 + SYS_SIGPENDING = 52 + SYS_SIGALTSTACK = 53 + SYS_IOCTL = 54 + SYS_REBOOT = 55 + SYS_REVOKE = 56 + SYS_SYMLINK = 57 + SYS_READLINK = 58 + SYS_EXECVE = 59 + SYS_UMASK = 60 + SYS_CHROOT = 61 + SYS_MSYNC = 65 + SYS_VFORK = 66 + SYS_MUNMAP = 73 + SYS_MPROTECT = 74 + SYS_MADVISE = 75 + SYS_MINCORE = 78 + SYS_GETGROUPS = 79 + SYS_SETGROUPS = 80 + SYS_GETPGRP = 81 + SYS_SETPGID = 82 + SYS_SETITIMER = 83 + SYS_SWAPON = 85 + SYS_GETITIMER = 86 + SYS_GETDTABLESIZE = 89 + SYS_DUP2 = 90 + SYS_FCNTL = 92 + SYS_SELECT = 93 + SYS_FSYNC = 95 + SYS_SETPRIORITY = 96 + SYS_SOCKET = 97 + SYS_CONNECT = 98 + SYS_GETPRIORITY = 100 + SYS_BIND = 104 + SYS_SETSOCKOPT = 105 + SYS_LISTEN = 106 + SYS_SIGSUSPEND = 111 + SYS_GETTIMEOFDAY = 116 + SYS_GETRUSAGE = 117 + SYS_GETSOCKOPT = 118 + SYS_READV = 120 + SYS_WRITEV = 121 + SYS_SETTIMEOFDAY = 122 + SYS_FCHOWN = 123 + SYS_FCHMOD = 124 + SYS_SETREUID = 126 + SYS_SETREGID = 127 + SYS_RENAME = 128 + SYS_FLOCK = 131 + SYS_MKFIFO = 132 + SYS_SENDTO = 133 + SYS_SHUTDOWN = 134 + SYS_SOCKETPAIR = 135 + SYS_MKDIR = 136 + SYS_RMDIR = 137 + SYS_UTIMES = 138 + SYS_FUTIMES = 139 + SYS_ADJTIME = 140 + SYS_GETHOSTUUID = 142 + SYS_SETSID = 147 + SYS_GETPGID = 151 + SYS_SETPRIVEXEC = 152 + SYS_PREAD = 153 + SYS_PWRITE = 154 + SYS_NFSSVC = 155 + SYS_STATFS = 157 + SYS_FSTATFS = 158 + SYS_UNMOUNT = 159 + SYS_GETFH = 161 + SYS_QUOTACTL = 165 + SYS_MOUNT = 167 + SYS_CSOPS = 169 + SYS_WAITID = 173 + SYS_ADD_PROFIL = 176 + SYS_KDEBUG_TRACE = 180 + SYS_SETGID = 181 + SYS_SETEGID = 182 + SYS_SETEUID = 183 + SYS_SIGRETURN = 184 + SYS_CHUD = 185 + SYS_FDATASYNC = 187 + SYS_STAT = 188 + SYS_FSTAT = 189 + SYS_LSTAT = 190 + SYS_PATHCONF = 191 + SYS_FPATHCONF = 192 + SYS_GETRLIMIT = 194 + SYS_SETRLIMIT = 195 + SYS_GETDIRENTRIES = 196 + SYS_MMAP = 197 + SYS_LSEEK = 199 + SYS_TRUNCATE = 200 + SYS_FTRUNCATE = 201 + SYS___SYSCTL = 202 + SYS_MLOCK = 203 + SYS_MUNLOCK = 204 + SYS_UNDELETE = 205 + SYS_ATSOCKET = 206 + SYS_ATGETMSG = 207 + SYS_ATPUTMSG = 208 + SYS_ATPSNDREQ = 209 + SYS_ATPSNDRSP = 210 + SYS_ATPGETREQ = 211 + SYS_ATPGETRSP = 212 + SYS_MKCOMPLEX = 216 + SYS_STATV = 217 + SYS_LSTATV = 218 + SYS_FSTATV = 219 + SYS_GETATTRLIST = 220 + SYS_SETATTRLIST = 221 + SYS_GETDIRENTRIESATTR = 222 + SYS_EXCHANGEDATA = 223 + SYS_SEARCHFS = 225 + SYS_DELETE = 226 + SYS_COPYFILE = 227 + SYS_FGETATTRLIST = 228 + SYS_FSETATTRLIST = 229 + SYS_POLL = 230 + SYS_WATCHEVENT = 231 + SYS_WAITEVENT = 232 + SYS_MODWATCH = 233 + SYS_GETXATTR = 234 + SYS_FGETXATTR = 235 + SYS_SETXATTR = 236 + SYS_FSETXATTR = 237 + SYS_REMOVEXATTR = 238 + SYS_FREMOVEXATTR = 239 + SYS_LISTXATTR = 240 + SYS_FLISTXATTR = 241 + SYS_FSCTL = 242 + SYS_INITGROUPS = 243 + SYS_POSIX_SPAWN = 244 + SYS_FFSCTL = 245 + SYS_NFSCLNT = 247 + SYS_FHOPEN = 248 + SYS_MINHERIT = 250 + SYS_SEMSYS = 251 + SYS_MSGSYS = 252 + SYS_SHMSYS = 253 + SYS_SEMCTL = 254 + SYS_SEMGET = 255 + SYS_SEMOP = 256 + SYS_MSGCTL = 258 + SYS_MSGGET = 259 + SYS_MSGSND = 260 + SYS_MSGRCV = 261 + SYS_SHMAT = 262 + SYS_SHMCTL = 263 + SYS_SHMDT = 264 + SYS_SHMGET = 265 + SYS_SHM_OPEN = 266 + SYS_SHM_UNLINK = 267 + SYS_SEM_OPEN = 268 + SYS_SEM_CLOSE = 269 + SYS_SEM_UNLINK = 270 + SYS_SEM_WAIT = 271 + SYS_SEM_TRYWAIT = 272 + SYS_SEM_POST = 273 + SYS_SEM_GETVALUE = 274 + SYS_SEM_INIT = 275 + SYS_SEM_DESTROY = 276 + SYS_OPEN_EXTENDED = 277 + SYS_UMASK_EXTENDED = 278 + SYS_STAT_EXTENDED = 279 + SYS_LSTAT_EXTENDED = 280 + SYS_FSTAT_EXTENDED = 281 + SYS_CHMOD_EXTENDED = 282 + SYS_FCHMOD_EXTENDED = 283 + SYS_ACCESS_EXTENDED = 284 + SYS_SETTID = 285 + SYS_GETTID = 286 + SYS_SETSGROUPS = 287 + SYS_GETSGROUPS = 288 + SYS_SETWGROUPS = 289 + SYS_GETWGROUPS = 290 + SYS_MKFIFO_EXTENDED = 291 + SYS_MKDIR_EXTENDED = 292 + SYS_IDENTITYSVC = 293 + SYS_SHARED_REGION_CHECK_NP = 294 + SYS_SHARED_REGION_MAP_NP = 295 + SYS_VM_PRESSURE_MONITOR = 296 + SYS_PSYNCH_RW_LONGRDLOCK = 297 + SYS_PSYNCH_RW_YIELDWRLOCK = 298 + SYS_PSYNCH_RW_DOWNGRADE = 299 + SYS_PSYNCH_RW_UPGRADE = 300 + SYS_PSYNCH_MUTEXWAIT = 301 + SYS_PSYNCH_MUTEXDROP = 302 + SYS_PSYNCH_CVBROAD = 303 + SYS_PSYNCH_CVSIGNAL = 304 + SYS_PSYNCH_CVWAIT = 305 + SYS_PSYNCH_RW_RDLOCK = 306 + SYS_PSYNCH_RW_WRLOCK = 307 + SYS_PSYNCH_RW_UNLOCK = 308 + SYS_PSYNCH_RW_UNLOCK2 = 309 + SYS_GETSID = 310 + SYS_SETTID_WITH_PID = 311 + SYS_AIO_FSYNC = 313 + SYS_AIO_RETURN = 314 + SYS_AIO_SUSPEND = 315 + SYS_AIO_CANCEL = 316 + SYS_AIO_ERROR = 317 + SYS_AIO_READ = 318 + SYS_AIO_WRITE = 319 + SYS_LIO_LISTIO = 320 + SYS_IOPOLICYSYS = 322 + SYS_MLOCKALL = 324 + SYS_MUNLOCKALL = 325 + SYS_ISSETUGID = 327 + SYS___PTHREAD_KILL = 328 + SYS___PTHREAD_SIGMASK = 329 + SYS___SIGWAIT = 330 + SYS___DISABLE_THREADSIGNAL = 331 + SYS___PTHREAD_MARKCANCEL = 332 + SYS___PTHREAD_CANCELED = 333 + SYS___SEMWAIT_SIGNAL = 334 + SYS_PROC_INFO = 336 + SYS_SENDFILE = 337 + SYS_STAT64 = 338 + SYS_FSTAT64 = 339 + SYS_LSTAT64 = 340 + SYS_STAT64_EXTENDED = 341 + SYS_LSTAT64_EXTENDED = 342 + SYS_FSTAT64_EXTENDED = 343 + SYS_GETDIRENTRIES64 = 344 + SYS_STATFS64 = 345 + SYS_FSTATFS64 = 346 + SYS_GETFSSTAT64 = 347 + SYS___PTHREAD_CHDIR = 348 + SYS___PTHREAD_FCHDIR = 349 + SYS_AUDIT = 350 + SYS_AUDITON = 351 + SYS_GETAUID = 353 + SYS_SETAUID = 354 + SYS_GETAUDIT = 355 + SYS_SETAUDIT = 356 + SYS_GETAUDIT_ADDR = 357 + SYS_SETAUDIT_ADDR = 358 + SYS_AUDITCTL = 359 + SYS_BSDTHREAD_CREATE = 360 + SYS_BSDTHREAD_TERMINATE = 361 + SYS_KQUEUE = 362 + SYS_KEVENT = 363 + SYS_LCHOWN = 364 + SYS_STACK_SNAPSHOT = 365 + SYS_BSDTHREAD_REGISTER = 366 + SYS_WORKQ_OPEN = 367 + SYS_WORKQ_KERNRETURN = 368 + SYS_KEVENT64 = 369 + SYS___OLD_SEMWAIT_SIGNAL = 370 + SYS___OLD_SEMWAIT_SIGNAL_NOCANCEL = 371 + SYS_THREAD_SELFID = 372 + SYS___MAC_EXECVE = 380 + SYS___MAC_SYSCALL = 381 + SYS___MAC_GET_FILE = 382 + SYS___MAC_SET_FILE = 383 + SYS___MAC_GET_LINK = 384 + SYS___MAC_SET_LINK = 385 + SYS___MAC_GET_PROC = 386 + SYS___MAC_SET_PROC = 387 + SYS___MAC_GET_FD = 388 + SYS___MAC_SET_FD = 389 + SYS___MAC_GET_PID = 390 + SYS___MAC_GET_LCID = 391 + SYS___MAC_GET_LCTX = 392 + SYS___MAC_SET_LCTX = 393 + SYS_SETLCID = 394 + SYS_GETLCID = 395 + SYS_READ_NOCANCEL = 396 + SYS_WRITE_NOCANCEL = 397 + SYS_OPEN_NOCANCEL = 398 + SYS_CLOSE_NOCANCEL = 399 + SYS_WAIT4_NOCANCEL = 400 + SYS_RECVMSG_NOCANCEL = 401 + SYS_SENDMSG_NOCANCEL = 402 + SYS_RECVFROM_NOCANCEL = 403 + SYS_ACCEPT_NOCANCEL = 404 + SYS_MSYNC_NOCANCEL = 405 + SYS_FCNTL_NOCANCEL = 406 + SYS_SELECT_NOCANCEL = 407 + SYS_FSYNC_NOCANCEL = 408 + SYS_CONNECT_NOCANCEL = 409 + SYS_SIGSUSPEND_NOCANCEL = 410 + SYS_READV_NOCANCEL = 411 + SYS_WRITEV_NOCANCEL = 412 + SYS_SENDTO_NOCANCEL = 413 + SYS_PREAD_NOCANCEL = 414 + SYS_PWRITE_NOCANCEL = 415 + SYS_WAITID_NOCANCEL = 416 + SYS_POLL_NOCANCEL = 417 + SYS_MSGSND_NOCANCEL = 418 + SYS_MSGRCV_NOCANCEL = 419 + SYS_SEM_WAIT_NOCANCEL = 420 + SYS_AIO_SUSPEND_NOCANCEL = 421 + SYS___SIGWAIT_NOCANCEL = 422 + SYS___SEMWAIT_SIGNAL_NOCANCEL = 423 + SYS___MAC_MOUNT = 424 + SYS___MAC_GET_MOUNT = 425 + SYS___MAC_GETFSSTAT = 426 + SYS_FSGETPATH = 427 + SYS_AUDIT_SESSION_SELF = 428 + SYS_AUDIT_SESSION_JOIN = 429 + SYS_PID_SUSPEND = 430 + SYS_PID_RESUME = 431 + SYS_FILEPORT_MAKEPORT = 432 + SYS_FILEPORT_MAKEFD = 433 + SYS_MAXSYSCALL = 434 ) diff --git a/src/pkg/syscall/zsysnum_windows_amd64.go b/src/pkg/syscall/zsysnum_windows_amd64.go new file mode 100644 index 000000000..36bf065d1 --- /dev/null +++ b/src/pkg/syscall/zsysnum_windows_amd64.go @@ -0,0 +1,3 @@ +// nothing to see here + +package syscall diff --git a/src/pkg/syscall/ztypes_linux_386.go b/src/pkg/syscall/ztypes_linux_386.go index 65c8b87db..252fbff74 100644 --- a/src/pkg/syscall/ztypes_linux_386.go +++ b/src/pkg/syscall/ztypes_linux_386.go @@ -100,6 +100,8 @@ const ( SizeofIfAddrmsg = 0x8 SizeofRtmsg = 0xc SizeofRtNexthop = 0x8 + SizeofSockFilter = 0x8 + SizeofSockFprog = 0x8 SizeofInotifyEvent = 0x10 ) @@ -400,6 +402,19 @@ type RtNexthop struct { Ifindex int32 } +type SockFilter struct { + Code uint16 + Jt uint8 + Jf uint8 + K uint32 +} + +type SockFprog struct { + Len uint16 + Pad_godefs_0 [2]byte + Filter *SockFilter +} + type InotifyEvent struct { Wd int32 Mask uint32 diff --git a/src/pkg/syscall/ztypes_linux_amd64.go b/src/pkg/syscall/ztypes_linux_amd64.go index e26b6bfd2..520ba963a 100644 --- a/src/pkg/syscall/ztypes_linux_amd64.go +++ b/src/pkg/syscall/ztypes_linux_amd64.go @@ -100,6 +100,8 @@ const ( SizeofIfAddrmsg = 0x8 SizeofRtmsg = 0xc SizeofRtNexthop = 0x8 + SizeofSockFilter = 0x8 + SizeofSockFprog = 0x10 SizeofInotifyEvent = 0x10 ) @@ -402,6 +404,19 @@ type RtNexthop struct { Ifindex int32 } +type SockFilter struct { + Code uint16 + Jt uint8 + Jf uint8 + K uint32 +} + +type SockFprog struct { + Len uint16 + Pad_godefs_0 [6]byte + Filter *SockFilter +} + type InotifyEvent struct { Wd int32 Mask uint32 diff --git a/src/pkg/syscall/ztypes_linux_arm.go b/src/pkg/syscall/ztypes_linux_arm.go index ebd5379cb..2421df081 100644 --- a/src/pkg/syscall/ztypes_linux_arm.go +++ b/src/pkg/syscall/ztypes_linux_arm.go @@ -105,6 +105,8 @@ const ( SizeofIfAddrmsg = 0x8 SizeofRtmsg = 0xc SizeofRtNexthop = 0x8 + SizeofSockFilter = 0x8 + SizeofSockFprog = 0x8 SizeofInotifyEvent = 0x10 ) @@ -407,6 +409,19 @@ type RtNexthop struct { Ifindex int32 } +type SockFilter struct { + Code uint16 + Jt uint8 + Jf uint8 + K uint32 +} + +type SockFprog struct { + Len uint16 + Pad_godefs_0 [2]byte + Filter *SockFilter +} + type InotifyEvent struct { Wd int32 Mask uint32 diff --git a/src/pkg/syscall/ztypes_plan9_386.go b/src/pkg/syscall/ztypes_plan9_386.go index 8f823ba65..3e3a8d1f3 100644 --- a/src/pkg/syscall/ztypes_plan9_386.go +++ b/src/pkg/syscall/ztypes_plan9_386.go @@ -9,6 +9,7 @@ const ( O_RDONLY = 0 O_WRONLY = 0x1 O_RDWR = 0x2 + O_TRUNC = 0x10 O_CLOEXEC = 0x20 O_EXCL = 0x1000 STATMAX = 0xffff diff --git a/src/pkg/syscall/ztypes_windows.go b/src/pkg/syscall/ztypes_windows.go new file mode 100644 index 000000000..1a264a405 --- /dev/null +++ b/src/pkg/syscall/ztypes_windows.go @@ -0,0 +1,656 @@ +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 + ERROR_PATH_NOT_FOUND = 3 + ERROR_NO_MORE_FILES = 18 + ERROR_BROKEN_PIPE = 109 + ERROR_BUFFER_OVERFLOW = 111 + ERROR_INSUFFICIENT_BUFFER = 122 + ERROR_MOD_NOT_FOUND = 126 + ERROR_PROC_NOT_FOUND = 127 + ERROR_ENVVAR_NOT_FOUND = 203 + ERROR_DIRECTORY = 267 + ERROR_OPERATION_ABORTED = 995 + ERROR_IO_PENDING = 997 +) + +const ( + // Invented values to support what package os expects. + O_RDONLY = 0x00000 + O_WRONLY = 0x00001 + O_RDWR = 0x00002 + O_CREAT = 0x00040 + O_EXCL = 0x00080 + O_NOCTTY = 0x00100 + O_TRUNC = 0x00200 + O_NONBLOCK = 0x00800 + O_APPEND = 0x00400 + O_SYNC = 0x01000 + O_ASYNC = 0x02000 + O_CLOEXEC = 0x80000 +) + +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 +) + +const ( + GENERIC_READ = 0x80000000 + GENERIC_WRITE = 0x40000000 + GENERIC_EXECUTE = 0x20000000 + GENERIC_ALL = 0x10000000 + + FILE_APPEND_DATA = 0x00000004 + FILE_WRITE_ATTRIBUTES = 0x00000100 + + FILE_SHARE_READ = 0x00000001 + FILE_SHARE_WRITE = 0x00000002 + FILE_SHARE_DELETE = 0x00000004 + FILE_ATTRIBUTE_READONLY = 0x00000001 + FILE_ATTRIBUTE_HIDDEN = 0x00000002 + FILE_ATTRIBUTE_SYSTEM = 0x00000004 + FILE_ATTRIBUTE_DIRECTORY = 0x00000010 + FILE_ATTRIBUTE_ARCHIVE = 0x00000020 + FILE_ATTRIBUTE_NORMAL = 0x00000080 + + INVALID_FILE_ATTRIBUTES = 0xffffffff + + CREATE_NEW = 1 + CREATE_ALWAYS = 2 + OPEN_EXISTING = 3 + OPEN_ALWAYS = 4 + TRUNCATE_EXISTING = 5 + + HANDLE_FLAG_INHERIT = 0x00000001 + STARTF_USESTDHANDLES = 0x00000100 + STARTF_USESHOWWINDOW = 0x00000001 + DUPLICATE_CLOSE_SOURCE = 0x00000001 + DUPLICATE_SAME_ACCESS = 0x00000002 + + STD_INPUT_HANDLE = -10 + STD_OUTPUT_HANDLE = -11 + STD_ERROR_HANDLE = -12 + + FILE_BEGIN = 0 + FILE_CURRENT = 1 + FILE_END = 2 + + FORMAT_MESSAGE_ALLOCATE_BUFFER = 256 + FORMAT_MESSAGE_IGNORE_INSERTS = 512 + FORMAT_MESSAGE_FROM_STRING = 1024 + FORMAT_MESSAGE_FROM_HMODULE = 2048 + FORMAT_MESSAGE_FROM_SYSTEM = 4096 + FORMAT_MESSAGE_ARGUMENT_ARRAY = 8192 + FORMAT_MESSAGE_MAX_WIDTH_MASK = 255 + + MAX_PATH = 260 + MAX_LONG_PATH = 32768 + + MAX_COMPUTERNAME_LENGTH = 15 + + TIME_ZONE_ID_UNKNOWN = 0 + TIME_ZONE_ID_STANDARD = 1 + + TIME_ZONE_ID_DAYLIGHT = 2 + IGNORE = 0 + INFINITE = 0xffffffff + + WAIT_TIMEOUT = 258 + WAIT_ABANDONED = 0x00000080 + WAIT_OBJECT_0 = 0x00000000 + WAIT_FAILED = 0xFFFFFFFF + + CREATE_UNICODE_ENVIRONMENT = 0x00000400 + + STANDARD_RIGHTS_READ = 0x00020000 + PROCESS_QUERY_INFORMATION = 0x00000400 + SYNCHRONIZE = 0x00100000 + + PAGE_READONLY = 0x02 + PAGE_READWRITE = 0x04 + PAGE_WRITECOPY = 0x08 + PAGE_EXECUTE_READ = 0x20 + PAGE_EXECUTE_READWRITE = 0x40 + PAGE_EXECUTE_WRITECOPY = 0x80 + + FILE_MAP_COPY = 0x01 + FILE_MAP_WRITE = 0x02 + FILE_MAP_READ = 0x04 + FILE_MAP_EXECUTE = 0x20 +) + +const ( + // wincrypt.h + PROV_RSA_FULL = 1 + PROV_RSA_SIG = 2 + PROV_DSS = 3 + PROV_FORTEZZA = 4 + PROV_MS_EXCHANGE = 5 + PROV_SSL = 6 + PROV_RSA_SCHANNEL = 12 + PROV_DSS_DH = 13 + PROV_EC_ECDSA_SIG = 14 + PROV_EC_ECNRA_SIG = 15 + PROV_EC_ECDSA_FULL = 16 + PROV_EC_ECNRA_FULL = 17 + PROV_DH_SCHANNEL = 18 + PROV_SPYRUS_LYNKS = 20 + PROV_RNG = 21 + PROV_INTEL_SEC = 22 + PROV_REPLACE_OWF = 23 + PROV_RSA_AES = 24 + CRYPT_VERIFYCONTEXT = 0xF0000000 + CRYPT_NEWKEYSET = 0x00000008 + CRYPT_DELETEKEYSET = 0x00000010 + CRYPT_MACHINE_KEYSET = 0x00000020 + CRYPT_SILENT = 0x00000040 + 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 + Usec int32 +} + +func (tv *Timeval) Nanoseconds() int64 { + return (int64(tv.Sec)*1e6 + int64(tv.Usec)) * 1e3 +} + +func NsecToTimeval(nsec int64) (tv Timeval) { + tv.Sec = int32(nsec / 1e9) + tv.Usec = int32(nsec % 1e9 / 1e3) + return +} + +type SecurityAttributes struct { + Length uint32 + SecurityDescriptor uintptr + InheritHandle uint32 +} + +type Overlapped struct { + Internal uint32 + InternalHigh uint32 + Offset uint32 + OffsetHigh uint32 + HEvent Handle +} + +type Filetime struct { + LowDateTime uint32 + HighDateTime uint32 +} + +func (ft *Filetime) Nanoseconds() int64 { + // 100-nanosecond intervals since January 1, 1601 + nsec := int64(ft.HighDateTime)<<32 + int64(ft.LowDateTime) + // change starting time to the Epoch (00:00:00 UTC, January 1, 1970) + nsec -= 116444736000000000 + // convert into nanoseconds + nsec *= 100 + return nsec +} + +func NsecToFiletime(nsec int64) (ft Filetime) { + // convert into 100-nanosecond + nsec /= 100 + // change starting time to January 1, 1601 + nsec += 116444736000000000 + // split into high / low + ft.LowDateTime = uint32(nsec & 0xffffffff) + ft.HighDateTime = uint32(nsec >> 32 & 0xffffffff) + return ft +} + +type Win32finddata struct { + FileAttributes uint32 + CreationTime Filetime + LastAccessTime Filetime + LastWriteTime Filetime + FileSizeHigh uint32 + FileSizeLow uint32 + Reserved0 uint32 + Reserved1 uint32 + FileName [MAX_PATH - 1]uint16 + AlternateFileName [13]uint16 +} + +type ByHandleFileInformation struct { + FileAttributes uint32 + CreationTime Filetime + LastAccessTime Filetime + LastWriteTime Filetime + VolumeSerialNumber uint32 + FileSizeHigh uint32 + FileSizeLow uint32 + NumberOfLinks uint32 + FileIndexHigh uint32 + FileIndexLow uint32 +} + +// ShowWindow constants +const ( + // winuser.h + SW_HIDE = 0 + SW_NORMAL = 1 + SW_SHOWNORMAL = 1 + SW_SHOWMINIMIZED = 2 + SW_SHOWMAXIMIZED = 3 + SW_MAXIMIZE = 3 + SW_SHOWNOACTIVATE = 4 + SW_SHOW = 5 + SW_MINIMIZE = 6 + SW_SHOWMINNOACTIVE = 7 + SW_SHOWNA = 8 + SW_RESTORE = 9 + SW_SHOWDEFAULT = 10 + SW_FORCEMINIMIZE = 11 +) + +type StartupInfo struct { + Cb uint32 + _ *uint16 + Desktop *uint16 + Title *uint16 + X uint32 + Y uint32 + XSize uint32 + YSize uint32 + XCountChars uint32 + YCountChars uint32 + FillAttribute uint32 + Flags uint32 + ShowWindow uint16 + _ uint16 + _ *byte + StdInput Handle + StdOutput Handle + StdErr Handle +} + +type ProcessInformation struct { + Process Handle + Thread Handle + ProcessId uint32 + ThreadId uint32 +} + +// Invented values to support what package os expects. +type Stat_t struct { + Windata Win32finddata + Mode uint32 +} + +type Systemtime struct { + Year uint16 + Month uint16 + DayOfWeek uint16 + Day uint16 + Hour uint16 + Minute uint16 + Second uint16 + Milliseconds uint16 +} + +type Timezoneinformation struct { + Bias int32 + StandardName [32]uint16 + StandardDate Systemtime + StandardBias int32 + DaylightName [32]uint16 + DaylightDate Systemtime + DaylightBias int32 +} + +// Socket related. + +const ( + AF_UNSPEC = 0 + AF_UNIX = 1 + AF_INET = 2 + AF_INET6 = 23 + AF_NETBIOS = 17 + + SOCK_STREAM = 1 + SOCK_DGRAM = 2 + SOCK_RAW = 3 + SOCK_SEQPACKET = 5 + + IPPROTO_IP = 0 + IPPROTO_TCP = 6 + IPPROTO_UDP = 17 + + SOL_SOCKET = 0xffff + SO_REUSEADDR = 4 + SO_KEEPALIVE = 8 + SO_DONTROUTE = 16 + SO_BROADCAST = 32 + SO_LINGER = 128 + SO_RCVBUF = 0x1002 + SO_SNDBUF = 0x1001 + SO_UPDATE_ACCEPT_CONTEXT = 0x700b + + IPPROTO_IPV6 = 0x29 + IPV6_V6ONLY = 0x1b + + SOMAXCONN = 5 + + TCP_NODELAY = 1 + + SHUT_RD = 0 + SHUT_WR = 1 + SHUT_RDWR = 2 + + WSADESCRIPTION_LEN = 256 + WSASYS_STATUS_LEN = 128 +) + +type WSAData struct { + Version uint16 + HighVersion uint16 + Description [WSADESCRIPTION_LEN + 1]byte + SystemStatus [WSASYS_STATUS_LEN + 1]byte + MaxSockets uint16 + MaxUdpDg uint16 + VendorInfo *byte +} + +type WSABuf struct { + Len uint32 + Buf *byte +} + +// TODO(brainman): fix all needed for os + +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 +) + +const ( + FILE_TYPE_CHAR = 0x0002 + FILE_TYPE_DISK = 0x0001 + FILE_TYPE_PIPE = 0x0003 + FILE_TYPE_REMOTE = 0x8000 + FILE_TYPE_UNKNOWN = 0x0000 +) + +type Hostent struct { + Name *byte + Aliases **byte + AddrType uint16 + Length uint16 + AddrList **byte +} + +type Servent struct { + Name *byte + Aliases **byte + Port uint16 + Proto *byte +} + +const ( + DNS_TYPE_A = 0x0001 + DNS_TYPE_NS = 0x0002 + DNS_TYPE_MD = 0x0003 + DNS_TYPE_MF = 0x0004 + DNS_TYPE_CNAME = 0x0005 + DNS_TYPE_SOA = 0x0006 + DNS_TYPE_MB = 0x0007 + DNS_TYPE_MG = 0x0008 + DNS_TYPE_MR = 0x0009 + DNS_TYPE_NULL = 0x000a + DNS_TYPE_WKS = 0x000b + DNS_TYPE_PTR = 0x000c + DNS_TYPE_HINFO = 0x000d + DNS_TYPE_MINFO = 0x000e + DNS_TYPE_MX = 0x000f + DNS_TYPE_TEXT = 0x0010 + DNS_TYPE_RP = 0x0011 + DNS_TYPE_AFSDB = 0x0012 + DNS_TYPE_X25 = 0x0013 + DNS_TYPE_ISDN = 0x0014 + DNS_TYPE_RT = 0x0015 + DNS_TYPE_NSAP = 0x0016 + DNS_TYPE_NSAPPTR = 0x0017 + DNS_TYPE_SIG = 0x0018 + DNS_TYPE_KEY = 0x0019 + DNS_TYPE_PX = 0x001a + DNS_TYPE_GPOS = 0x001b + DNS_TYPE_AAAA = 0x001c + DNS_TYPE_LOC = 0x001d + DNS_TYPE_NXT = 0x001e + DNS_TYPE_EID = 0x001f + DNS_TYPE_NIMLOC = 0x0020 + DNS_TYPE_SRV = 0x0021 + DNS_TYPE_ATMA = 0x0022 + DNS_TYPE_NAPTR = 0x0023 + DNS_TYPE_KX = 0x0024 + DNS_TYPE_CERT = 0x0025 + DNS_TYPE_A6 = 0x0026 + DNS_TYPE_DNAME = 0x0027 + DNS_TYPE_SINK = 0x0028 + DNS_TYPE_OPT = 0x0029 + DNS_TYPE_DS = 0x002B + DNS_TYPE_RRSIG = 0x002E + DNS_TYPE_NSEC = 0x002F + DNS_TYPE_DNSKEY = 0x0030 + DNS_TYPE_DHCID = 0x0031 + DNS_TYPE_UINFO = 0x0064 + DNS_TYPE_UID = 0x0065 + DNS_TYPE_GID = 0x0066 + DNS_TYPE_UNSPEC = 0x0067 + DNS_TYPE_ADDRS = 0x00f8 + DNS_TYPE_TKEY = 0x00f9 + DNS_TYPE_TSIG = 0x00fa + DNS_TYPE_IXFR = 0x00fb + DNS_TYPE_AXFR = 0x00fc + DNS_TYPE_MAILB = 0x00fd + DNS_TYPE_MAILA = 0x00fe + DNS_TYPE_ALL = 0x00ff + DNS_TYPE_ANY = 0x00ff + DNS_TYPE_WINS = 0xff01 + DNS_TYPE_WINSR = 0xff02 + DNS_TYPE_NBSTAT = 0xff01 +) + +type DNSSRVData struct { + Target *uint16 + Priority uint16 + Weight uint16 + Port uint16 + Pad uint16 +} + +type DNSPTRData struct { + Host *uint16 +} + +type DNSRecord struct { + Next *DNSRecord + Name *uint16 + Type uint16 + Length uint16 + Dw uint32 + Ttl uint32 + Reserved uint32 + Data [40]byte +} + +const ( + TF_DISCONNECT = 1 + TF_REUSE_SOCKET = 2 + TF_WRITE_BEHIND = 4 + TF_USE_DEFAULT_WORKER = 0 + TF_USE_SYSTEM_THREAD = 16 + TF_USE_KERNEL_APC = 32 +) + +type TransmitFileBuffers struct { + Head uintptr + HeadLength uint32 + Tail uintptr + TailLength uint32 +} + +const ( + IFF_UP = 1 + IFF_BROADCAST = 2 + IFF_LOOPBACK = 4 + IFF_POINTTOPOINT = 8 + IFF_MULTICAST = 16 +) + +const SIO_GET_INTERFACE_LIST = 0x4004747F + +// TODO(mattn): SockaddrGen is union of sockaddr/sockaddr_in/sockaddr_in6_old. +// will be fixed to change variable type as suitable. + +type SockaddrGen [24]byte + +type InterfaceInfo struct { + Flags uint32 + Address SockaddrGen + BroadcastAddress SockaddrGen + Netmask SockaddrGen +} + +type IpAddressString struct { + String [16]byte +} + +type IpMaskString IpAddressString + +type IpAddrString struct { + Next *IpAddrString + IpAddress IpAddressString + IpMask IpMaskString + Context uint32 +} + +const MAX_ADAPTER_NAME_LENGTH = 256 +const MAX_ADAPTER_DESCRIPTION_LENGTH = 128 +const MAX_ADAPTER_ADDRESS_LENGTH = 8 + +type IpAdapterInfo struct { + Next *IpAdapterInfo + ComboIndex uint32 + AdapterName [MAX_ADAPTER_NAME_LENGTH + 4]byte + Description [MAX_ADAPTER_DESCRIPTION_LENGTH + 4]byte + AddressLength uint32 + Address [MAX_ADAPTER_ADDRESS_LENGTH]byte + Index uint32 + Type uint32 + DhcpEnabled uint32 + CurrentIpAddress *IpAddrString + IpAddressList IpAddrString + GatewayList IpAddrString + DhcpServer IpAddrString + HaveWins bool + PrimaryWinsServer IpAddrString + SecondaryWinsServer IpAddrString + LeaseObtained int64 + LeaseExpires int64 +} + +const MAXLEN_PHYSADDR = 8 +const MAX_INTERFACE_NAME_LEN = 256 +const MAXLEN_IFDESCR = 256 + +type MibIfRow struct { + Name [MAX_INTERFACE_NAME_LEN]uint16 + Index uint32 + Type uint32 + Mtu uint32 + Speed uint32 + PhysAddrLen uint32 + PhysAddr [MAXLEN_PHYSADDR]byte + AdminStatus uint32 + OperStatus uint32 + LastChange uint32 + InOctets uint32 + InUcastPkts uint32 + InNUcastPkts uint32 + InDiscards uint32 + InErrors uint32 + InUnknownProtos uint32 + OutOctets uint32 + OutUcastPkts uint32 + OutNUcastPkts uint32 + OutDiscards uint32 + OutErrors uint32 + OutQLen uint32 + DescrLen uint32 + Descr [MAXLEN_IFDESCR]byte +} diff --git a/src/pkg/syscall/ztypes_windows_386.go b/src/pkg/syscall/ztypes_windows_386.go index b04fea576..d1008bd03 100644 --- a/src/pkg/syscall/ztypes_windows_386.go +++ b/src/pkg/syscall/ztypes_windows_386.go @@ -1,547 +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 - ERROR_PATH_NOT_FOUND = 3 - ERROR_NO_MORE_FILES = 18 - ERROR_BROKEN_PIPE = 109 - ERROR_INSUFFICIENT_BUFFER = 122 - ERROR_MOD_NOT_FOUND = 126 - ERROR_PROC_NOT_FOUND = 127 - ERROR_ENVVAR_NOT_FOUND = 203 - ERROR_DIRECTORY = 267 - ERROR_OPERATION_ABORTED = 995 - ERROR_IO_PENDING = 997 -) - -const ( - // Invented values to support what package os expects. - O_RDONLY = 0x00000 - O_WRONLY = 0x00001 - O_RDWR = 0x00002 - O_CREAT = 0x00040 - O_EXCL = 0x00080 - O_NOCTTY = 0x00100 - O_TRUNC = 0x00200 - O_NONBLOCK = 0x00800 - O_APPEND = 0x00400 - O_SYNC = 0x01000 - O_ASYNC = 0x02000 - O_CLOEXEC = 0x80000 -) - -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 -) - -const ( - GENERIC_READ = 0x80000000 - GENERIC_WRITE = 0x40000000 - GENERIC_EXECUTE = 0x20000000 - GENERIC_ALL = 0x10000000 - - FILE_APPEND_DATA = 0x00000004 - FILE_WRITE_ATTRIBUTES = 0x00000100 - - FILE_SHARE_READ = 0x00000001 - FILE_SHARE_WRITE = 0x00000002 - FILE_SHARE_DELETE = 0x00000004 - FILE_ATTRIBUTE_READONLY = 0x00000001 - FILE_ATTRIBUTE_HIDDEN = 0x00000002 - FILE_ATTRIBUTE_SYSTEM = 0x00000004 - FILE_ATTRIBUTE_DIRECTORY = 0x00000010 - FILE_ATTRIBUTE_ARCHIVE = 0x00000020 - FILE_ATTRIBUTE_NORMAL = 0x00000080 - - INVALID_FILE_ATTRIBUTES = 0xffffffff - - CREATE_NEW = 1 - CREATE_ALWAYS = 2 - OPEN_EXISTING = 3 - OPEN_ALWAYS = 4 - TRUNCATE_EXISTING = 5 - - HANDLE_FLAG_INHERIT = 0x00000001 - STARTF_USESTDHANDLES = 0x00000100 - STARTF_USESHOWWINDOW = 0x00000001 - DUPLICATE_CLOSE_SOURCE = 0x00000001 - DUPLICATE_SAME_ACCESS = 0x00000002 - - STD_INPUT_HANDLE = -10 - STD_OUTPUT_HANDLE = -11 - STD_ERROR_HANDLE = -12 - - FILE_BEGIN = 0 - FILE_CURRENT = 1 - FILE_END = 2 - - FORMAT_MESSAGE_ALLOCATE_BUFFER = 256 - FORMAT_MESSAGE_IGNORE_INSERTS = 512 - FORMAT_MESSAGE_FROM_STRING = 1024 - FORMAT_MESSAGE_FROM_HMODULE = 2048 - FORMAT_MESSAGE_FROM_SYSTEM = 4096 - FORMAT_MESSAGE_ARGUMENT_ARRAY = 8192 - FORMAT_MESSAGE_MAX_WIDTH_MASK = 255 - - MAX_PATH = 260 - MAX_LONG_PATH = 32768 - - MAX_COMPUTERNAME_LENGTH = 15 - - TIME_ZONE_ID_UNKNOWN = 0 - TIME_ZONE_ID_STANDARD = 1 - - TIME_ZONE_ID_DAYLIGHT = 2 - IGNORE = 0 - INFINITE = 0xffffffff - - WAIT_TIMEOUT = 258 - WAIT_ABANDONED = 0x00000080 - WAIT_OBJECT_0 = 0x00000000 - WAIT_FAILED = 0xFFFFFFFF - - CREATE_UNICODE_ENVIRONMENT = 0x00000400 - - STANDARD_RIGHTS_READ = 0x00020000 - PROCESS_QUERY_INFORMATION = 0x00000400 - SYNCHRONIZE = 0x00100000 - - PAGE_READONLY = 0x02 - PAGE_READWRITE = 0x04 - PAGE_WRITECOPY = 0x08 - PAGE_EXECUTE_READ = 0x20 - PAGE_EXECUTE_READWRITE = 0x40 - PAGE_EXECUTE_WRITECOPY = 0x80 - - FILE_MAP_COPY = 0x01 - FILE_MAP_WRITE = 0x02 - FILE_MAP_READ = 0x04 - FILE_MAP_EXECUTE = 0x20 -) - -const ( - // wincrypt.h - PROV_RSA_FULL = 1 - PROV_RSA_SIG = 2 - PROV_DSS = 3 - PROV_FORTEZZA = 4 - PROV_MS_EXCHANGE = 5 - PROV_SSL = 6 - PROV_RSA_SCHANNEL = 12 - PROV_DSS_DH = 13 - PROV_EC_ECDSA_SIG = 14 - PROV_EC_ECNRA_SIG = 15 - PROV_EC_ECDSA_FULL = 16 - PROV_EC_ECNRA_FULL = 17 - PROV_DH_SCHANNEL = 18 - PROV_SPYRUS_LYNKS = 20 - PROV_RNG = 21 - PROV_INTEL_SEC = 22 - PROV_REPLACE_OWF = 23 - PROV_RSA_AES = 24 - CRYPT_VERIFYCONTEXT = 0xF0000000 - CRYPT_NEWKEYSET = 0x00000008 - CRYPT_DELETEKEYSET = 0x00000010 - CRYPT_MACHINE_KEYSET = 0x00000020 - CRYPT_SILENT = 0x00000040 - 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 - Usec int32 -} - -func (tv *Timeval) Nanoseconds() int64 { - return (int64(tv.Sec)*1e6 + int64(tv.Usec)) * 1e3 -} - -func NsecToTimeval(nsec int64) (tv Timeval) { - tv.Sec = int32(nsec / 1e9) - tv.Usec = int32(nsec % 1e9 / 1e3) - return -} +// Copyright 2011 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. -type SecurityAttributes struct { - Length uint32 - SecurityDescriptor uintptr - InheritHandle uint32 -} - -type Overlapped struct { - Internal uint32 - InternalHigh uint32 - Offset uint32 - OffsetHigh uint32 - HEvent int32 -} - -type Filetime struct { - LowDateTime uint32 - HighDateTime uint32 -} - -func (ft *Filetime) Nanoseconds() int64 { - // 100-nanosecond intervals since January 1, 1601 - nsec := int64(ft.HighDateTime)<<32 + int64(ft.LowDateTime) - // change starting time to the Epoch (00:00:00 UTC, January 1, 1970) - nsec -= 116444736000000000 - // convert into nanoseconds - nsec *= 100 - return nsec -} - -func NsecToFiletime(nsec int64) (ft Filetime) { - // convert into 100-nanosecond - nsec /= 100 - // change starting time to January 1, 1601 - nsec += 116444736000000000 - // split into high / low - ft.LowDateTime = uint32(nsec & 0xffffffff) - ft.HighDateTime = uint32(nsec >> 32 & 0xffffffff) - return ft -} - -type Win32finddata struct { - FileAttributes uint32 - CreationTime Filetime - LastAccessTime Filetime - LastWriteTime Filetime - FileSizeHigh uint32 - FileSizeLow uint32 - Reserved0 uint32 - Reserved1 uint32 - FileName [MAX_PATH - 1]uint16 - AlternateFileName [13]uint16 -} - -type ByHandleFileInformation struct { - FileAttributes uint32 - CreationTime Filetime - LastAccessTime Filetime - LastWriteTime Filetime - VolumeSerialNumber uint32 - FileSizeHigh uint32 - FileSizeLow uint32 - NumberOfLinks uint32 - FileIndexHigh uint32 - FileIndexLow uint32 -} - -// ShowWindow constants -const ( - // winuser.h - SW_HIDE = 0 - SW_NORMAL = 1 - SW_SHOWNORMAL = 1 - SW_SHOWMINIMIZED = 2 - SW_SHOWMAXIMIZED = 3 - SW_MAXIMIZE = 3 - SW_SHOWNOACTIVATE = 4 - SW_SHOW = 5 - SW_MINIMIZE = 6 - SW_SHOWMINNOACTIVE = 7 - SW_SHOWNA = 8 - SW_RESTORE = 9 - SW_SHOWDEFAULT = 10 - SW_FORCEMINIMIZE = 11 -) - -type StartupInfo struct { - Cb uint32 - _ *uint16 - Desktop *uint16 - Title *uint16 - X uint32 - Y uint32 - XSize uint32 - YSize uint32 - XCountChars uint32 - YCountChars uint32 - FillAttribute uint32 - Flags uint32 - ShowWindow uint16 - _ uint16 - _ *byte - StdInput int32 - StdOutput int32 - StdErr int32 -} - -type ProcessInformation struct { - Process int32 - Thread int32 - ProcessId uint32 - ThreadId uint32 -} - -// Invented values to support what package os expects. -type Stat_t struct { - Windata Win32finddata - Mode uint32 -} - -type Systemtime struct { - Year uint16 - Month uint16 - DayOfWeek uint16 - Day uint16 - Hour uint16 - Minute uint16 - Second uint16 - Milliseconds uint16 -} - -type Timezoneinformation struct { - Bias int32 - StandardName [32]uint16 - StandardDate Systemtime - StandardBias int32 - DaylightName [32]uint16 - DaylightDate Systemtime - DaylightBias int32 -} - -// Socket related. - -const ( - AF_UNIX = 1 - AF_INET = 2 - AF_INET6 = 23 - AF_NETBIOS = 17 - - SOCK_STREAM = 1 - SOCK_DGRAM = 2 - SOCK_RAW = 3 - SOCK_SEQPACKET = 5 - - IPPROTO_IP = 0 - IPPROTO_TCP = 6 - IPPROTO_UDP = 17 - - SOL_SOCKET = 0xffff - SO_REUSEADDR = 4 - SO_KEEPALIVE = 8 - SO_DONTROUTE = 16 - SO_BROADCAST = 32 - SO_LINGER = 128 - SO_RCVBUF = 0x1002 - SO_SNDBUF = 0x1001 - SO_UPDATE_ACCEPT_CONTEXT = 0x700b - - IPPROTO_IPV6 = 0x29 - IPV6_V6ONLY = 0x1b - - SOMAXCONN = 5 - - TCP_NODELAY = 1 - - SHUT_RD = 0 - SHUT_WR = 1 - SHUT_RDWR = 2 - - WSADESCRIPTION_LEN = 256 - WSASYS_STATUS_LEN = 128 -) - -type WSAData struct { - Version uint16 - HighVersion uint16 - Description [WSADESCRIPTION_LEN + 1]byte - SystemStatus [WSASYS_STATUS_LEN + 1]byte - MaxSockets uint16 - MaxUdpDg uint16 - VendorInfo *byte -} - -type WSABuf struct { - Len uint32 - Buf *byte -} - -// TODO(brainman): fix all needed for os - -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 -) - -const ( - FILE_TYPE_CHAR = 0x0002 - FILE_TYPE_DISK = 0x0001 - FILE_TYPE_PIPE = 0x0003 - FILE_TYPE_REMOTE = 0x8000 - FILE_TYPE_UNKNOWN = 0x0000 -) - -type Hostent struct { - Name *byte - Aliases **byte - AddrType uint16 - Length uint16 - AddrList **byte -} - -type Servent struct { - Name *byte - Aliases **byte - Port uint16 - Proto *byte -} - -const ( - DNS_TYPE_A = 0x0001 - DNS_TYPE_NS = 0x0002 - DNS_TYPE_MD = 0x0003 - DNS_TYPE_MF = 0x0004 - DNS_TYPE_CNAME = 0x0005 - DNS_TYPE_SOA = 0x0006 - DNS_TYPE_MB = 0x0007 - DNS_TYPE_MG = 0x0008 - DNS_TYPE_MR = 0x0009 - DNS_TYPE_NULL = 0x000a - DNS_TYPE_WKS = 0x000b - DNS_TYPE_PTR = 0x000c - DNS_TYPE_HINFO = 0x000d - DNS_TYPE_MINFO = 0x000e - DNS_TYPE_MX = 0x000f - DNS_TYPE_TEXT = 0x0010 - DNS_TYPE_RP = 0x0011 - DNS_TYPE_AFSDB = 0x0012 - DNS_TYPE_X25 = 0x0013 - DNS_TYPE_ISDN = 0x0014 - DNS_TYPE_RT = 0x0015 - DNS_TYPE_NSAP = 0x0016 - DNS_TYPE_NSAPPTR = 0x0017 - DNS_TYPE_SIG = 0x0018 - DNS_TYPE_KEY = 0x0019 - DNS_TYPE_PX = 0x001a - DNS_TYPE_GPOS = 0x001b - DNS_TYPE_AAAA = 0x001c - DNS_TYPE_LOC = 0x001d - DNS_TYPE_NXT = 0x001e - DNS_TYPE_EID = 0x001f - DNS_TYPE_NIMLOC = 0x0020 - DNS_TYPE_SRV = 0x0021 - DNS_TYPE_ATMA = 0x0022 - DNS_TYPE_NAPTR = 0x0023 - DNS_TYPE_KX = 0x0024 - DNS_TYPE_CERT = 0x0025 - DNS_TYPE_A6 = 0x0026 - DNS_TYPE_DNAME = 0x0027 - DNS_TYPE_SINK = 0x0028 - DNS_TYPE_OPT = 0x0029 - DNS_TYPE_DS = 0x002B - DNS_TYPE_RRSIG = 0x002E - DNS_TYPE_NSEC = 0x002F - DNS_TYPE_DNSKEY = 0x0030 - DNS_TYPE_DHCID = 0x0031 - DNS_TYPE_UINFO = 0x0064 - DNS_TYPE_UID = 0x0065 - DNS_TYPE_GID = 0x0066 - DNS_TYPE_UNSPEC = 0x0067 - DNS_TYPE_ADDRS = 0x00f8 - DNS_TYPE_TKEY = 0x00f9 - DNS_TYPE_TSIG = 0x00fa - DNS_TYPE_IXFR = 0x00fb - DNS_TYPE_AXFR = 0x00fc - DNS_TYPE_MAILB = 0x00fd - DNS_TYPE_MAILA = 0x00fe - DNS_TYPE_ALL = 0x00ff - DNS_TYPE_ANY = 0x00ff - DNS_TYPE_WINS = 0xff01 - DNS_TYPE_WINSR = 0xff02 - DNS_TYPE_NBSTAT = 0xff01 -) - -type DNSSRVData struct { - Target *uint16 - Priority uint16 - Weight uint16 - Port uint16 - Pad uint16 -} - -type DNSPTRData struct { - Host *uint16 -} - -type DNSRecord struct { - Next *DNSRecord - Name *uint16 - Type uint16 - Length uint16 - Dw uint32 - Ttl uint32 - Reserved uint32 - Data [40]byte -} +package syscall diff --git a/src/pkg/syscall/ztypes_windows_amd64.go b/src/pkg/syscall/ztypes_windows_amd64.go new file mode 100644 index 000000000..d1008bd03 --- /dev/null +++ b/src/pkg/syscall/ztypes_windows_amd64.go @@ -0,0 +1,5 @@ +// Copyright 2011 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 |