summaryrefslogtreecommitdiffhomepage
path: root/src/libSystem/SystemKit/Err.h
blob: 7e8dbee4d8c2612df74cd724fb58f4e69c42c386 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* ========================================

  Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.

======================================== */

#ifndef SYSTEMKIT_ERR_H
#define SYSTEMKIT_ERR_H

#include <libSystem/SystemKit/Macros.h>

/// @file Err.h
/// @brief Process Codes type and values.
/// @author Amlal El Mahrouss (amlal@nekernel.org)

#define err_local_ok() (kLastError == kErrorSuccess)
#define err_local_fail() (kLastError != kErrorSuccess)
#define err_local_get() (kLastError)

typedef SInt32 ErrRef;

inline constexpr ErrRef kErrorSuccess            = 0;
inline constexpr ErrRef kErrorExecutable         = 33;
inline constexpr ErrRef kErrorExecutableLib      = 34;
inline constexpr ErrRef kErrorFileNotFound       = 35;
inline constexpr ErrRef kErrorDirectoryNotFound  = 36;
inline constexpr ErrRef kErrorDiskReadOnly       = 37;
inline constexpr ErrRef kErrorDiskIsFull         = 38;
inline constexpr ErrRef kErrorProcessFault       = 39;
inline constexpr ErrRef kErrorSocketHangUp       = 40;
inline constexpr ErrRef kErrorThreadLocalStorage = 41;
inline constexpr ErrRef kErrorMath               = 42;
inline constexpr ErrRef kErrorNoNetwork          = 43;
inline constexpr ErrRef kErrorHeapOutOfMemory    = 44;
inline constexpr ErrRef kErrorNoSuchDisk         = 45;
inline constexpr ErrRef kErrorFileExists         = 46;
inline constexpr ErrRef kErrorFormatFailed       = 47;
inline constexpr ErrRef kErrorNetworkTimeout     = 48;
inline constexpr ErrRef kErrorInternal           = 49;
inline constexpr ErrRef kErrorForkAlreadyExists  = 50;
inline constexpr ErrRef kErrorOutOfTeamSlot      = 51;
inline constexpr ErrRef kErrorHeapNotPresent     = 52;
inline constexpr ErrRef kErrorNoEntrypoint       = 53;
inline constexpr ErrRef kErrorDiskIsCorrupted    = 54;
inline constexpr ErrRef kErrorDisk               = 55;
inline constexpr ErrRef kErrorInvalidData        = 56;
inline constexpr ErrRef kErrorAsync              = 57;
inline constexpr ErrRef kErrorNonBlocking        = 58;
inline constexpr ErrRef kErrorIPC                = 59;
inline constexpr ErrRef kErrorSign               = 60;
inline constexpr ErrRef kErrorInvalidCreds       = 61;
inline constexpr ErrRef kErrorCDTrayBroken       = 62;
inline constexpr ErrRef kErrorUnrecoverableDisk  = 63;
inline constexpr ErrRef kErrorFileLocked         = 64;
inline constexpr ErrRef kErrorDiskIsTooTiny      = 65;
inline constexpr ErrRef kErrorUnimplemented      = -1;

/// @brief The last error reported by the system to the process.
IMPORT_C ErrRef kLastError;

#endif