mirror of
https://github.com/golang/go
synced 2024-11-25 08:57:58 -07:00
syscall: make sure go error numbers do not clash with windows system errors
R=rsc CC=golang-dev https://golang.org/cl/1857049
This commit is contained in:
parent
5443bbe292
commit
a79a9098da
@ -154,7 +154,7 @@ windows_386)
|
|||||||
mksyscall="./mksyscall_windows.sh -l32"
|
mksyscall="./mksyscall_windows.sh -l32"
|
||||||
mksysnum=
|
mksysnum=
|
||||||
mktypes=
|
mktypes=
|
||||||
mkerrors=
|
mkerrors="./mkerrors_windows.sh -f -m32"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
|
echo 'unrecognized $GOOS_$GOARCH: ' "$GOOSARCH" 1>&2
|
||||||
|
165
src/pkg/syscall/mkerrors_windows.sh
Executable file
165
src/pkg/syscall/mkerrors_windows.sh
Executable file
@ -0,0 +1,165 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# 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.
|
||||||
|
|
||||||
|
# Generate Go code listing errors and other #defined constant
|
||||||
|
# values (ENAMETOOLONG etc.), by asking the preprocessor
|
||||||
|
# about the definitions.
|
||||||
|
|
||||||
|
unset LANG
|
||||||
|
export LC_ALL=C
|
||||||
|
export LC_CTYPE=C
|
||||||
|
|
||||||
|
case "$GOARCH" in
|
||||||
|
arm)
|
||||||
|
GCC=arm-gcc
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
GCC=gcc
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
uname=$(uname)
|
||||||
|
|
||||||
|
includes_Linux='
|
||||||
|
#define _LARGEFILE_SOURCE
|
||||||
|
#define _LARGEFILE64_SOURCE
|
||||||
|
#define _FILE_OFFSET_BITS 64
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/epoll.h>
|
||||||
|
#include <linux/ptrace.h>
|
||||||
|
#include <linux/wait.h>
|
||||||
|
'
|
||||||
|
|
||||||
|
includes_Darwin='
|
||||||
|
#define __DARWIN_UNIX03 0
|
||||||
|
#define KERNEL
|
||||||
|
#define _DARWIN_USE_64_BIT_INODE
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <sys/event.h>
|
||||||
|
'
|
||||||
|
|
||||||
|
includes_FreeBSD='
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <sys/event.h>
|
||||||
|
'
|
||||||
|
|
||||||
|
includes='
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <netinet/ip.h>
|
||||||
|
#include <netinet/ip6.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/signal.h>
|
||||||
|
#include <signal.h>
|
||||||
|
'
|
||||||
|
|
||||||
|
ccflags=""
|
||||||
|
next=false
|
||||||
|
for i
|
||||||
|
do
|
||||||
|
if $next; then
|
||||||
|
ccflags="$ccflags $i"
|
||||||
|
next=false
|
||||||
|
elif [ "$i" = "-f" ]; then
|
||||||
|
next=true
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Pull out just the error names for later.
|
||||||
|
errors=$(
|
||||||
|
echo '#include <errno.h>' | $GCC -x c - -E -dM $ccflags |
|
||||||
|
awk '
|
||||||
|
$1 != "#define" || $2 ~ /\(/ {next}
|
||||||
|
$2 ~ /^ENOTDIR$/ {next}
|
||||||
|
$2 ~ /^E[A-Z0-9_]+$/ { print $2 }
|
||||||
|
{next}
|
||||||
|
' | sort
|
||||||
|
)
|
||||||
|
|
||||||
|
echo '// mkerrors_windows.sh' "$@"
|
||||||
|
echo '// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT'
|
||||||
|
echo
|
||||||
|
echo 'package syscall'
|
||||||
|
|
||||||
|
# Run C program to print error strings.
|
||||||
|
(
|
||||||
|
/bin/echo "
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define nelem(x) (sizeof(x)/sizeof((x)[0]))
|
||||||
|
|
||||||
|
enum { A = 'A', Z = 'Z', a = 'a', z = 'z' }; // avoid need for single quotes below
|
||||||
|
|
||||||
|
struct {
|
||||||
|
char *name;
|
||||||
|
int value;
|
||||||
|
} errors[] = {
|
||||||
|
"
|
||||||
|
for i in $errors
|
||||||
|
do
|
||||||
|
/bin/echo ' {"'$i'",' $i'},'
|
||||||
|
done
|
||||||
|
|
||||||
|
# Use /bin/echo to avoid builtin echo,
|
||||||
|
# which interprets \n itself
|
||||||
|
/bin/echo '
|
||||||
|
};
|
||||||
|
|
||||||
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
int i, j, e, iota = 1;
|
||||||
|
char buf[1024];
|
||||||
|
|
||||||
|
printf("\nconst (\n");
|
||||||
|
for(i=0; i<nelem(errors); i++) {
|
||||||
|
e = errors[i].value;
|
||||||
|
strcpy(buf, strerror(e));
|
||||||
|
// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
|
||||||
|
if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
|
||||||
|
buf[0] += a - A;
|
||||||
|
printf("\t%s", errors[i].name);
|
||||||
|
if(iota) {
|
||||||
|
printf(" = APPLICATION_ERROR + iota");
|
||||||
|
iota = !iota;
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
|
|
||||||
|
}
|
||||||
|
printf("\tEWINDOWS\n");
|
||||||
|
printf(")\n");
|
||||||
|
|
||||||
|
printf("\n// Error table\n");
|
||||||
|
printf("var errors = [...]string {\n");
|
||||||
|
for(i=0; i<nelem(errors); i++) {
|
||||||
|
e = errors[i].value;
|
||||||
|
for(j=0; j<i; j++)
|
||||||
|
if(errors[j].value == e) // duplicate value
|
||||||
|
goto next;
|
||||||
|
strcpy(buf, strerror(e));
|
||||||
|
// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
|
||||||
|
if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
|
||||||
|
buf[0] += a - A;
|
||||||
|
printf("\t%s - APPLICATION_ERROR: \"%s\",\n", errors[i].name, buf);
|
||||||
|
next:;
|
||||||
|
}
|
||||||
|
printf("\tEWINDOWS - APPLICATION_ERROR: \"not supported by windows\",\n");
|
||||||
|
printf("}\n\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
'
|
||||||
|
) >_errors.c
|
||||||
|
|
||||||
|
$GCC $ccflags -static -o _errors _errors.c && $GORUN ./_errors && rm -f _errors.c _errors
|
@ -216,8 +216,10 @@ while(<>) {
|
|||||||
$ret[$i] = sprintf("r%d", $i);
|
$ret[$i] = sprintf("r%d", $i);
|
||||||
$ret[$i+1] = sprintf("r%d", $i+1);
|
$ret[$i+1] = sprintf("r%d", $i+1);
|
||||||
}
|
}
|
||||||
|
my $rettype = $type;
|
||||||
if($type =~ /^\*/) {
|
if($type =~ /^\*/) {
|
||||||
$reg = "unsafe.Pointer($reg)";
|
$reg = "unsafe.Pointer($reg)";
|
||||||
|
$rettype = "($rettype)";
|
||||||
}
|
}
|
||||||
if($i == 0) {
|
if($i == 0) {
|
||||||
if($type eq "bool") {
|
if($type eq "bool") {
|
||||||
@ -241,7 +243,7 @@ while(<>) {
|
|||||||
$body .= "\t\t$name = 0;\n";
|
$body .= "\t\t$name = 0;\n";
|
||||||
$body .= "\t}\n";
|
$body .= "\t}\n";
|
||||||
} else {
|
} else {
|
||||||
$body .= "\t$name = ($type)($reg);\n";
|
$body .= "\t$name = $rettype($reg);\n";
|
||||||
}
|
}
|
||||||
push @pout, sprintf "\"%s=\", %s, ", $name, $name;
|
push @pout, sprintf "\"%s=\", %s, ", $name, $name;
|
||||||
}
|
}
|
||||||
|
@ -147,9 +147,12 @@ func getSysProcAddr(m uint32, pname string) uintptr {
|
|||||||
// syscall interface implementation for other packages
|
// syscall interface implementation for other packages
|
||||||
|
|
||||||
func Errstr(errno int) string {
|
func Errstr(errno int) string {
|
||||||
if errno == EWINDOWS {
|
// deal with special go errors
|
||||||
return "not supported by windows"
|
e := errno - APPLICATION_ERROR
|
||||||
|
if 0 <= e && e < len(errors) {
|
||||||
|
return errors[e]
|
||||||
}
|
}
|
||||||
|
// ask windows for the remaining errors
|
||||||
var flags uint32 = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_IGNORE_INSERTS
|
var flags uint32 = FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY | FORMAT_MESSAGE_IGNORE_INSERTS
|
||||||
b := make([]uint16, 300)
|
b := make([]uint16, 300)
|
||||||
n, err := FormatMessage(flags, 0, uint32(errno), 0, b, nil)
|
n, err := FormatMessage(flags, 0, uint32(errno), 0, b, nil)
|
||||||
|
@ -1,144 +1,272 @@
|
|||||||
// mkerrors_nacl.sh /home/rsc/pub/nacl/native_client/src/trusted/service_runtime/include/sys/errno.h
|
// mkerrors_windows.sh -f -m32
|
||||||
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
// MACHINE GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||||
|
|
||||||
package syscall
|
package syscall
|
||||||
|
|
||||||
// TODO(brainman): populate errors in zerrors_windows.go
|
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ERROR_FILE_NOT_FOUND = 2
|
E2BIG = APPLICATION_ERROR + iota
|
||||||
ERROR_NO_MORE_FILES = 18
|
EACCES
|
||||||
ERROR_BROKEN_PIPE = 109
|
EADDRINUSE
|
||||||
ERROR_INSUFFICIENT_BUFFER = 122
|
EADDRNOTAVAIL
|
||||||
ERROR_MOD_NOT_FOUND = 126
|
EADV
|
||||||
ERROR_PROC_NOT_FOUND = 127
|
EAFNOSUPPORT
|
||||||
ERROR_DIRECTORY = 267
|
EAGAIN
|
||||||
ERROR_IO_PENDING = 997
|
EALREADY
|
||||||
// TODO(brainman): should use value for EWINDOWS that does not clashes with anything else
|
EBADE
|
||||||
EWINDOWS = 99999 /* otherwise unused */
|
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
|
||||||
|
ENOENT
|
||||||
|
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
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO(brainman): fix all needed for os
|
// Error table
|
||||||
|
var errors = [...]string{
|
||||||
const (
|
E2BIG - APPLICATION_ERROR: "argument list too long",
|
||||||
EPERM = 1
|
EACCES - APPLICATION_ERROR: "permission denied",
|
||||||
ENOENT = 2
|
EADDRINUSE - APPLICATION_ERROR: "address already in use",
|
||||||
ESRCH = 3
|
EADDRNOTAVAIL - APPLICATION_ERROR: "cannot assign requested address",
|
||||||
EINTR = 4
|
EADV - APPLICATION_ERROR: "advertise error",
|
||||||
EIO = 5
|
EAFNOSUPPORT - APPLICATION_ERROR: "address family not supported by protocol",
|
||||||
ENXIO = 6
|
EAGAIN - APPLICATION_ERROR: "resource temporarily unavailable",
|
||||||
E2BIG = 7
|
EALREADY - APPLICATION_ERROR: "operation already in progress",
|
||||||
ENOEXEC = 8
|
EBADE - APPLICATION_ERROR: "invalid exchange",
|
||||||
EBADF = 9
|
EBADF - APPLICATION_ERROR: "bad file descriptor",
|
||||||
ECHILD = 10
|
EBADFD - APPLICATION_ERROR: "file descriptor in bad state",
|
||||||
EAGAIN = 11
|
EBADMSG - APPLICATION_ERROR: "bad message",
|
||||||
ENOMEM = 12
|
EBADR - APPLICATION_ERROR: "invalid request descriptor",
|
||||||
EACCES = 13
|
EBADRQC - APPLICATION_ERROR: "invalid request code",
|
||||||
EFAULT = 14
|
EBADSLT - APPLICATION_ERROR: "invalid slot",
|
||||||
EBUSY = 16
|
EBFONT - APPLICATION_ERROR: "bad font file format",
|
||||||
EEXIST = 17
|
EBUSY - APPLICATION_ERROR: "device or resource busy",
|
||||||
EXDEV = 18
|
ECANCELED - APPLICATION_ERROR: "operation canceled",
|
||||||
ENODEV = 19
|
ECHILD - APPLICATION_ERROR: "no child processes",
|
||||||
ENOTDIR = ERROR_DIRECTORY
|
ECHRNG - APPLICATION_ERROR: "channel number out of range",
|
||||||
EISDIR = 21
|
ECOMM - APPLICATION_ERROR: "communication error on send",
|
||||||
EINVAL = 22
|
ECONNABORTED - APPLICATION_ERROR: "software caused connection abort",
|
||||||
ENFILE = 23
|
ECONNREFUSED - APPLICATION_ERROR: "connection refused",
|
||||||
EMFILE = 24
|
ECONNRESET - APPLICATION_ERROR: "connection reset by peer",
|
||||||
ENOTTY = 25
|
EDEADLK - APPLICATION_ERROR: "resource deadlock avoided",
|
||||||
EFBIG = 27
|
EDESTADDRREQ - APPLICATION_ERROR: "destination address required",
|
||||||
ENOSPC = 28
|
EDOM - APPLICATION_ERROR: "numerical argument out of domain",
|
||||||
ESPIPE = 29
|
EDOTDOT - APPLICATION_ERROR: "RFS specific error",
|
||||||
EROFS = 30
|
EDQUOT - APPLICATION_ERROR: "disk quota exceeded",
|
||||||
EMLINK = 31
|
EEXIST - APPLICATION_ERROR: "file exists",
|
||||||
EPIPE = 32
|
EFAULT - APPLICATION_ERROR: "bad address",
|
||||||
ENAMETOOLONG = 36
|
EFBIG - APPLICATION_ERROR: "file too large",
|
||||||
ENOSYS = 38
|
EHOSTDOWN - APPLICATION_ERROR: "host is down",
|
||||||
EDQUOT = 122
|
EHOSTUNREACH - APPLICATION_ERROR: "no route to host",
|
||||||
EDOM = 33
|
EIDRM - APPLICATION_ERROR: "identifier removed",
|
||||||
ERANGE = 34
|
EILSEQ - APPLICATION_ERROR: "invalid or incomplete multibyte or wide character",
|
||||||
ENOMSG = 35
|
EINPROGRESS - APPLICATION_ERROR: "operation now in progress",
|
||||||
ECHRNG = 37
|
EINTR - APPLICATION_ERROR: "interrupted system call",
|
||||||
EL3HLT = 39
|
EINVAL - APPLICATION_ERROR: "invalid argument",
|
||||||
EL3RST = 40
|
EIO - APPLICATION_ERROR: "input/output error",
|
||||||
ELNRNG = 41
|
EISCONN - APPLICATION_ERROR: "transport endpoint is already connected",
|
||||||
EUNATCH = 42
|
EISDIR - APPLICATION_ERROR: "is a directory",
|
||||||
ENOCSI = 43
|
EISNAM - APPLICATION_ERROR: "is a named type file",
|
||||||
EL2HLT = 44
|
EKEYEXPIRED - APPLICATION_ERROR: "key has expired",
|
||||||
EDEADLK = 45
|
EKEYREJECTED - APPLICATION_ERROR: "key was rejected by service",
|
||||||
ENOLCK = 46
|
EKEYREVOKED - APPLICATION_ERROR: "key has been revoked",
|
||||||
EBADE = 50
|
EL2HLT - APPLICATION_ERROR: "level 2 halted",
|
||||||
EBADR = 51
|
EL2NSYNC - APPLICATION_ERROR: "level 2 not synchronized",
|
||||||
EXFULL = 52
|
EL3HLT - APPLICATION_ERROR: "level 3 halted",
|
||||||
ENOANO = 53
|
EL3RST - APPLICATION_ERROR: "level 3 reset",
|
||||||
EBADRQC = 54
|
ELIBACC - APPLICATION_ERROR: "can not access a needed shared library",
|
||||||
EBADSLT = 55
|
ELIBBAD - APPLICATION_ERROR: "accessing a corrupted shared library",
|
||||||
EBFONT = 57
|
ELIBEXEC - APPLICATION_ERROR: "cannot exec a shared library directly",
|
||||||
ENOSTR = 60
|
ELIBMAX - APPLICATION_ERROR: "attempting to link in too many shared libraries",
|
||||||
ENODATA = 61
|
ELIBSCN - APPLICATION_ERROR: ".lib section in a.out corrupted",
|
||||||
ETIME = 62
|
ELNRNG - APPLICATION_ERROR: "link number out of range",
|
||||||
ENOSR = 63
|
ELOOP - APPLICATION_ERROR: "too many levels of symbolic links",
|
||||||
ENONET = 64
|
EMEDIUMTYPE - APPLICATION_ERROR: "wrong medium type",
|
||||||
ENOPKG = 65
|
EMFILE - APPLICATION_ERROR: "too many open files",
|
||||||
EREMOTE = 66
|
EMLINK - APPLICATION_ERROR: "too many links",
|
||||||
ENOLINK = 67
|
EMSGSIZE - APPLICATION_ERROR: "message too long",
|
||||||
EADV = 68
|
EMULTIHOP - APPLICATION_ERROR: "multihop attempted",
|
||||||
ESRMNT = 69
|
ENAMETOOLONG - APPLICATION_ERROR: "file name too long",
|
||||||
ECOMM = 70
|
ENAVAIL - APPLICATION_ERROR: "no XENIX semaphores available",
|
||||||
EPROTO = 71
|
ENETDOWN - APPLICATION_ERROR: "network is down",
|
||||||
EMULTIHOP = 74
|
ENETRESET - APPLICATION_ERROR: "network dropped connection on reset",
|
||||||
ELBIN = 75
|
ENETUNREACH - APPLICATION_ERROR: "network is unreachable",
|
||||||
EDOTDOT = 76
|
ENFILE - APPLICATION_ERROR: "too many open files in system",
|
||||||
EBADMSG = 77
|
ENOANO - APPLICATION_ERROR: "no anode",
|
||||||
EFTYPE = 79
|
ENOBUFS - APPLICATION_ERROR: "no buffer space available",
|
||||||
ENOTUNIQ = 80
|
ENOCSI - APPLICATION_ERROR: "no CSI structure available",
|
||||||
EBADFD = 81
|
ENODATA - APPLICATION_ERROR: "no data available",
|
||||||
EREMCHG = 82
|
ENODEV - APPLICATION_ERROR: "no such device",
|
||||||
ELIBACC = 83
|
ENOENT - APPLICATION_ERROR: "no such file or directory",
|
||||||
ELIBBAD = 84
|
ENOEXEC - APPLICATION_ERROR: "exec format error",
|
||||||
ELIBSCN = 85
|
ENOKEY - APPLICATION_ERROR: "required key not available",
|
||||||
ELIBMAX = 86
|
ENOLCK - APPLICATION_ERROR: "no locks available",
|
||||||
ELIBEXEC = 87
|
ENOLINK - APPLICATION_ERROR: "link has been severed",
|
||||||
ENMFILE = 89
|
ENOMEDIUM - APPLICATION_ERROR: "no medium found",
|
||||||
ENOTEMPTY = 90
|
ENOMEM - APPLICATION_ERROR: "cannot allocate memory",
|
||||||
ELOOP = 92
|
ENOMSG - APPLICATION_ERROR: "no message of desired type",
|
||||||
EOPNOTSUPP = 95
|
ENONET - APPLICATION_ERROR: "machine is not on the network",
|
||||||
EPFNOSUPPORT = 96
|
ENOPKG - APPLICATION_ERROR: "package not installed",
|
||||||
ECONNRESET = 104
|
ENOPROTOOPT - APPLICATION_ERROR: "protocol not available",
|
||||||
ENOBUFS = 105
|
ENOSPC - APPLICATION_ERROR: "no space left on device",
|
||||||
EAFNOSUPPORT = 106
|
ENOSR - APPLICATION_ERROR: "out of streams resources",
|
||||||
EPROTOTYPE = 107
|
ENOSTR - APPLICATION_ERROR: "device not a stream",
|
||||||
ENOTSOCK = 108
|
ENOSYS - APPLICATION_ERROR: "function not implemented",
|
||||||
ENOPROTOOPT = 109
|
ENOTBLK - APPLICATION_ERROR: "block device required",
|
||||||
ESHUTDOWN = 110
|
ENOTCONN - APPLICATION_ERROR: "transport endpoint is not connected",
|
||||||
ECONNREFUSED = 111
|
ENOTEMPTY - APPLICATION_ERROR: "directory not empty",
|
||||||
EADDRINUSE = 112
|
ENOTNAM - APPLICATION_ERROR: "not a XENIX named type file",
|
||||||
ECONNABORTED = 113
|
ENOTRECOVERABLE - APPLICATION_ERROR: "state not recoverable",
|
||||||
ENETUNREACH = 114
|
ENOTSOCK - APPLICATION_ERROR: "socket operation on non-socket",
|
||||||
ENETDOWN = 115
|
ENOTSUP - APPLICATION_ERROR: "operation not supported",
|
||||||
ETIMEDOUT = 116
|
ENOTTY - APPLICATION_ERROR: "inappropriate ioctl for device",
|
||||||
EHOSTDOWN = 117
|
ENOTUNIQ - APPLICATION_ERROR: "name not unique on network",
|
||||||
EHOSTUNREACH = 118
|
ENXIO - APPLICATION_ERROR: "no such device or address",
|
||||||
EINPROGRESS = 119
|
EOVERFLOW - APPLICATION_ERROR: "value too large for defined data type",
|
||||||
EALREADY = 120
|
EOWNERDEAD - APPLICATION_ERROR: "owner died",
|
||||||
EDESTADDRREQ = 121
|
EPERM - APPLICATION_ERROR: "operation not permitted",
|
||||||
EPROTONOSUPPORT = 123
|
EPFNOSUPPORT - APPLICATION_ERROR: "protocol family not supported",
|
||||||
ESOCKTNOSUPPORT = 124
|
EPIPE - APPLICATION_ERROR: "broken pipe",
|
||||||
EADDRNOTAVAIL = 125
|
EPROTO - APPLICATION_ERROR: "protocol error",
|
||||||
ENETRESET = 126
|
EPROTONOSUPPORT - APPLICATION_ERROR: "protocol not supported",
|
||||||
EISCONN = 127
|
EPROTOTYPE - APPLICATION_ERROR: "protocol wrong type for socket",
|
||||||
ENOTCONN = 128
|
ERANGE - APPLICATION_ERROR: "numerical result out of range",
|
||||||
ETOOMANYREFS = 129
|
EREMCHG - APPLICATION_ERROR: "remote address changed",
|
||||||
EPROCLIM = 130
|
EREMOTE - APPLICATION_ERROR: "object is remote",
|
||||||
EUSERS = 131
|
EREMOTEIO - APPLICATION_ERROR: "remote I/O error",
|
||||||
EWOULDBLOCK = 141
|
ERESTART - APPLICATION_ERROR: "interrupted system call should be restarted",
|
||||||
ESTALE = 133
|
EROFS - APPLICATION_ERROR: "read-only file system",
|
||||||
ENOMEDIUM = 135
|
ESHUTDOWN - APPLICATION_ERROR: "cannot send after transport endpoint shutdown",
|
||||||
ENOSHARE = 136
|
ESOCKTNOSUPPORT - APPLICATION_ERROR: "socket type not supported",
|
||||||
ECASECLASH = 137
|
ESPIPE - APPLICATION_ERROR: "illegal seek",
|
||||||
EILSEQ = 138
|
ESRCH - APPLICATION_ERROR: "no such process",
|
||||||
EOVERFLOW = 139
|
ESRMNT - APPLICATION_ERROR: "srmount error",
|
||||||
ECANCELED = 140
|
ESTALE - APPLICATION_ERROR: "stale NFS file handle",
|
||||||
EL2NSYNC = 88
|
ESTRPIPE - APPLICATION_ERROR: "streams pipe error",
|
||||||
EIDRM = 91
|
ETIME - APPLICATION_ERROR: "timer expired",
|
||||||
EMSGSIZE = 132
|
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",
|
||||||
|
EXDEV - APPLICATION_ERROR: "invalid cross-device link",
|
||||||
|
EXFULL - APPLICATION_ERROR: "exchange full",
|
||||||
|
EWINDOWS - APPLICATION_ERROR: "not supported by windows",
|
||||||
|
}
|
||||||
|
@ -887,13 +887,13 @@ func GetServByName(name string, proto string) (s *Servent, errno int) {
|
|||||||
|
|
||||||
func Ntohs(netshort uint16) (u uint16) {
|
func Ntohs(netshort uint16) (u uint16) {
|
||||||
r0, _, _ := Syscall(procntohs, uintptr(netshort), 0, 0)
|
r0, _, _ := Syscall(procntohs, uintptr(netshort), 0, 0)
|
||||||
u = (uint16)(r0)
|
u = uint16(r0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status uint32) {
|
func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status uint32) {
|
||||||
r0, _, _ := Syscall6(procDnsQuery_W, uintptr(unsafe.Pointer(StringToUTF16Ptr(name))), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr)))
|
r0, _, _ := Syscall6(procDnsQuery_W, uintptr(unsafe.Pointer(StringToUTF16Ptr(name))), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr)))
|
||||||
status = (uint32)(r0)
|
status = uint32(r0)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,6 +17,22 @@ const (
|
|||||||
SizeofCmsghdr = 0xc
|
SizeofCmsghdr = 0xc
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Windows errors.
|
||||||
|
ERROR_FILE_NOT_FOUND = 2
|
||||||
|
ERROR_NO_MORE_FILES = 18
|
||||||
|
ERROR_BROKEN_PIPE = 109
|
||||||
|
ERROR_INSUFFICIENT_BUFFER = 122
|
||||||
|
ERROR_MOD_NOT_FOUND = 126
|
||||||
|
ERROR_PROC_NOT_FOUND = 127
|
||||||
|
ERROR_DIRECTORY = 267
|
||||||
|
ERROR_IO_PENDING = 997
|
||||||
|
// Go names for Windows errors.
|
||||||
|
ENOTDIR = ERROR_DIRECTORY
|
||||||
|
// Windows reserves errors >= 1<<29 for application use.
|
||||||
|
APPLICATION_ERROR = 1 << 29
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Invented values to support what package os expects.
|
// Invented values to support what package os expects.
|
||||||
O_RDONLY = 0x00000
|
O_RDONLY = 0x00000
|
||||||
|
Loading…
Reference in New Issue
Block a user