diff options
| author | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-08-02 11:00:13 +0200 |
|---|---|---|
| committer | Amlal EL Mahrouss <amlalelmahrouss@icloud.com> | 2024-08-02 11:00:13 +0200 |
| commit | 04572e7a4299ed9dc412db7c5baeec9eabe464a3 (patch) | |
| tree | a41e55a6dbd0a3c15e0a4006e935f9ac56c33c5c /Kernel/Sources | |
| parent | ce84d4c8745e8e1f4534a544ed48876f959485d3 (diff) | |
[IMP] New PROCESS_HEADER_BLOCK structure instead of ProcessHeader.
[IMP] PEF_SHARED_OBJECT_TRAITS with IsValid() method.
[IMP] HTTPS and ODBC for URLs support.
Signed-off-by: Amlal EL Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Kernel/Sources')
| -rw-r--r-- | Kernel/Sources/CodeManager.cxx | 6 | ||||
| -rw-r--r-- | Kernel/Sources/PEFCodeManager.cxx | 4 | ||||
| -rw-r--r-- | Kernel/Sources/PEFSharedObject.cxx | 8 | ||||
| -rw-r--r-- | Kernel/Sources/ProcessScheduler.cxx | 42 | ||||
| -rw-r--r-- | Kernel/Sources/ProcessTeam.cxx | 4 | ||||
| -rw-r--r-- | Kernel/Sources/Semaphore.cxx | 4 | ||||
| -rw-r--r-- | Kernel/Sources/URL.cxx | 6 |
7 files changed, 38 insertions, 36 deletions
diff --git a/Kernel/Sources/CodeManager.cxx b/Kernel/Sources/CodeManager.cxx index 3830e922..f48e8324 100644 --- a/Kernel/Sources/CodeManager.cxx +++ b/Kernel/Sources/CodeManager.cxx @@ -19,11 +19,11 @@ namespace Kernel if (!main) return false; - ProcessHeader proc((VoidPtr)main); - proc.Kind = ProcessHeader::kAppKind; + PROCESS_HEADER_BLOCK proc((VoidPtr)main); + proc.Kind = PROCESS_HEADER_BLOCK::kAppKind; rt_copy_memory((VoidPtr)processName, proc.Name, rt_string_len(proc.Name)); - Ref<ProcessHeader> refProc = proc; + Ref<PROCESS_HEADER_BLOCK> refProc = proc; return ProcessScheduler::The().Leak().Add(refProc); } diff --git a/Kernel/Sources/PEFCodeManager.cxx b/Kernel/Sources/PEFCodeManager.cxx index 223505b8..e95d9923 100644 --- a/Kernel/Sources/PEFCodeManager.cxx +++ b/Kernel/Sources/PEFCodeManager.cxx @@ -205,8 +205,8 @@ namespace Kernel if (errOrStart.Error() != 0) return false; - ProcessHeader proc(errOrStart.Leak().Leak()); - Ref<ProcessHeader> refProc = proc; + PROCESS_HEADER_BLOCK proc(errOrStart.Leak().Leak()); + Ref<PROCESS_HEADER_BLOCK> refProc = proc; proc.Kind = procKind; diff --git a/Kernel/Sources/PEFSharedObject.cxx b/Kernel/Sources/PEFSharedObject.cxx index 7d02ac19..90f8e9b6 100644 --- a/Kernel/Sources/PEFSharedObject.cxx +++ b/Kernel/Sources/PEFSharedObject.cxx @@ -37,9 +37,9 @@ using namespace Kernel; /** @brief Library initializer. */ /***********************************************************************************/ -EXTERN_C SharedObjectPtr rtl_init_shared_object(ProcessHeader* header) +EXTERN_C SharedObjectPtr rtl_init_shared_object(PROCESS_HEADER_BLOCK* header) { - SharedObjectPtr sharedObj = tls_new_class<SharedObject>(); + SharedObjectPtr sharedObj = tls_new_class<PEFSharedObjectInterface>(); if (!sharedObj) { @@ -48,7 +48,7 @@ EXTERN_C SharedObjectPtr rtl_init_shared_object(ProcessHeader* header) return nullptr; } - sharedObj->Mount(tls_new_class<SharedObject::SharedObjectTrait>()); + sharedObj->Mount(tls_new_class<PEFSharedObjectInterface::PEF_SHARED_OBJECT_TRAITS>()); if (!sharedObj->Get()) { @@ -80,7 +80,7 @@ EXTERN_C SharedObjectPtr rtl_init_shared_object(ProcessHeader* header) /** @param successful Reports if successful or not. */ /***********************************************************************************/ -EXTERN_C Void rtl_fini_shared_object(ProcessHeader* header, SharedObjectPtr lib, Bool* successful) +EXTERN_C Void rtl_fini_shared_object(PROCESS_HEADER_BLOCK* header, SharedObjectPtr lib, Bool* successful) { MUST_PASS(successful); diff --git a/Kernel/Sources/ProcessScheduler.cxx b/Kernel/Sources/ProcessScheduler.cxx index 84fc7a1f..2033215e 100644 --- a/Kernel/Sources/ProcessScheduler.cxx +++ b/Kernel/Sources/ProcessScheduler.cxx @@ -42,7 +42,7 @@ namespace Kernel /// @brief crash current process. /***********************************************************************************/ - void ProcessHeader::Crash() + void PROCESS_HEADER_BLOCK::Crash() { kcout << (*this->Name == 0 ? "Kernel" : this->Name) << ": crashed. (id = "; kcout.Number(kErrorProcessFault); @@ -60,17 +60,17 @@ namespace Kernel /// @brief Gets the local last exit code. /// @note Not thread-safe. /// @return Int32 the last exit code. - const Int32& ProcessHeader::GetExitCode() noexcept + const Int32& PROCESS_HEADER_BLOCK::GetExitCode() noexcept { return this->fLastExitCode; } - Int32& ProcessHeader::GetLocalCode() noexcept + Int32& PROCESS_HEADER_BLOCK::GetLocalCode() noexcept { return fLocalCode; } - void ProcessHeader::Wake(const bool should_wakeup) + void PROCESS_HEADER_BLOCK::Wake(const bool should_wakeup) { this->Status = should_wakeup ? ProcessStatus::kRunning : ProcessStatus::kFrozen; @@ -78,7 +78,7 @@ namespace Kernel /***********************************************************************************/ - VoidPtr ProcessHeader::New(const SizeT& sz) + VoidPtr PROCESS_HEADER_BLOCK::New(const SizeT& sz) { if (this->HeapCursor) { @@ -121,7 +121,7 @@ namespace Kernel } /* @brief free pointer from usage. */ - Boolean ProcessHeader::Delete(VoidPtr ptr, const SizeT& sz) + Boolean PROCESS_HEADER_BLOCK::Delete(VoidPtr ptr, const SizeT& sz) { if (sz < 1 || this->HeapCursor == this->HeapPtr) return false; @@ -145,19 +145,19 @@ namespace Kernel } /// @brief process name getter. - const Char* ProcessHeader::GetProcessName() noexcept + const Char* PROCESS_HEADER_BLOCK::GetProcessName() noexcept { return this->Name; } /// @brief process selector getter. - const ProcessSelector& ProcessHeader::GetSelector() noexcept + const ProcessSelector& PROCESS_HEADER_BLOCK::GetSelector() noexcept { return this->Selector; } /// @brief process status getter. - const ProcessStatus& ProcessHeader::GetStatus() noexcept + const ProcessStatus& PROCESS_HEADER_BLOCK::GetStatus() noexcept { return this->Status; } @@ -167,7 +167,7 @@ namespace Kernel /** @brief Affinity is the time slot allowed for the process. */ - const AffinityKind& ProcessHeader::GetAffinity() noexcept + const AffinityKind& PROCESS_HEADER_BLOCK::GetAffinity() noexcept { return this->Affinity; } @@ -175,7 +175,7 @@ namespace Kernel /** @brief Standard exit proc. */ - void ProcessHeader::Exit(const Int32& exit_code) + void PROCESS_HEADER_BLOCK::Exit(const Int32& exit_code) { if (this->ProcessId != ProcessScheduler::The().Leak().TheCurrent().Leak().ProcessId) @@ -194,14 +194,14 @@ namespace Kernel this->Image = nullptr; this->StackFrame = nullptr; - if (this->Kind == kShLibKind) + if (this->Kind == kSharedObjectKind) { bool success = false; - rtl_fini_shared_object(this, this->SharedLibObjectPtr, &success); + rtl_fini_shared_object(this, this->SharedObjectPEF, &success); if (success) { - this->SharedLibObjectPtr = nullptr; + this->SharedObjectPEF = nullptr; } } @@ -211,11 +211,11 @@ namespace Kernel /// @brief Add process to list. /// @param process /// @return - SizeT ProcessScheduler::Add(Ref<ProcessHeader>& process) + SizeT ProcessScheduler::Add(Ref<PROCESS_HEADER_BLOCK>& process) { if (!process.Leak().Image) { - if (process.Leak().Kind != ProcessHeader::kShLibKind) + if (process.Leak().Kind != PROCESS_HEADER_BLOCK::kSharedObjectKind) { return -kErrorNoEntrypoint; } @@ -227,13 +227,13 @@ namespace Kernel kcout << "ProcessScheduler:: adding process to team...\r"; /// Create heap according to type of process. - if (process.Leak().Kind == ProcessHeader::kAppKind) + if (process.Leak().Kind == PROCESS_HEADER_BLOCK::kAppKind) { process.Leak().HeapPtr = sched_new_heap(kUserHeapUser | kUserHeapRw); } - else if (process.Leak().Kind == ProcessHeader::kShLibKind) + else if (process.Leak().Kind == PROCESS_HEADER_BLOCK::kSharedObjectKind) { - process.Leak().SharedLibObjectPtr = rtl_init_shared_object(&process.Leak()); + process.Leak().SharedObjectPEF = rtl_init_shared_object(&process.Leak()); process.Leak().HeapPtr = sched_new_heap(kUserHeapUser | kUserHeapRw | kUserHeapShared); } else @@ -333,7 +333,7 @@ namespace Kernel /// @brief Gets current running process. /// @return - Ref<ProcessHeader>& ProcessScheduler::TheCurrent() + Ref<PROCESS_HEADER_BLOCK>& ProcessScheduler::TheCurrent() { return mTeam.AsRef(); } @@ -350,7 +350,7 @@ namespace Kernel /// @param process the process reference. /// @retval true can be schedulded. /// @retval false cannot be schedulded. - bool ProcessHelper::CanBeScheduled(Ref<ProcessHeader>& process) + bool ProcessHelper::CanBeScheduled(Ref<PROCESS_HEADER_BLOCK>& process) { if (process.Leak().Status == ProcessStatus::kFrozen || process.Leak().Status == ProcessStatus::kDead) diff --git a/Kernel/Sources/ProcessTeam.cxx b/Kernel/Sources/ProcessTeam.cxx index 7f3fbcf8..52038b42 100644 --- a/Kernel/Sources/ProcessTeam.cxx +++ b/Kernel/Sources/ProcessTeam.cxx @@ -15,7 +15,7 @@ namespace Kernel { /// @brief Process list array getter. /// @return The list of process to schedule. - MutableArray<Ref<ProcessHeader>>& ProcessTeam::AsArray() + MutableArray<Ref<PROCESS_HEADER_BLOCK>>& ProcessTeam::AsArray() { return mProcessList; } @@ -29,7 +29,7 @@ namespace Kernel /// @brief Current process getter. /// @return The current process header. - Ref<ProcessHeader>& ProcessTeam::AsRef() + Ref<PROCESS_HEADER_BLOCK>& ProcessTeam::AsRef() { return mCurrentProcess; } diff --git a/Kernel/Sources/Semaphore.cxx b/Kernel/Sources/Semaphore.cxx index ee89f482..49ec254a 100644 --- a/Kernel/Sources/Semaphore.cxx +++ b/Kernel/Sources/Semaphore.cxx @@ -17,7 +17,7 @@ namespace Kernel return fLockingProcess == nullptr; } - bool Semaphore::Lock(ProcessHeader* process) + bool Semaphore::Lock(PROCESS_HEADER_BLOCK* process) { if (!process || fLockingProcess) return false; @@ -32,7 +32,7 @@ namespace Kernel return fLockingProcess; } - bool Semaphore::LockOrWait(ProcessHeader* process, HardwareTimerInterface* timer) + bool Semaphore::LockOrWait(PROCESS_HEADER_BLOCK* process, HardwareTimerInterface* timer) { if (process == nullptr) return false; diff --git a/Kernel/Sources/URL.cxx b/Kernel/Sources/URL.cxx index 88328ea6..69c4733f 100644 --- a/Kernel/Sources/URL.cxx +++ b/Kernel/Sources/URL.cxx @@ -22,12 +22,14 @@ namespace Kernel /// @brief internal and reserved protocols by kernel. constexpr const Char* kURLProtocols[] = { "file", // Filesystem protocol - "zup", // Zeta update protocol + "zup", // ZKA update protocol "oscc", // Open System Configuration Connectivity. + "odbc", // ODBC connectivity. + "https", // HTTPS layer driver (HTTPS.sys). }; constexpr const int kUrlOutSz = 1; //! such as: :// - constexpr const int kProtosCount = 3; + constexpr const int kProtosCount = 5; constexpr const int kRangeSz = 4096; ErrorOr<StringView> url_extract_location(const Char* url) |
