|
muteki
|
Besta error code constants and functions. More...
#include <muteki/common.h>Go to the source code of this file.
Typedefs | |
| typedef unsigned int | kerrno_t |
Functions | |
| size_t | FormatMessage (unsigned int flags, int _sbz0, int _sbz1, int _sbz2, void *outbuf, size_t outlen) |
| Fetch an error message. | |
| void | OSSetLastError (kerrno_t err) |
| Set the global errno. | |
| kerrno_t | OSGetLastError (void) |
| Get errno value from the global errno variable. | |
| void | _SetLastError (kerrno_t err) |
| Set errno. | |
| kerrno_t | _GetLastError (void) |
| Get errno. | |
Besta error code constants and functions.
| typedef unsigned int kerrno_t |
Kernel error code type
| enum errno_exec_e |
Error code for ERRNO_NS_EXEC.
| Enumerator | |
|---|---|
| EXEC_UNSUPPORTED | Unsupported executable type. This may be returned when attempting to execute a TLCS-900 executable or x86 EXE file on Arm systems.
|
| EXEC_INVALID | Invalid executable file. This may be returned when attempting to execute a data-only ROM.
|
| EXEC_OPEN_FAILED | Failed to open executable file. |
| EXEC_LOADER_FAILURE | Failed to parse executable file. |
| EXEC_MALLOC_FAILED | Failed to allocate memory when loading executable file. |
| EXEC_DECOMPRESSION_FAILED | Decompression failed. |
| EXEC_MP3_PLAYER_IS_RUNNING | Refuse to load an executable file because MP3 player is running in the background. Probably an left-over from the TLCS-900 days when MP3 can be played in the background. |
| EXEC_GENERIC_ERROR | Generic error. This is usually shown when the loader functions encountered an internal error. |
| EXEC_MAP_FULL | Executable mapping table is full. This is returned when too many executable is loaded. May be overwritten by a more generic code like EXEC_LOADER_FAILURE. |
| EXEC_BESTAPE_HEADER_PARSER_FAILURE | Failed to load executable file due to an error originated from the header parser. |
| EXEC_BESTAPE_LD_FAILURE | Failed to load executable file due to an error originated from the shared object loader. |
| EXEC_BESTAPE_RELOC_FAILURE | Failed to load executable file due to an error originated from the relocator. |
| EXEC_NOT_LOADED | Executable is not loaded. |
| enum errno_kernel_e |
Error code for ERRNO_NS_KERNEL.
| enum errno_ns_flag_e |
Kernel errno namespace.
| Enumerator | |
|---|---|
| ERRNO_NS_USER | User (errors set by OSSetLastError()). |
| ERRNO_NS_KERNEL | Kernel. |
| ERRNO_NS_EXEC | Executable loader. |
| ERRNO_NS_APPLET_SPECIFIC | Applet specific (errors set by _SetLastError()). |
| enum errno_user_e |
Error code for ERRNO_NS_USER.
| enum message_flags_e |
Flags for FormatMessage()
| Enumerator | |
|---|---|
| FORMAT_MESSAGE_ALLOCATE_BUFFER | Allocate buffer for the message. |
| FORMAT_MESSAGE_FROM_SYSTEM | Use system error message string table to generate the message. |
|
extern |
Get errno.
If kernel errno is set, the errno is returned with ERRNO_NS_KERNEL bit set. Otherwise it will return the result from OSSetLastError() with ERRNO_NS_USER bit set.
Requires -lkrnllib when dynamically linking with the shims.
|
extern |
Set errno.
Unlike OSSetLastError(), this also clears the kernel errno before calling OSSetLastError().
If the errno namespace is unset, it will also automatically set ERRNO_NS_APPLET_SPECIFIC before passing it to OSSetLastError().
Requires -lkrnllib when dynamically linking with the shims.
| err | New errno value. |
|
extern |
Fetch an error message.
Fetch error descriptions (encoded in UTF16) for last set error in a similar manner to FormatMessage API in Windows.
| flags | Flags. Only FORMAT_MESSAGE_FROM_SYSTEM and FORMAT_MESSAGE_ALLOCATE_BUFFER are supported. In addition, FORMAT_MESSAGE_FROM_SYSTEM must be set. |
| _sbz0 | Reserved. Should be set to 0. |
| _sbz1 | Reserved. Should be set to 0. |
| _sbz2 | Reserved. Should be set to 0. |
| outbuf | The output buffer. If using FORMAT_MESSAGE_ALLOCATE_BUFFER, the pointer to the allocated buffer will be placed at this location. Otherwise the message will be written directly to this location. It's caller's responsibility to free any buffer allocated by FORMAT_MESSAGE_ALLOCATE_BUFFER. |
| outlen | When not using FORMAT_MESSAGE_ALLOCATE_BUFFER, this is the length of the message buffer. Otherwise this is the minimum size of the buffer allocated for the message by the function. |
|
extern |
Get errno value from the global errno variable.
|
extern |
Set the global errno.
| err | New errno value. |