/** * Create module Errno's Variables. We have this method since Errno does not have it's * own java class. */ private void initErrno() { if (profile.allowModule("Errno")) { errnoModule = defineModule("Errno"); try { // define EAGAIN now, so that future EWOULDBLOCK will alias to it // see MRI's error.c and its explicit ordering of Errno definitions. createSysErr(Errno.EAGAIN.intValue(), Errno.EAGAIN.name()); for (Errno e : Errno.values()) { Constant c = (Constant) e; if (Character.isUpperCase(c.name().charAt(0))) { createSysErr(c.intValue(), c.name()); } } // map ENOSYS to NotImplementedError errnos.put(Errno.ENOSYS.intValue(), notImplementedError); } catch (Exception e) { // dump the trace and continue // this is currently only here for Android, which seems to have // bugs in its enumeration logic // http://code.google.com/p/android/issues/detail?id=2812 LOG.error(e.getMessage(), e); } } }
/** * Create module Errno's Variables. We have this method since Errno does not have it's * own java class. */ private void initErrno() { if (profile.allowModule("Errno")) { errnoModule = defineModule("Errno"); try { // define EAGAIN now, so that future EWOULDBLOCK will alias to it // see MRI's error.c and its explicit ordering of Errno definitions. createSysErr(Errno.EAGAIN.intValue(), Errno.EAGAIN.name()); for (Errno e : Errno.values()) { Constant c = (Constant) e; if (Character.isUpperCase(c.name().charAt(0))) { createSysErr(c.intValue(), c.name()); } } // map ENOSYS to NotImplementedError errnos.put(Errno.ENOSYS.intValue(), notImplementedError); } catch (Exception e) { // dump the trace and continue // this is currently only here for Android, which seems to have // bugs in its enumeration logic // http://code.google.com/p/android/issues/detail?id=2812 LOG.error(e.getMessage(), e); } } }
/** * Create module Errno's Variables. We have this method since Errno does not have its * own java class. */ private void initErrno() { if (profile.allowModule("Errno")) { errnoModule = defineModule("Errno"); try { // define EAGAIN now, so that future EWOULDBLOCK will alias to it // see MRI's error.c and its explicit ordering of Errno definitions. createSysErr(Errno.EAGAIN.intValue(), Errno.EAGAIN.name()); for (Errno e : Errno.values()) { Constant c = (Constant) e; if (Character.isUpperCase(c.name().charAt(0))) { createSysErr(c.intValue(), c.name()); } } // map ENOSYS to NotImplementedError errnos.put(Errno.ENOSYS.intValue(), notImplementedError); } catch (Exception e) { // dump the trace and continue // this is currently only here for Android, which seems to have // bugs in its enumeration logic // http://code.google.com/p/android/issues/detail?id=2812 LOG.error(e); } } }
/** * Create module Errno's Variables. We have this method since Errno does not have its * own java class. */ private void initErrno() { if (profile.allowModule("Errno")) { errnoModule = defineModule("Errno"); try { // define EAGAIN now, so that future EWOULDBLOCK will alias to it // see MRI's error.c and its explicit ordering of Errno definitions. createSysErr(Errno.EAGAIN.intValue(), Errno.EAGAIN.name()); for (Errno e : Errno.values()) { Constant c = (Constant) e; if (Character.isUpperCase(c.name().charAt(0))) { createSysErr(c.intValue(), c.name()); } } // map ENOSYS to NotImplementedError errnos.put(Errno.ENOSYS.intValue(), notImplementedError); } catch (Exception e) { // dump the trace and continue // this is currently only here for Android, which seems to have // bugs in its enumeration logic // http://code.google.com/p/android/issues/detail?id=2812 LOG.error(e); } } }
/** * Setup errnos for Windows. * * Windows replaced the BSD/POSIX socket errnos with its own Winsock equivalents * (e.g. EINVAL -> WSAEINVAL). We painstakenly map the missing constants to their WSA * equivalent values and expose the WSA constants on their own. */ private static void initWindows(PyObject dict) { // the few POSIX errnos Windows defines ConstantSet winErrnos = ConstantSet.getConstantSet("Errno"); // WSA errnos (and other Windows LastErrors) ConstantSet lastErrors = ConstantSet.getConstantSet("LastError"); // Fill the gaps by searching through every possible jnr-constants Errno first // checking if it's defined on Windows, then falling back to the WSA prefixed // version if it exists Constant constant; for (Constant errno : Errno.values()) { String errnoName = errno.name(); if ((constant = winErrnos.getConstant(errnoName)) != null || (constant = lastErrors.getConstant("WSA" + errnoName)) != null) { addCode(dict, errnoName, constant.intValue(), constant.toString()); } } // Then provide the WSA names for (Constant lastError : lastErrors) { if (lastError.name().startsWith("WSA")) { addCode(dict, lastError.name(), lastError.intValue(), lastError.toString()); } } }