mirror of
https://github.com/golang/go
synced 2024-11-22 01:24:42 -07:00
syscall: include all, even duplictate, invented error messages
Otherwise syscall.Errstr() returns "" for some (EWOULDBLOCK) errors. R=rsc CC=golang-dev https://golang.org/cl/3941041
This commit is contained in:
parent
de2184f3a8
commit
6d94b14e19
@ -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)
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user