61
61
import com .oracle .truffle .api .CompilerDirectives .TruffleBoundary ;
62
62
import com .oracle .truffle .api .CompilerDirectives .ValueType ;
63
63
64
+ import static com .oracle .graal .python .builtins .modules .SysModuleBuiltins .PLATFORM_DARWIN ;
65
+ import static com .oracle .graal .python .util .PythonUtils .getPythonOSName ;
66
+
64
67
public enum OSErrorEnum {
65
68
66
69
/**
@@ -84,8 +87,8 @@ public enum OSErrorEnum {
84
87
ENOEXEC (8 , "Exec format error" ),
85
88
EBADF (9 , "Bad file number" ),
86
89
ECHILD (10 , "No child processes" ),
87
- EWOULDBLOCK (11 , "Operation would block" ),
88
- EAGAIN (11 , "Try again" ),
90
+ EWOULDBLOCK (platformSpecific ( 11 , 35 ) , "Operation would block" ),
91
+ EAGAIN (platformSpecific ( 11 , 35 ) , "Try again" ),
89
92
ENOMEM (12 , "Out of memory" ),
90
93
EACCES (13 , "Permission denied" ),
91
94
EFAULT (14 , "Bad address" ),
@@ -109,15 +112,15 @@ public enum OSErrorEnum {
109
112
EPIPE (32 , "Broken pipe" ),
110
113
EDOM (33 , "Math argument out of domain of func" ),
111
114
ERANGE (34 , "Math result not representable" ),
112
- EDEADLOCK (35 ),
113
- EDEADLK (35 , "Resource deadlock would occur" ),
114
- ENAMETOOLONG (36 , "File name too long" ),
115
- ENOLCK (37 , "No record locks available" ),
116
- ENOSYS (38 , "Invalid system call number" ),
117
- ENOTEMPTY (39 , "Directory not empty" ),
118
- ELOOP (40 , "Too many symbolic links encountered" , "Too many levels of symbolic links" ),
119
- ENOMSG (42 , "No message of desired type" ),
120
- EIDRM (43 , "Identifier removed" ),
115
+ EDEADLOCK (platformSpecific ( 35 , 11 ) ),
116
+ EDEADLK (platformSpecific ( 35 , 11 ) , "Resource deadlock would occur" ),
117
+ ENAMETOOLONG (platformSpecific ( 36 , 63 ) , "File name too long" ),
118
+ ENOLCK (platformSpecific ( 37 , 77 ) , "No record locks available" ),
119
+ ENOSYS (platformSpecific ( 38 , 78 ) , "Invalid system call number" ),
120
+ ENOTEMPTY (platformSpecific ( 39 , 66 ) , "Directory not empty" ),
121
+ ELOOP (platformSpecific ( 40 , 62 ) , "Too many symbolic links encountered" , "Too many levels of symbolic links" ),
122
+ ENOMSG (platformSpecific ( 42 , 91 ) , "No message of desired type" ),
123
+ EIDRM (platformSpecific ( 43 , 90 ) , "Identifier removed" ),
121
124
ECHRNG (44 , "Channel number out of range" ),
122
125
EL2NSYNC (45 , "Level 2 not synchronized" ),
123
126
EL3HLT (46 , "Level 3 halted" ),
@@ -348,4 +351,8 @@ public ErrorAndMessagePair(OSErrorEnum oserror, String message) {
348
351
this .message = message ;
349
352
}
350
353
}
354
+
355
+ private static int platformSpecific (int linuxValue , int darwinValue ) {
356
+ return getPythonOSName ().equals (PLATFORM_DARWIN ) ? darwinValue : linuxValue ;
357
+ }
351
358
}
0 commit comments