1 /*****************************************************************************/ 2 /* */ 3 /* errno.h */ 4 /* */ 5 /* Error codes */ 6 /* */ 7 /* */ 8 /* */ 9 /* (C) 1998-2010, Ullrich von Bassewitz */ 10 /* Roemerstrasse 52 */ 11 /* D-70794 Filderstadt */ 12 /* EMail: uz@cc65.org */ 13 /* */ 14 /* */ 15 /* This software is provided 'as-is', without any expressed or implied */ 16 /* warranty. In no event will the authors be held liable for any damages */ 17 /* arising from the use of this software. */ 18 /* */ 19 /* Permission is granted to anyone to use this software for any purpose, */ 20 /* including commercial applications, and to alter it and redistribute it */ 21 /* freely, subject to the following restrictions: */ 22 /* */ 23 /* 1. The origin of this software must not be misrepresented; you must not */ 24 /* claim that you wrote the original software. If you use this software */ 25 /* in a product, an acknowledgment in the product documentation would be */ 26 /* appreciated but is not required. */ 27 /* 2. Altered source versions must be plainly marked as such, and must not */ 28 /* be misrepresented as being the original software. */ 29 /* 3. This notice may not be removed or altered from any source */ 30 /* distribution. */ 31 /* */ 32 /*****************************************************************************/ 33 34 35 36 #ifndef _ERRNO_H 37 #define _ERRNO_H 38 39 40 41 /*****************************************************************************/ 42 /* Data */ 43 /*****************************************************************************/ 44 45 46 47 /* Operating system specific error code */ 48 extern unsigned char _oserror; 49 50 extern int _errno; 51 /* System errors go here */ 52 53 #define errno _errno 54 /* errno must be a macro */ 55 56 57 58 /* Possible error codes */ 59 #define ENOENT 1 /* No such file or directory */ 60 #define ENOMEM 2 /* Out of memory */ 61 #define EACCES 3 /* Permission denied */ 62 #define ENODEV 4 /* No such device */ 63 #define EMFILE 5 /* Too many open files */ 64 #define EBUSY 6 /* Device or resource busy */ 65 #define EINVAL 7 /* Invalid argument */ 66 #define ENOSPC 8 /* No space left on device */ 67 #define EEXIST 9 /* File exists */ 68 #define EAGAIN 10 /* Try again */ 69 #define EIO 11 /* I/O error */ 70 #define EINTR 12 /* Interrupted system call */ 71 #define ENOSYS 13 /* Function not implemented */ 72 #define ESPIPE 14 /* Illegal seek */ 73 #define ERANGE 15 /* Range error */ 74 #define EBADF 16 /* Bad file number */ 75 #define ENOEXEC 17 /* Exec format error */ 76 #define EUNKNOWN 18 /* Unknown OS specific error */ 77 78 79 80 /*****************************************************************************/ 81 /* Code */ 82 /*****************************************************************************/ 83 84 85 86 int __fastcall__ _osmaperrno (unsigned char oserror); 87 /* Map an operating system specific error code (for example from _oserror) 88 ** into one of the E... codes above. It is user callable. 89 */ 90 91 unsigned char __fastcall__ _seterrno (unsigned char code); 92 /* Set errno to a specific error code and return zero. Used by the library */ 93 94 int __fastcall__ _directerrno (unsigned char code); 95 /* Set errno to a specific error code, clear _oserror and return -1. Used 96 ** by the library. 97 */ 98 99 int __fastcall__ _mappederrno (unsigned char code); 100 /* Set _oserror to the given platform specific error code. If it is a real 101 ** error code (not zero) set errno to the corresponding system error code 102 ** and return -1. Otherwise return zero. 103 ** Used by the library. 104 */ 105 106 107 108 /* End of errno.h */ 109 #endif 110 111 112 113