Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
205 changes: 0 additions & 205 deletions src/compatibility/antix.rs
Original file line number Diff line number Diff line change
@@ -1,208 +1,3 @@
// 1. Systemd-Free Init Manager (Runit/SysV Parity)

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MicroServiceState {
Stopped = 0,
Starting = 1,
Running = 2,
Failed = 3,
}

pub struct MicroService {
pub name: &'static str,
pub state: AtomicU8,
}

impl MicroService {
pub const fn new(name: &'static str) -> Self {
Self {
name,
state: AtomicU8::new(MicroServiceState::Stopped as u8),
}
}

pub fn start(&self) {
self.state
.store(MicroServiceState::Starting as u8, Ordering::SeqCst);
println!("antiX-Init: Starting micro-service: '{}'...", self.name);
self.state
.store(MicroServiceState::Running as u8, Ordering::SeqCst);
println!(
"antiX-Init: Service '{}' is now running safely (Systemd-Free).",
self.name
);
}

pub fn stop(&self) {
self.state
.store(MicroServiceState::Stopped as u8, Ordering::SeqCst);
println!("antiX-Init: Stopped service: '{}'.", self.name);
}

pub fn get_state(&self) -> MicroServiceState {
match self.state.load(Ordering::SeqCst) {
0 => MicroServiceState::Stopped,
1 => MicroServiceState::Starting,
2 => MicroServiceState::Running,
_ => MicroServiceState::Failed,
}
}
}

pub struct AntixInitManager {
pub services: [MicroService; 3],
}

impl AntixInitManager {
pub const fn new() -> Self {
Self {
services: [
MicroService::new("sysv-networking"),
MicroService::new("runit-udev-bridge"),
MicroService::new("antix-dbus-shim"),
],
}
}

pub fn boot_systemd_free(&self) {
println!("antiX-Init: Initiating ultra-fast Systemd-Free boot sequence...");
for service in &self.services {
service.start();
}
println!("antiX-Init: Boot sequence completed successfully. High-performance system operational.");
}
}

// 2. Composable Low-Memory Desktop Profiler

#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum DesktopProfile {
IceWM = 0,
Fluxbox = 1,
JWM = 2,
}

impl DesktopProfile {
fn from_u8(val: u8) -> Self {
match val {
0 => DesktopProfile::IceWM,
1 => DesktopProfile::Fluxbox,
_ => DesktopProfile::JWM,
}
}

fn to_u8(self) -> u8 {
self as u8
}
}

pub struct AntixDesktopProfiler {
pub active_profile: AtomicU8,
}

impl AntixDesktopProfiler {
pub const fn new() -> Self {
Self {
active_profile: AtomicU8::new(DesktopProfile::IceWM as u8),
}
}

/// Hot-swaps low-overhead compositor presets to preserve RAM on early systems
pub fn apply_profile(&self, profile: DesktopProfile) {
self.active_profile.store(profile.to_u8(), Ordering::SeqCst);
match profile {
DesktopProfile::IceWM => {
println!("antiX-Desktop: Applied IceWM-parity template. Allocated compositor memory: ~12 MB.");
}
DesktopProfile::Fluxbox => {
println!("antiX-Desktop: Applied Fluxbox-parity template. Allocated compositor memory: ~8 MB.");
}
DesktopProfile::JWM => {
println!("antiX-Desktop: Applied JWM-parity template. Allocated compositor memory: ~4 MB (Maximum RAM protection).");
}
}
}

pub fn get_profile(&self) -> DesktopProfile {
DesktopProfile::from_u8(self.active_profile.load(Ordering::SeqCst))
}
}

// 3. Central Control Center & Legacy Hardware Coordinator

pub struct AntixControlCenter {
pub sound_driver_oss: AtomicBool,
pub legacy_vga_compat: AtomicBool,
}

impl AntixControlCenter {
pub const fn new() -> Self {
Self {
sound_driver_oss: AtomicBool::new(true), // OSS-sound card support active
legacy_vga_compat: AtomicBool::new(true), // 640x480 standard VGA mode
}
}

pub fn auto_configure_legacy_hardware(&self) {
println!("antiX-ControlCenter: Probing low-end vintage peripheral matrix...");
if self.sound_driver_oss.load(Ordering::SeqCst) {
println!(
" -> Vintage OSS card detected. Initializing AdLib/SoundBlaster-parity channels."
);
}
if self.legacy_vga_compat.load(Ordering::SeqCst) {
println!(" -> VGA compatible hardware map activated. Bypassing modern GPU buffer constraints.");
}
}
}

// 4. Memory Trimmer (Aggressive Buffer Reclaimer)

pub struct LegacyMemoryTrimmer {
pub trim_aggressiveness: AtomicUsize,
}

impl LegacyMemoryTrimmer {
pub const fn new() -> Self {
Self {
trim_aggressiveness: AtomicUsize::new(5), // scale of 1-10
}
}

/// Reclaims allocated but unused file systems, device queues, and UI caching buffers
/// Allows SigmaOS to scale down dynamically to run in legacy 256MB RAM constraints
pub fn trim_caches(&self, available_ram_mb: usize) -> usize {
let aggressiveness = self.trim_aggressiveness.load(Ordering::SeqCst);
if available_ram_mb < 512 {
println!(
"MemoryTrimmer: Critical RAM limit! Only {} MB available. Escalating reclaimer to maximum...",
available_ram_mb
);
self.trim_aggressiveness.store(10, Ordering::SeqCst);
let bytes_reclaimed = available_ram_mb * 1024 * aggressiveness * 40;
println!(
"MemoryTrimmer: Succeeded in purging {} bytes of caching buffers.",
bytes_reclaimed
);
bytes_reclaimed
} else {
let bytes_reclaimed = available_ram_mb * 1024 * aggressiveness * 5;
bytes_reclaimed
}
}
}

// Global Static antiX Parity Instances

pub static GLOBAL_ANTIX_INIT: AntixInitManager = AntixInitManager::new();
pub static GLOBAL_ANTIX_DESKTOP: AntixDesktopProfiler = AntixDesktopProfiler::new();
pub static GLOBAL_ANTIX_CONTROL: AntixControlCenter = AntixControlCenter::new();
pub static GLOBAL_MEMORY_TRIMMER: LegacyMemoryTrimmer = LegacyMemoryTrimmer::new();
||||||| 43be3a7e8
// SigmaOS antiX-Linux Parity & Legacy Hardware Optimization Shard
// Zero-dependency, #![no_std] compliant, highly-optimized for low-end hardware
// Bypasses standard resource overhead through a systemd-free init model, custom task trimmers, and zero-allocation visual swap profiles.

use core::sync::atomic::{AtomicBool, AtomicU8, AtomicUsize, Ordering};

// 1. Systemd-Free Init Manager (Runit/SysV Parity)
Expand Down
Loading