diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-08-16 19:56:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-16 19:56:21 +0200 |
| commit | 1a32b9307357ac0fc9095e853b2b6d94f9fe62bb (patch) | |
| tree | f41f723659c8926e38182fbe062746d821ab487e /public | |
| parent | eb9df5eea339812513c25a8d3b2eeb03c633e7ac (diff) | |
| parent | b301047903b79560dce69085fc271a653a1eb4b6 (diff) | |
Merge pull request #55 from nekernel-org/dev
v0.0.4
Diffstat (limited to 'public')
18 files changed, 96 insertions, 130 deletions
diff --git a/public/frameworks/CoreFoundation.fwrk/CoreFoundation.json b/public/frameworks/CoreFoundation.fwrk/CoreFoundation.json index 076b35ae..39e6b480 100644 --- a/public/frameworks/CoreFoundation.fwrk/CoreFoundation.json +++ b/public/frameworks/CoreFoundation.fwrk/CoreFoundation.json @@ -15,7 +15,8 @@ "kCFVersion=0x0100", "kCFVersionHighest=0x0100", "kCFVersionLowest=0x0100", - "__NE_AMD64__" + "__NE_AMD64__", + "__CF_64BIT__" ] }
\ No newline at end of file diff --git a/public/frameworks/CoreFoundation.fwrk/headers/Foundation.h b/public/frameworks/CoreFoundation.fwrk/headers/Foundation.h index 500ad544..8396a3e8 100644 --- a/public/frameworks/CoreFoundation.fwrk/headers/Foundation.h +++ b/public/frameworks/CoreFoundation.fwrk/headers/Foundation.h @@ -25,7 +25,7 @@ struct CFPoint; struct CFRect; struct CFColor; -#ifndef __LP64__ +#ifndef __CF_64BIT__ typedef SInt32 CFInteger; typedef float CFReal; #else diff --git a/public/frameworks/CoreFoundation.fwrk/headers/String.h b/public/frameworks/CoreFoundation.fwrk/headers/String.h index c28c05cd..80b68536 100644 --- a/public/frameworks/CoreFoundation.fwrk/headers/String.h +++ b/public/frameworks/CoreFoundation.fwrk/headers/String.h @@ -14,5 +14,10 @@ class CFString; class CFString final CF_OBJECT { public: + CFString() = default; + ~CFString() = default; + + CFString(const CFString&) = delete; + CFString& operator=(const CFString&) = delete; }; } // namespace CF
\ No newline at end of file diff --git a/public/frameworks/DiskImage.fwrk/headers/DiskImage.h b/public/frameworks/DiskImage.fwrk/headers/DiskImage.h index 53348f3e..4a18b079 100644 --- a/public/frameworks/DiskImage.fwrk/headers/DiskImage.h +++ b/public/frameworks/DiskImage.fwrk/headers/DiskImage.h @@ -39,6 +39,7 @@ struct DI_DISK_IMAGE { SInt32 block_cnt = 0; SizeT disk_sz = kDIMinDiskSz; Char out_name[kDIOutNameLen] = kDIDefaultOutputName; + SInt32 fs_version = 0UL; }; /// @brief Format with an EPM partition. diff --git a/public/frameworks/DiskImage.fwrk/src/DiskImage+EPM.cc b/public/frameworks/DiskImage.fwrk/src/DiskImage+EPM.cc index a1182e64..83b52905 100644 --- a/public/frameworks/DiskImage.fwrk/src/DiskImage+EPM.cc +++ b/public/frameworks/DiskImage.fwrk/src/DiskImage+EPM.cc @@ -17,7 +17,7 @@ /// @return Status code upon completion. SInt32 DI::DIFormatPartitionEPM(struct DI_DISK_IMAGE& img) noexcept { if (!img.sector_sz || (img.sector_sz % 512 != 0)) return kDIFailureStatus; - + if (!img.fs_version) return kDIFailureStatus; if (*img.out_name == 0 || *img.disk_name == 0) return kDIFailureStatus; struct ::EPM_PART_BLOCK block {}; @@ -27,10 +27,11 @@ SInt32 DI::DIFormatPartitionEPM(struct DI_DISK_IMAGE& img) noexcept { block.Version = kEPMRevisionBcd; block.LbaStart = sizeof(struct ::EPM_PART_BLOCK); block.LbaEnd = img.disk_sz - block.LbaStart; - block.FsVersion = kNeFSVersionInteger; + block.FsVersion = img.fs_version; ::MmCopyMemory(block.Name, (VoidPtr) img.disk_name, ::MmStrLen(img.disk_name)); - ::MmCopyMemory(block.Magic, (VoidPtr) kEPMMagic86, ::MmStrLen(kEPMMagic86)); + + ::MmCopyMemory(block.Magic, (VoidPtr) kEPMMagic, ::MmStrLen(kEPMMagic)); IORef handle = IoOpenFile(img.out_name, nullptr); diff --git a/public/frameworks/KernelTest.fwrk/headers/KernelTest.h b/public/frameworks/KernelTest.fwrk/headers/KernelTest.h index 04e90964..70b1b9b3 100644 --- a/public/frameworks/KernelTest.fwrk/headers/KernelTest.h +++ b/public/frameworks/KernelTest.fwrk/headers/KernelTest.h @@ -11,21 +11,25 @@ /// @brief Kernel Test Framework. /// @file KernelTest.h -#define KT_TEST_VERSION_BCD (0x0001) -#define KT_TEST_VERSION "v0.0.1-kerneltest" +#define KT_TEST_VERSION_BCD (0x0002) +#define KT_TEST_VERSION "v0.0.2-kerneltest" #define KT_TEST_FAILURE (1) #define KT_TEST_SUCCESS (0) -#define KT_DECL_TEST(NAME, FN) \ - class KT_##NAME final { \ - public: \ - void Run(); \ - const char* ToString(); \ - }; \ - inline void KT_##NAME::Run() { MUST_PASS(FN() == true); } \ - inline const char* KT_##NAME::ToString() { return #FN; } +#define KT_DECL_TEST(NAME, FN) \ + class KT_##NAME final { \ + public: \ + Kernel::Void Run(); \ + const Kernel::Char* ToString(); \ + }; \ + inline Kernel::Void KT_##NAME::Run() { \ + MUST_PASS(FN() == true); \ + } \ + inline const Kernel::Char* KT_##NAME::ToString() { \ + return #FN; \ + } KT_DECL_TEST(ALWAYS_BREAK, []() -> bool { return false; }); KT_DECL_TEST(ALWAYS_GOOD, []() -> bool { return true; });
\ No newline at end of file diff --git a/public/frameworks/KernelTest.fwrk/src/UnitTests.cc b/public/frameworks/KernelTest.fwrk/src/UnitTests.cc new file mode 100644 index 00000000..07e7b129 --- /dev/null +++ b/public/frameworks/KernelTest.fwrk/src/UnitTests.cc @@ -0,0 +1,17 @@ +/* ------------------------------------------- + + Copyright (C) 2025, Amlal El Mahrouss, all rights reserved. + +------------------------------------------- */ + +#include <public/frameworks/KernelTest.fwrk/headers/KernelTest.h> + +EXTERN_C Kernel::Void KT_TestBreak() { + KT_ALWAYS_BREAK brk; + brk.Run(); +} + +EXTERN_C Kernel::Void KT_TestGood() { + KT_ALWAYS_GOOD good; + good.Run(); +}
\ No newline at end of file diff --git a/public/frameworks/OpenMSG.fwrk/src/DylibMain.cc b/public/frameworks/OpenMSG.fwrk/src/DylibMain.cc deleted file mode 100644 index 99eebd26..00000000 --- a/public/frameworks/OpenMSG.fwrk/src/DylibMain.cc +++ /dev/null @@ -1,5 +0,0 @@ -#include <libSystem/SystemKit/System.h> - -SInt32 _DylibAttach(SInt32 argc, Char* argv[]) { - return EXIT_FAILURE; -}
\ No newline at end of file diff --git a/public/frameworks/OpenMSG.fwrk/xml/.keep b/public/frameworks/OpenMSG.fwrk/xml/.keep deleted file mode 100644 index e69de29b..00000000 --- a/public/frameworks/OpenMSG.fwrk/xml/.keep +++ /dev/null diff --git a/public/frameworks/OpenMSG.fwrk/xml/app.xml b/public/frameworks/OpenMSG.fwrk/xml/app.xml deleted file mode 100644 index 6a46e598..00000000 --- a/public/frameworks/OpenMSG.fwrk/xml/app.xml +++ /dev/null @@ -1,2 +0,0 @@ -<PropertyList> -<PLEntry Type="CFString" Name="LibraryName" Len="12" Value="OpenMSG.fwrk" /></PropertyList>
\ No newline at end of file diff --git a/public/manuals/nekernel/mgmt.util.man b/public/manuals/nekernel/mgmt.util.man index 1c46002b..7f1bbba3 100644 --- a/public/manuals/nekernel/mgmt.util.man +++ b/public/manuals/nekernel/mgmt.util.man @@ -29,4 +29,4 @@ EXAMPLES Schedules `pgp-update.script` to run at 2:30PM on Wednesday, April 2026. RELEASE - System One — NeKernel
\ No newline at end of file + v1.0.0 — NeKernel.org
\ No newline at end of file diff --git a/public/manuals/nekernel/mgmt.util.man.html b/public/manuals/nekernel/mgmt.util.man.html deleted file mode 100644 index 6f1ddc13..00000000 --- a/public/manuals/nekernel/mgmt.util.man.html +++ /dev/null @@ -1,85 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - -<head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>mgmt Manual Page</title> - <style> - body { - font-family: monospace; - background-color: #f4f4f4; - padding: 2em; - color: #222; - } - - h1, - h2 { - border-bottom: 1px solid #aaa; - } - - code { - background: #eee; - padding: 0.2em 0.4em; - border-radius: 4px; - } - - section { - margin-bottom: 2em; - } - </style> -</head> - -<body> - <h1>mgmt</h1> - <section> - <h2>NAME</h2> - <p><strong>mgmt</strong> — Management utility command</p> - </section> - - <section> - <h2>SYNOPSIS</h2> - <p><code>mgmt [OPTIONS]</code></p> - </section> - - <section> - <h2>DESCRIPTION</h2> - <p> - The <code>mgmt</code> command provides scheduling, execution, and remote orchestration - capabilities within the System One operating environment. It serves as the main task - and maintenance utility for NeKernel deployments. - </p> - <ul> - <li>Schedule scripts or tasks for future execution.</li> - <li>Verify device or filesystem integrity.</li> - <li>Manage and automate remote NeKernel machines.</li> - </ul> - </section> - - <section> - <h2>OPTIONS</h2> - <ul> - <li><code>-s, --script <FILE></code>: Script to execute</li> - <li><code>-t, --time <HH:MMAM/PM></code>: Time to run the script</li> - <li><code>-d, --day <DAY></code>: Day of the week (e.g., Mon, Tue, Wed)</li> - <li><code>-m, --month <MONTH></code>: Month (e.g., Jan, Feb, Mar)</li> - <li><code>-y, --year <YYYY></code>: Year to schedule task</li> - <li><code>-r, --remote <ADDRESS></code>: Remote machine to manage (optional)</li> - <li><code>-v, --verify</code>: Run integrity checks only</li> - <li><code>-h, --help</code>: Display this help message</li> - </ul> - </section> - - <section> - <h2>EXAMPLES</h2> - <pre><code>mgmt -s pgp-update.script -t 2:30PM -d Wed -m Apr -y 2026</code></pre> - <p>Schedules <code>pgp-update.script</code> to run at 2:30PM on Wednesday, April 2026.</p> - </section> - - <section> - <h2>RELEASE</h2> - <p>System One — NeKernel</p> - </section> -</body> - -</html>
\ No newline at end of file diff --git a/public/tools/diutil/vendor/Dialogs.h b/public/tools/diutil/vendor/Dialogs.h index 84e239f5..ce50b811 100644 --- a/public/tools/diutil/vendor/Dialogs.h +++ b/public/tools/diutil/vendor/Dialogs.h @@ -175,7 +175,7 @@ namespace internal { #elif __EMSCRIPTEN__ void start(int exit_code); #else - void start_process(std::vector<std::string> const& command); + void start_process(std::vector<std::string> const& command); #endif ~executor(); @@ -490,10 +490,10 @@ inline settings::settings(bool resync) { #if _WIN32 flags(flag::is_vista) = internal::is_vista(); #elif !__APPLE__ - flags(flag::has_zenity) = check_program("zenity"); + flags(flag::has_zenity) = check_program("zenity"); flags(flag::has_matedialog) = check_program("matedialog"); - flags(flag::has_qarma) = check_program("qarma"); - flags(flag::has_kdialog) = check_program("kdialog"); + flags(flag::has_qarma) = check_program("qarma"); + flags(flag::has_kdialog) = check_program("kdialog"); // If multiple helpers are available, try to default to the best one if (flags(flag::has_zenity) && flags(flag::has_kdialog)) { @@ -540,7 +540,7 @@ inline bool settings::check_program(std::string const& program) { (void) program; return false; #else - int exit_code = -1; + int exit_code = -1; internal::executor async; async.start_process({"/bin/sh", "-c", "which " + program}); async.result(&exit_code); @@ -604,7 +604,7 @@ inline std::string path::home() { if (size_max != -1) len = size_t(size_max); #endif std::vector<char> buf(len); - struct passwd pwd, *result; + struct passwd pwd, *result; if (getpwuid_r(getuid(), &pwd, buf.data(), buf.size(), &result) == 0) return result->pw_dir; #endif return "/"; @@ -717,7 +717,7 @@ inline void internal::executor::start_process(std::vector<std::string> const& co } close(in[1]); - m_fd = out[0]; + m_fd = out[0]; auto flags = fcntl(m_fd, F_GETFL); fcntl(m_fd, F_SETFL, flags | O_NONBLOCK); @@ -753,7 +753,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */) // FIXME: do something (void) timeout; #else - char buf[BUFSIZ]; + char buf[BUFSIZ]; ssize_t received = read(m_fd, buf, BUFSIZ); // Flawfinder: ignore if (received > 0) { m_stdout += std::string(buf, received); @@ -764,7 +764,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */) // (this happens when the calling application handles or ignores SIG_CHLD) and results in // waitpid() failing with ECHILD. Otherwise we assume the child is running and we sleep for // a little while. - int status; + int status; pid_t child = waitpid(m_pid, &status, WNOHANG); if (child != m_pid && (child >= 0 || errno != ECHILD)) { // FIXME: this happens almost always at first iteration @@ -782,8 +782,7 @@ inline bool internal::executor::ready(int timeout /* = default_wait_timeout */) inline void internal::executor::stop() { // Loop until the user closes the dialog - while (!ready()) - ; + while (!ready()); } // dll implementation @@ -879,11 +878,11 @@ inline std::vector<std::string> internal::dialog::desktop_helper() const { #if __APPLE__ return {"osascript"}; #else - return {flags(flag::has_zenity) ? "zenity" + return {flags(flag::has_zenity) ? "zenity" : flags(flag::has_matedialog) ? "matedialog" - : flags(flag::has_qarma) ? "qarma" - : flags(flag::has_kdialog) ? "kdialog" - : "echo"}; + : flags(flag::has_qarma) ? "qarma" + : flags(flag::has_kdialog) ? "kdialog" + : "echo"}; #endif } @@ -1125,9 +1124,9 @@ inline internal::file_dialog::file_dialog(type in_type, std::string const& title // Split the pattern list to check whether "*" is in there; if it // is, we have to disable filters because there is no mechanism in // OS X for the user to override the filter. - std::regex sep("\\s+"); - std::string filter_list; - bool has_filter = true; + std::regex sep("\\s+"); + std::string filter_list; + bool has_filter = true; std::sregex_token_iterator iter(patterns.begin(), patterns.end(), sep, -1); std::sregex_token_iterator end; for (; iter != end; ++iter) { @@ -1236,7 +1235,7 @@ inline std::vector<std::string> internal::file_dialog::vector_result() { return m_vector_result; #else std::vector<std::string> ret; - auto result = m_async->result(); + auto result = m_async->result(); for (;;) { // Split result along newline characters auto i = result.find('\n'); @@ -1569,7 +1568,7 @@ inline message::message(std::string const& title, std::string const& text, if_cancel = button::ok; break; } - m_mappings[1] = if_cancel; + m_mappings[1] = if_cancel; m_mappings[256] = if_cancel; // XXX: I think this was never correct script += " with icon "; switch (_icon) { @@ -1656,7 +1655,7 @@ inline message::message(std::string const& title, std::string const& text, if (_choice == choice::yes_no_cancel) flag += "cancel"; command.push_back(flag); if (_choice == choice::yes_no || _choice == choice::yes_no_cancel) { - m_mappings[0] = button::yes; + m_mappings[0] = button::yes; m_mappings[256] = button::no; } } diff --git a/public/frameworks/OpenMSG.fwrk/.keep b/public/tools/mgmt.oe/.keep index e69de29b..e69de29b 100644 --- a/public/frameworks/OpenMSG.fwrk/.keep +++ b/public/tools/mgmt.oe/.keep diff --git a/public/frameworks/OpenMSG.fwrk/OpenMSG.json b/public/tools/mgmt.oe/mgmt.oe.json index 4bda8798..b4e9d586 100644 --- a/public/frameworks/OpenMSG.fwrk/OpenMSG.json +++ b/public/tools/mgmt.oe/mgmt.oe.json @@ -9,7 +9,7 @@ "./" ], "sources_path": [], - "output_name": "./dist/libOpenMSG.fwrk.dylib", + "output_name": "./dist/mgmt.oe", "cpp_macros": [ "kSampleFWVersion=0x0100", "kSampleFWVersionHighest=0x0100", diff --git a/public/frameworks/OpenMSG.fwrk/headers/.keep b/public/tools/mgmt.oe/src/.keep index e69de29b..e69de29b 100644 --- a/public/frameworks/OpenMSG.fwrk/headers/.keep +++ b/public/tools/mgmt.oe/src/.keep diff --git a/public/tools/mgmt.oe/src/CommandLine.cc b/public/tools/mgmt.oe/src/CommandLine.cc new file mode 100644 index 00000000..3a0c192d --- /dev/null +++ b/public/tools/mgmt.oe/src/CommandLine.cc @@ -0,0 +1,30 @@ +/* ------------------------------------------- + + Copyright (C) 2025, Amlal El Mahrouss, all rights reserved. + +------------------------------------------- */ + +#include <libSystem/SystemKit/Jail.h> +#include <libSystem/SystemKit/System.h> + +/// @author Amlal El Mahrouss +/// @brief OpenEnclave management tool + +static JAIL* kJailSrv = nullptr; + +SInt32 _NeMain(SInt32 argc, Char* argv[]) { + LIBSYS_UNUSED(argc); + LIBSYS_UNUSED(argv); + + kJailSrv = ::JailGetCurrent(); + + MUST_PASS(kJailSrv); + + ::PrintOut(nullptr, "%s", "mgmt.oe: OpenEnclave Management Tool."); + + /// @note JailGetCurrent returns client as nullptr if we're not that client (we'll not be able to + /// access the jail then) + if (kJailSrv->fClient == nullptr) return EXIT_FAILURE; + + return EXIT_FAILURE; +}
\ No newline at end of file diff --git a/public/frameworks/OpenMSG.fwrk/src/.keep b/public/tools/mgmt.oe/vendor/.keep index e69de29b..e69de29b 100644 --- a/public/frameworks/OpenMSG.fwrk/src/.keep +++ b/public/tools/mgmt.oe/vendor/.keep |
