|
| 1 | +/* |
| 2 | + * This file is part of the MicroPython project, http://micropython.org/ |
| 3 | + * |
| 4 | + * The MIT License (MIT) |
| 5 | + * |
| 6 | + * Copyright (c) 2016 Damien P. George |
| 7 | + * |
| 8 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 9 | + * of this software and associated documentation files (the "Software"), to deal |
| 10 | + * in the Software without restriction, including without limitation the rights |
| 11 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 12 | + * copies of the Software, and to permit persons to whom the Software is |
| 13 | + * furnished to do so, subject to the following conditions: |
| 14 | + * |
| 15 | + * The above copyright notice and this permission notice shall be included in |
| 16 | + * all copies or substantial portions of the Software. |
| 17 | + * |
| 18 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 19 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 20 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 21 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 22 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 23 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
| 24 | + * THE SOFTWARE. |
| 25 | + */ |
| 26 | + |
| 27 | +#ifndef __MICROPY_INCLUDED_PY_MPERRNO_H__ |
| 28 | +#define __MICROPY_INCLUDED_PY_MPERRNO_H__ |
| 29 | + |
| 30 | +#if MICROPY_USE_INTERNAL_ERRNO |
| 31 | + |
| 32 | +// MP_Exxx errno's are defined directly as numeric values |
| 33 | +// (Linux constants are used as a reference) |
| 34 | + |
| 35 | +#define MP_EPERM (1) // Operation not permitted |
| 36 | +#define MP_ENOENT (2) // No such file or directory |
| 37 | +#define MP_ESRCH (3) // No such process |
| 38 | +#define MP_EINTR (4) // Interrupted system call |
| 39 | +#define MP_EIO (5) // I/O error |
| 40 | +#define MP_ENXIO (6) // No such device or address |
| 41 | +#define MP_E2BIG (7) // Argument list too long |
| 42 | +#define MP_ENOEXEC (8) // Exec format error |
| 43 | +#define MP_EBADF (9) // Bad file number |
| 44 | +#define MP_ECHILD (10) // No child processes |
| 45 | +#define MP_EAGAIN (11) // Try again |
| 46 | +#define MP_ENOMEM (12) // Out of memory |
| 47 | +#define MP_EACCES (13) // Permission denied |
| 48 | +#define MP_EFAULT (14) // Bad address |
| 49 | +#define MP_ENOTBLK (15) // Block device required |
| 50 | +#define MP_EBUSY (16) // Device or resource busy |
| 51 | +#define MP_EEXIST (17) // File exists |
| 52 | +#define MP_EXDEV (18) // Cross-device link |
| 53 | +#define MP_ENODEV (19) // No such device |
| 54 | +#define MP_ENOTDIR (20) // Not a directory |
| 55 | +#define MP_EISDIR (21) // Is a directory |
| 56 | +#define MP_EINVAL (22) // Invalid argument |
| 57 | +#define MP_ENFILE (23) // File table overflow |
| 58 | +#define MP_EMFILE (24) // Too many open files |
| 59 | +#define MP_ENOTTY (25) // Not a typewriter |
| 60 | +#define MP_ETXTBSY (26) // Text file busy |
| 61 | +#define MP_EFBIG (27) // File too large |
| 62 | +#define MP_ENOSPC (28) // No space left on device |
| 63 | +#define MP_ESPIPE (29) // Illegal seek |
| 64 | +#define MP_EROFS (30) // Read-only file system |
| 65 | +#define MP_EMLINK (31) // Too many links |
| 66 | +#define MP_EPIPE (32) // Broken pipe |
| 67 | +#define MP_EDOM (33) // Math argument out of domain of func |
| 68 | +#define MP_ERANGE (34) // Math result not representable |
| 69 | +#define MP_ENOTCONN (107) // Transport endpoint is not connected |
| 70 | +#define MP_ETIMEDOUT (110) // Connection timed out |
| 71 | + |
| 72 | +#else |
| 73 | + |
| 74 | +// MP_Exxx errno's are defined in terms of system supplied ones |
| 75 | + |
| 76 | +#include <errno.h> |
| 77 | + |
| 78 | +#define MP_EPERM EPERM |
| 79 | +#define MP_ENOENT ENOENT |
| 80 | +#define MP_ESRCH ESRCH |
| 81 | +#define MP_EINTR EINTR |
| 82 | +#define MP_EIO EIO |
| 83 | +#define MP_ENXIO ENXIO |
| 84 | +#define MP_E2BIG E2BIG |
| 85 | +#define MP_ENOEXEC ENOEXEC |
| 86 | +#define MP_EBADF EBADF |
| 87 | +#define MP_ECHILD ECHILD |
| 88 | +#define MP_EAGAIN EAGAIN |
| 89 | +#define MP_ENOMEM ENOMEM |
| 90 | +#define MP_EACCES EACCES |
| 91 | +#define MP_EFAULT EFAULT |
| 92 | +#define MP_ENOTBLK ENOTBLK |
| 93 | +#define MP_EBUSY EBUSY |
| 94 | +#define MP_EEXIST EEXIST |
| 95 | +#define MP_EXDEV EXDEV |
| 96 | +#define MP_ENODEV ENODEV |
| 97 | +#define MP_ENOTDIR ENOTDIR |
| 98 | +#define MP_EISDIR EISDIR |
| 99 | +#define MP_EINVAL EINVAL |
| 100 | +#define MP_ENFILE ENFILE |
| 101 | +#define MP_EMFILE EMFILE |
| 102 | +#define MP_ENOTTY ENOTTY |
| 103 | +#define MP_ETXTBSY ETXTBSY |
| 104 | +#define MP_EFBIG EFBIG |
| 105 | +#define MP_ENOSPC ENOSPC |
| 106 | +#define MP_ESPIPE ESPIPE |
| 107 | +#define MP_EROFS EROFS |
| 108 | +#define MP_EMLINK EMLINK |
| 109 | +#define MP_EPIPE EPIPE |
| 110 | +#define MP_EDOM EDOM |
| 111 | +#define MP_ERANGE ERANGE |
| 112 | +#define MP_ENOTCONN ENOTCONN |
| 113 | +#define MP_ETIMEDOUT ETIMEDOUT |
| 114 | + |
| 115 | +#endif |
| 116 | + |
| 117 | +#endif // __MICROPY_INCLUDED_PY_MPERRNO_H__ |
0 commit comments