diff options
| -rw-r--r-- | src/libMsg/.keep | 0 | ||||
| -rw-r--r-- | src/libMsg/src/Server.cpp | 16 | ||||
| -rw-r--r-- | src/libPOSIXWrapper/src/.keep | 0 | ||||
| -rw-r--r-- | src/libPThread/src/.keep | 0 | ||||
| -rw-r--r-- | src/libPThread/src/Thread.cpp | 11 |
5 files changed, 14 insertions, 13 deletions
diff --git a/src/libMsg/.keep b/src/libMsg/.keep deleted file mode 100644 index e69de29b..00000000 --- a/src/libMsg/.keep +++ /dev/null diff --git a/src/libMsg/src/Server.cpp b/src/libMsg/src/Server.cpp index a2f17e91..ed043d0b 100644 --- a/src/libMsg/src/Server.cpp +++ b/src/libMsg/src/Server.cpp @@ -4,37 +4,37 @@ // Official repository: https://github.com/ne-foss-org/nekernel #include <libMsg/MsgKit/Server.h> +#include <libSystem/SystemKit/Err.h> static libmsg_func_type* kFuncs{nullptr}; static SizeT kFuncCnt{0}; static SemaphoreRef kSemaphore{nullptr}; IMPORT_C UInt32 libmsg_close_library(Void) { - if (kSemaphore) return 0; + if (kSemaphore) return kErrorInvalidData; kFuncs = nullptr; kFuncCnt = 0; - return 0; + return kErrorSuccess; } IMPORT_C UInt32 libmsg_eval_expr(struct LIBMSG_EXPR* head, VoidPtr arg, SizeT arg_size) { - if (kSemaphore) return 0; + if (kSemaphore) return kErrorInvalidData; + if (!head) return kErrorInvalidData; - if (!head) return 0; - - static kSemWaitTime = 1000; + static auto kSemWaitTime = 1000; kSemaphore = ::SemCreate(kSemWaitTime, kSemWaitTime, "libmsg_semaphore"); - if (!kSemaphore) return 0; + if (!kSemaphore) return kErrorInvalidData; kFuncs[head->l_index](head, arg, arg_size); ::SemClose(kSemaphore); kSemaphore = nullptr; - return 0; + return kErrorSuccess; } IMPORT_C Void libmsg_init_library(libmsg_func_type* funcs, SizeT cnt) { diff --git a/src/libPOSIXWrapper/src/.keep b/src/libPOSIXWrapper/src/.keep deleted file mode 100644 index e69de29b..00000000 --- a/src/libPOSIXWrapper/src/.keep +++ /dev/null diff --git a/src/libPThread/src/.keep b/src/libPThread/src/.keep deleted file mode 100644 index e69de29b..00000000 --- a/src/libPThread/src/.keep +++ /dev/null diff --git a/src/libPThread/src/Thread.cpp b/src/libPThread/src/Thread.cpp index 5324d979..0d5052f2 100644 --- a/src/libPThread/src/Thread.cpp +++ b/src/libPThread/src/Thread.cpp @@ -4,6 +4,7 @@ // Official repository: https://github.com/ne-foss-org/nekernel #include <libPThread/PThreadKit/Thread.h> +#include <libSystem/SystemKit/Err.h> PTHREAD_SAFE SInt32 pthread_detach(ThreadRef thread) { return ThrDetachThread(thread); @@ -24,23 +25,23 @@ PTHREAD_SAFE SInt32 pthread_exit(SInt32 retval) { PTHREAD_SAFE SInt32 pthread_join(ThreadRef thread, VoidPtr* retval) { SInt32* ret = (SInt32*) retval; - if (!ret) return -1; + if (!ret) return kErrorInvalidData; *ret = ThrJoinThread(thread); - return 0; + return kErrorSuccess; } PTHREAD_SAFE SInt32 pthread_create(_Output ThreadRef* thread, VoidPtr attr, VoidPtr (*start_routine)(VoidPtr), VoidPtr arg) { LIBSYS_UNUSED(attr); - if (!attr || !thread || !arg || !start_routine) return -1; + if (!attr || !thread || !arg || !start_routine) return kErrorInvalidData; /// @note passing zero means you'd have to read the argv until you hit a nullptr. ThreadRef thrd = ThrCreateThread("pthread_thread", (ThrProcKind) start_routine, 0, arg, 0); - if (!thrd) return -1; + if (!thrd) return kErrorInvalidData; *thread = thrd; - return 0; + return kErrorSuccess; } |
