summaryrefslogtreecommitdiff
path: root/src/syscall/errstr_darwin.go
blob: c3ae97523431ed290abd0c20829cd56a28060bef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
// 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

export errstr

const (
	ENONE=0;
	EPERM=1;
	ENOENT=2;
	ESRCH=3;
	EINTR=4;
	EIO=5;
	ENXIO=6;
	E2BIG=7;
	ENOEXEC=8;
	EBADF=9;
	ECHILD=10;
	EDEADLK=11;
	ENOMEM=12;
	EACCES=13;
	EFAULT=14;
	ENOTBLK=15;
	EBUSY=16;
	EEXIST=17;
	EXDEV=18;
	ENODEV=19;
	ENOTDIR=20;
	EISDIR=21;
	EINVAL=22;
	ENFILE=23;
	EMFILE=24;
	ENOTTY=25;
	ETXTBSY=26;
	EFBIG=27;
	ENOSPC=28;
	ESPIPE=29;
	EROFS=30;
	EMLINK=31;
	EPIPE=32;
	EDOM=33;
	ERANGE=34;
	EAGAIN=35;
	EINPROGRESS=36;
	EALREADY=37;
	ENOTSOCK=38;
	EDESTADDRREQ=39;
	EMSGSIZE=40;
	EPROTOTYPE=41;
	ENOPROTOOPT=42;
	EPROTONOSUPPORT=43;
	ESOCKTNOSUPPORT=44;
	ENOTSUP=45;
	EPFNOSUPPORT=46;
	EAFNOSUPPORT=47;
	EADDRINUSE=48;
	EADDRNOTAVAIL=49;
	ENETDOWN=50;
	ENETUNREACH=51;
	ENETRESET=52;
	ECONNABORTED=53;
	ECONNRESET=54;
	ENOBUFS=55;
	EISCONN=56;
	ENOTCONN=57;
	ESHUTDOWN=58;
	ETOOMANYREFS=59;
	ETIMEDOUT=60;
	ECONNREFUSED=61;
	ELOOP=62;
	ENAMETOOLONG=63;
	EHOSTDOWN=64;
	EHOSTUNREACH=65;
	ENOTEMPTY=66;
	EPROCLIM=67;
	EUSERS=68;
	EDQUOT=69;
	ESTALE=70;
	EREMOTE=71;
	EBADRPC=72;
	ERPCMISMATCH=73;
	EPROGUNAVAIL=74;
	EPROGMISMATCH=75;
	EPROCUNAVAIL=76;
	ENOLCK=77;
	ENOSYS=78;
	EFTYPE=79;
	EAUTH=80;
	ENEEDAUTH=81;
	EPWROFF=82;
	EDEVERR=83;
	EOVERFLOW=84;
	EBADEXEC=85;
	EBADARCH=86;
	ESHLIBVERS=87;
	EBADMACHO=88;
	ECANCELED=89;
	EIDRM=90;
	ENOMSG=91   ;
	EILSEQ=92;
	ENOATTR=93;
	EBADMSG=94;
	EMULTIHOP=95;
	ENODATA=96;
	ENOLINK=97;
	ENOSR=98;
	ENOSTR=99;
	EPROTO=100;
	ETIME=101;
	EOPNOTSUPP=102;
	ELAST=103;
)

export (
	ENONE,
	EPERM,
	ENOENT,
	ESRCH,
	EINTR,
	EIO,
	ENXIO,
	E2BIG,
	ENOEXEC,
	EBADF,
	ECHILD,
	EDEADLK,
	ENOMEM,
	EACCES,
	EFAULT,
	ENOTBLK,
	EBUSY,
	EEXIST,
	EXDEV,
	ENODEV,
	ENOTDIR,
	EISDIR,
	EINVAL,
	ENFILE,
	EMFILE,
	ENOTTY,
	ETXTBSY,
	EFBIG,
	ENOSPC,
	ESPIPE,
	EROFS,
	EMLINK,
	EPIPE,
	EDOM,
	ERANGE,
	EAGAIN,
	EINPROGRESS,
	EALREADY,
	ENOTSOCK,
	EDESTADDRREQ,
	EMSGSIZE,
	EPROTOTYPE,
	ENOPROTOOPT,
	EPROTONOSUPPORT,
	ESOCKTNOSUPPORT,
	ENOTSUP,
	EPFNOSUPPORT,
	EAFNOSUPPORT,
	EADDRINUSE,
	EADDRNOTAVAIL,
	ENETDOWN,
	ENETUNREACH,
	ENETRESET,
	ECONNABORTED,
	ECONNRESET,
	ENOBUFS,
	EISCONN,
	ENOTCONN,
	ESHUTDOWN,
	ETOOMANYREFS,
	ETIMEDOUT,
	ECONNREFUSED,
	ELOOP,
	ENAMETOOLONG,
	EHOSTDOWN,
	EHOSTUNREACH,
	ENOTEMPTY,
	EPROCLIM,
	EUSERS,
	EDQUOT,
	ESTALE,
	EREMOTE,
	EBADRPC,
	ERPCMISMATCH,
	EPROGUNAVAIL,
	EPROGMISMATCH,
	EPROCUNAVAIL,
	ENOLCK,
	ENOSYS,
	EFTYPE,
	EAUTH,
	ENEEDAUTH,
	EPWROFF,
	EDEVERR,
	EOVERFLOW,
	EBADEXEC,
	EBADARCH,
	ESHLIBVERS,
	EBADMACHO,
	ECANCELED,
	EIDRM,
	ENOMSG,
	EILSEQ,
	ENOATTR,
	EBADMSG,
	EMULTIHOP,
	ENODATA,
	ENOLINK,
	ENOSR,
	ENOSTR,
	EPROTO,
	ETIME,
	EOPNOTSUPP,
	ELAST
)

var error [ELAST]string;

func init(){
	error[ENONE] = "No error"; 
	error[EPERM] = "Operation not permitted"; 
	error[ENOENT] = "No such file or directory"; 
	error[ESRCH] = "No such process"; 
	error[EINTR] = "Interrupted system call"; 
	error[EIO] = "Input/output error"; 
	error[ENXIO] = "Device not configured"; 
	error[E2BIG] = "Argument list too long"; 
	error[ENOEXEC] = "Exec format error"; 
	error[EBADF] = "Bad file descriptor"; 
	error[ECHILD] = "No child processes"; 
	error[EDEADLK] = "Resource deadlock avoided"; 
	error[ENOMEM] = "Cannot allocate memory"; 
	error[EACCES] = "Permission denied"; 
	error[EFAULT] = "Bad address"; 
	error[ENOTBLK] = "Block device required"; 
	error[EBUSY] = "Device / Resource busy"; 
	error[EEXIST] = "File exists"; 
	error[EXDEV] = "Cross-device link"; 
	error[ENODEV] = "Operation not supported by device"; 
	error[ENOTDIR] = "Not a directory"; 
	error[EISDIR] = "Is a directory"; 
	error[EINVAL] = "Invalid argument"; 
	error[ENFILE] = "Too many open files in system"; 
	error[EMFILE] = "Too many open files"; 
	error[ENOTTY] = "Inappropriate ioctl for device"; 
	error[ETXTBSY] = "Text file busy"; 
	error[EFBIG] = "File too large"; 
	error[ENOSPC] = "No space left on device"; 
	error[ESPIPE] = "Illegal seek"; 
	error[EROFS] = "Read-only file system"; 
	error[EMLINK] = "Too many links"; 
	error[EPIPE] = "Broken pipe"; 
	error[EDOM] = "Numerical argument out of domain"; 
	error[ERANGE] = "Result too large"; 
	error[EAGAIN] = "Resource temporarily unavailable"; 
	error[EINPROGRESS] = "Operation now in progress"; 
	error[EALREADY] = "Operation already in progress"; 
	error[ENOTSOCK] = "Socket operation on non-socket"; 
	error[EDESTADDRREQ] = "Destination address required"; 
	error[EMSGSIZE] = "Message too long"; 
	error[EPROTOTYPE] = "Protocol wrong type for socket"; 
	error[ENOPROTOOPT] = "Protocol not available"; 
	error[EPROTONOSUPPORT] = "Protocol not supported"; 
	error[ESOCKTNOSUPPORT] = "Socket type not supported"; 
	error[ENOTSUP] = "Operation not supported"; 
	error[EPFNOSUPPORT] = "Protocol family not supported"; 
	error[EAFNOSUPPORT] = "Address family not supported by protocol family"; 
	error[EADDRINUSE] = "Address already in use"; 
	error[EADDRNOTAVAIL] = "Can't assign requested address"; 
	error[ENETDOWN] = "Network is down"; 
	error[ENETUNREACH] = "Network is unreachable"; 
	error[ENETRESET] = "Network dropped connection on reset"; 
	error[ECONNABORTED] = "Software caused connection abort"; 
	error[ECONNRESET] = "Connection reset by peer"; 
	error[ENOBUFS] = "No buffer space available"; 
	error[EISCONN] = "Socket is already connected"; 
	error[ENOTCONN] = "Socket is not connected"; 
	error[ESHUTDOWN] = "Can't send after socket shutdown"; 
	error[ETOOMANYREFS] = "Too many references: can't splice"; 
	error[ETIMEDOUT] = "Operation timed out"; 
	error[ECONNREFUSED] = "Connection refused"; 
	error[ELOOP] = "Too many levels of symbolic links"; 
	error[ENAMETOOLONG] = "File name too long"; 
	error[EHOSTDOWN] = "Host is down"; 
	error[EHOSTUNREACH] = "No route to host"; 
	error[ENOTEMPTY] = "Directory not empty"; 
	error[EPROCLIM] = "Too many processes"; 
	error[EUSERS] = "Too many users"; 
	error[EDQUOT] = "Disc quota exceeded"; 
	error[ESTALE] = "Stale NFS file handle"; 
	error[EREMOTE] = "Too many levels of remote in path"; 
	error[EBADRPC] = "RPC struct is bad"; 
	error[ERPCMISMATCH] = "RPC version wrong"; 
	error[EPROGUNAVAIL] = "RPC prog. not avail"; 
	error[EPROGMISMATCH] = "Program version wrong"; 
	error[EPROCUNAVAIL] = "Bad procedure for program"; 
	error[ENOLCK] = "No locks available"; 
	error[ENOSYS] = "Function not implemented"; 
	error[EFTYPE] = "Inappropriate file type or format"; 
	error[EAUTH] = "Authentication error"; 
	error[ENEEDAUTH] = "Need authenticator"; 
	error[EPWROFF] = "Device power is off"; 
	error[EDEVERR] = "Device error, e.g. paper out"; 
	error[EOVERFLOW] = "Value too large to be stored in data type"; 
	error[EBADEXEC] = "Bad executable"; 
	error[EBADARCH] = "Bad CPU type in executable"; 
	error[ESHLIBVERS] = "Shared library version mismatch"; 
	error[EBADMACHO] = "Malformed Macho file"; 
	error[ECANCELED] = "Operation canceled"; 
	error[EIDRM] = "Identifier removed"; 
	error[ENOMSG] = "No message of desired type"; 
	error[EILSEQ] = "Illegal byte sequence"; 
	error[ENOATTR] = "Attribute not found"; 
	error[EBADMSG] = "Bad message"; 
	error[EMULTIHOP] = "Reserved"; 
	error[ENODATA] = "No message available on STREAM"; 
	error[ENOLINK] = "Reserved"; 
	error[ENOSR] = "No STREAM resources"; 
	error[ENOSTR] = "Not a STREAM"; 
	error[EPROTO] = "Protocol error"; 
	error[ETIME] = "STREAM ioctl timeout"; 
	error[EOPNOTSUPP] = "Operation not supported on socket"; 
	error[ELAST] = "Must be equal largest errno"; 
}

func str(val int64) string {  // do it here rather than with fmt to avoid dependency
	if val < 0 {
		return "-" + str(-val);
	}
	var buf [32]byte;  // big enough for int64
	i := len(buf)-1;
	for val >= 10 {
		buf[i] = val%10 + '0';
		i--;
		val /= 10;
	}
	buf[i] = val + '0';
	return string(buf)[i:len(buf)];
}

func errstr(errno int64) string {
	if errno < 0 || errno >= len(error) {
		return "Error " + str(errno)
	}
	return error[errno]
}