diff --git a/racket/src/cs/Makefile b/racket/src/cs/Makefile index f06dab8fa9..b138f40a28 100644 --- a/racket/src/cs/Makefile +++ b/racket/src/cs/Makefile @@ -277,6 +277,7 @@ RUMBLE_SRCS = rumble/define.ss \ rumble/unsafe.ss \ rumble/extfl.ss \ rumble/place.ss \ + rumble/errno-data.ss \ rumble/foreign.ss \ rumble/future.ss \ rumble/version.ss \ diff --git a/racket/src/cs/rumble.sls b/racket/src/cs/rumble.sls index 3535af0227..f7af4ba259 100644 --- a/racket/src/cs/rumble.sls +++ b/racket/src/cs/rumble.sls @@ -740,6 +740,7 @@ (include "rumble/unsafe.ss") (include "rumble/extfl.ss") (include "rumble/place.ss") + (include "rumble/errno-data.ss") (include "rumble/foreign.ss") (include "rumble/future.ss") (include "rumble/inline.ss") diff --git a/racket/src/cs/rumble/errno-data.ss b/racket/src/cs/rumble/errno-data.ss new file mode 100644 index 0000000000..ce4f717169 --- /dev/null +++ b/racket/src/cs/rumble/errno-data.ss @@ -0,0 +1,5 @@ +(define (linux-errno-alist) '((E2BIG . 7)(EACCES . 13)(EADDRINUSE . 98)(EADDRNOTAVAIL . 99)(EAFNOSUPPORT . 97)(EAGAIN . 11)(EALREADY . 114)(EBADF . 9)(EBADMSG . 74)(EBUSY . 16)(ECANCELED . 125)(ECHILD . 10)(ECONNABORTED . 103)(ECONNREFUSED . 111)(ECONNRESET . 104)(EDEADLK . 35)(EDESTADDRREQ . 89)(EDOM . 33)(EDQUOT . 122)(EEXIST . 17)(EFAULT . 14)(EFBIG . 27)(EHOSTUNREACH . 113)(EIDRM . 43)(EILSEQ . 84)(EINPROGRESS . 115)(EINTR . 4)(EINVAL . 22)(EIO . 5)(EISCONN . 106)(EISDIR . 21)(ELOOP . 40)(EMFILE . 24)(EMLINK . 31)(EMSGSIZE . 90)(EMULTIHOP . 72)(ENAMETOOLONG . 36)(ENETDOWN . 100)(ENETRESET . 102)(ENETUNREACH . 101)(ENFILE . 23)(ENOBUFS . 105)(ENODATA . 61)(ENODEV . 19)(ENOENT . 2)(ENOEXEC . 8)(ENOLCK . 37)(ENOLINK . 67)(ENOMEM . 12)(ENOMSG . 42)(ENOPROTOOPT . 92)(ENOSPC . 28)(ENOSR . 63)(ENOSTR . 60)(ENOSYS . 38)(ENOTCONN . 107)(ENOTDIR . 20)(ENOTEMPTY . 39)(ENOTRECOVERABLE . 131)(ENOTSOCK . 88)(ENOTSUP . 95)(ENOTTY . 25)(ENXIO . 6)(EOPNOTSUPP . 95)(EOVERFLOW . 75)(EOWNERDEAD . 130)(EPERM . 1)(EPIPE . 32)(EPROTO . 71)(EPROTONOSUPPORT . 93)(EPROTOTYPE . 91)(ERANGE . 34)(EROFS . 30)(ESPIPE . 29)(ESRCH . 3)(ESTALE . 116)(ETIME . 62)(ETIMEDOUT . 110)(ETXTBSY . 26)(EWOULDBLOCK . 11)(EXDEV . 18))) + +(define (macosx-errno-alist) '((E2BIG . 7)(EACCES . 13)(EADDRINUSE . 48)(EADDRNOTAVAIL . 49)(EAFNOSUPPORT . 47)(EAGAIN . 35)(EALREADY . 37)(EBADF . 9)(EBADMSG . 94)(EBUSY . 16)(ECANCELED . 89)(ECHILD . 10)(ECONNABORTED . 53)(ECONNREFUSED . 61)(ECONNRESET . 54)(EDEADLK . 11)(EDESTADDRREQ . 39)(EDOM . 33)(EDQUOT . 69)(EEXIST . 17)(EFAULT . 14)(EFBIG . 27)(EHOSTUNREACH . 65)(EIDRM . 90)(EILSEQ . 92)(EINPROGRESS . 36)(EINTR . 4)(EINVAL . 22)(EIO . 5)(EISCONN . 56)(EISDIR . 21)(ELOOP . 62)(EMFILE . 24)(EMLINK . 31)(EMSGSIZE . 40)(EMULTIHOP . 95)(ENAMETOOLONG . 63)(ENETDOWN . 50)(ENETRESET . 52)(ENETUNREACH . 51)(ENFILE . 23)(ENOBUFS . 55)(ENODATA . 96)(ENODEV . 19)(ENOENT . 2)(ENOEXEC . 8)(ENOLCK . 77)(ENOLINK . 97)(ENOMEM . 12)(ENOMSG . 91)(ENOPROTOOPT . 42)(ENOSPC . 28)(ENOSR . 98)(ENOSTR . 99)(ENOSYS . 78)(ENOTCONN . 57)(ENOTDIR . 20)(ENOTEMPTY . 66)(ENOTRECOVERABLE . 104)(ENOTSOCK . 38)(ENOTSUP . 45)(ENOTTY . 25)(ENXIO . 6)(EOPNOTSUPP . 102)(EOVERFLOW . 84)(EOWNERDEAD . 105)(EPERM . 1)(EPIPE . 32)(EPROTO . 100)(EPROTONOSUPPORT . 43)(EPROTOTYPE . 41)(ERANGE . 34)(EROFS . 30)(ESPIPE . 29)(ESRCH . 3)(ESTALE . 70)(ETIME . 101)(ETIMEDOUT . 60)(ETXTBSY . 26)(EWOULDBLOCK . 35)(EXDEV . 18))) + +(define (windows-errno-alist) '((E2BIG . 7)(EACCES . 13)(EADDRINUSE . 100)(EADDRNOTAVAIL . 101)(EAFNOSUPPORT . 102)(EAGAIN . 11)(EALREADY . 103)(EBADF . 9)(EBADMSG . 104)(EBUSY . 16)(ECANCELED . 105)(ECHILD . 10)(ECONNABORTED . 106)(ECONNREFUSED . 107)(ECONNRESET . 108)(EDEADLK . 36)(EDESTADDRREQ . 109)(EDOM . 33)(EEXIST . 17)(EFAULT . 14)(EFBIG . 27)(EHOSTUNREACH . 110)(EIDRM . 111)(EILSEQ . 42)(EINPROGRESS . 112)(EINTR . 4)(EINVAL . 22)(EIO . 5)(EISCONN . 113)(EISDIR . 21)(ELOOP . 114)(EMFILE . 24)(EMLINK . 31)(EMSGSIZE . 115)(ENAMETOOLONG . 38)(ENETDOWN . 116)(ENETRESET . 117)(ENETUNREACH . 118)(ENFILE . 23)(ENOBUFS . 119)(ENODATA . 120)(ENODEV . 19)(ENOENT . 2)(ENOEXEC . 8)(ENOLCK . 39)(ENOLINK . 121)(ENOMEM . 12)(ENOMSG . 122)(ENOPROTOOPT . 123)(ENOSPC . 28)(ENOSR . 124)(ENOSTR . 125)(ENOSYS . 40)(ENOTCONN . 126)(ENOTDIR . 20)(ENOTEMPTY . 41)(ENOTRECOVERABLE . 127)(ENOTSOCK . 128)(ENOTSUP . 129)(ENOTTY . 25)(ENXIO . 6)(EOPNOTSUPP . 130)(EOVERFLOW . 132)(EOWNERDEAD . 133)(EPERM . 1)(EPIPE . 32)(EPROTO . 134)(EPROTONOSUPPORT . 135)(EPROTOTYPE . 136)(ERANGE . 34)(EROFS . 30)(ESPIPE . 29)(ESRCH . 3)(ETIME . 137)(ETIMEDOUT . 138)(ETXTBSY . 139)(EWOULDBLOCK . 140)(EXDEV . 18))) diff --git a/racket/src/cs/rumble/foreign.ss b/racket/src/cs/rumble/foreign.ss index 7a64280d07..f0dbd73df4 100644 --- a/racket/src/cs/rumble/foreign.ss +++ b/racket/src/cs/rumble/foreign.ss @@ -1802,7 +1802,15 @@ (define/who (lookup-errno sym) (check who symbol? sym) - (raise-unsupported-error who)) + (let ([errno-alist + (case (machine-type) + [(a6le ta6le i3le ti3le) (linux-errno-alist)] + [(a6osx ta6osx i3osx ti3osx) (macosx-errno-alist)] + [(a6nt ta6nt i3nt ti3nt) (windows-errno-alist)] + [else (raise-unsupported-error who)])]) + (cond + [(assq sym errno-alist) => cdr] + [else #f]))) ;; function is called with interrupts disabled (define get-errno