Skip to content

Commit 6d94b14

Browse files
committed
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
1 parent de2184f commit 6d94b14

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/pkg/syscall/mkerrors_windows.sh

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ struct {
152152
int
153153
main(void)
154154
{
155-
int i, j, e, iota = 1;
155+
int i, e, iota = 1;
156156
char buf[1024];
157157
158158
printf("\n// Go names for Windows errors.\n");
@@ -169,11 +169,6 @@ main(void)
169169
printf("\n// Invented values to support what package os and others expects.\n");
170170
printf("const (\n");
171171
for(i=0; i<nelem(errors); i++) {
172-
e = errors[i].value;
173-
strcpy(buf, strerror(e));
174-
// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
175-
if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)
176-
buf[0] += a - A;
177172
printf("\t%s", errors[i].name);
178173
if(iota) {
179174
printf(" = APPLICATION_ERROR + iota");
@@ -189,9 +184,6 @@ main(void)
189184
printf("var errors = [...]string {\n");
190185
for(i=0; i<nelem(errors); i++) {
191186
e = errors[i].value;
192-
for(j=0; j<i; j++)
193-
if(errors[j].value == e) // duplicate value
194-
goto next;
195187
strcpy(buf, strerror(e));
196188
// lowercase first letter: Bad -> bad, but STREAM -> STREAM.
197189
if(A <= buf[0] && buf[0] <= Z && a <= buf[1] && buf[1] <= z)

src/pkg/syscall/zerrors_windows_386.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ var errors = [...]string{
174174
ECONNREFUSED - APPLICATION_ERROR: "connection refused",
175175
ECONNRESET - APPLICATION_ERROR: "connection reset by peer",
176176
EDEADLK - APPLICATION_ERROR: "resource deadlock avoided",
177+
EDEADLOCK - APPLICATION_ERROR: "resource deadlock avoided",
177178
EDESTADDRREQ - APPLICATION_ERROR: "destination address required",
178179
EDOM - APPLICATION_ERROR: "numerical argument out of domain",
179180
EDOTDOT - APPLICATION_ERROR: "RFS specific error",
@@ -246,6 +247,7 @@ var errors = [...]string{
246247
ENOTTY - APPLICATION_ERROR: "inappropriate ioctl for device",
247248
ENOTUNIQ - APPLICATION_ERROR: "name not unique on network",
248249
ENXIO - APPLICATION_ERROR: "no such device or address",
250+
EOPNOTSUPP - APPLICATION_ERROR: "operation not supported",
249251
EOVERFLOW - APPLICATION_ERROR: "value too large for defined data type",
250252
EOWNERDEAD - APPLICATION_ERROR: "owner died",
251253
EPERM - APPLICATION_ERROR: "operation not permitted",
@@ -274,6 +276,7 @@ var errors = [...]string{
274276
EUCLEAN - APPLICATION_ERROR: "structure needs cleaning",
275277
EUNATCH - APPLICATION_ERROR: "protocol driver not attached",
276278
EUSERS - APPLICATION_ERROR: "too many users",
279+
EWOULDBLOCK - APPLICATION_ERROR: "resource temporarily unavailable",
277280
EXDEV - APPLICATION_ERROR: "invalid cross-device link",
278281
EXFULL - APPLICATION_ERROR: "exchange full",
279282
EWINDOWS - APPLICATION_ERROR: "not supported by windows",

0 commit comments

Comments
 (0)