]> Cypherpunks repositories - gostls13.git/commitdiff
syscall: include all, even duplictate, invented error messages
authorAlex Brainman <alex.brainman@gmail.com>
Thu, 20 Jan 2011 10:24:15 +0000 (21:24 +1100)
committerAlex Brainman <alex.brainman@gmail.com>
Thu, 20 Jan 2011 10:24:15 +0000 (21:24 +1100)
Otherwise syscall.Errstr() returns "" for some (EWOULDBLOCK) errors.

R=rsc
CC=golang-dev
https://golang.org/cl/3941041

src/pkg/syscall/mkerrors_windows.sh
src/pkg/syscall/zerrors_windows_386.go

index f5d4914cff0c44ed7268e3c3684919b6206d6214..af95edd001c297ba588cc013fb470ecaeab0c094 100755 (executable)
@@ -152,7 +152,7 @@ struct {
 int
 main(void)
 {
-       int i, j, e, iota = 1;
+       int i, e, iota = 1;
        char buf[1024];
 
        printf("\n// Go names for Windows errors.\n");
@@ -169,11 +169,6 @@ main(void)
        printf("\n// Invented values to support what package os and others expects.\n");
        printf("const (\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");
@@ -189,9 +184,6 @@ main(void)
        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)
index a6bed6ea6b0c29ffe17c8de26be71ad3e766c875..ae4506fac009488f6c5c5f6700907562892bf199 100644 (file)
@@ -174,6 +174,7 @@ var errors = [...]string{
        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",
@@ -246,6 +247,7 @@ var errors = [...]string{
        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",
@@ -274,6 +276,7 @@ var errors = [...]string{
        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",