test_proc.lua (1644B)
1 -- Test /proc filesystem functionality 2 osprint("\n=== Testing /proc Filesystem ===\n") 3 4 -- Function to list /proc directory 5 local function listProc() 6 osprint("\nCurrent /proc contents:\n") 7 if CRamdiskExists and CRamdiskExists("/proc") then 8 if CRamdiskList then 9 local entries = CRamdiskList("/proc") 10 if entries and #entries > 0 then 11 for i = 1, #entries do 12 osprint(" PID: " .. entries[i] .. "\n") 13 14 -- Try to read the process file 15 local procFile = "/proc/" .. entries[i] .. "/process" 16 if CRamdiskExists(procFile) then 17 if CRamdiskOpen and CRamdiskRead and CRamdiskClose then 18 local handle = CRamdiskOpen(procFile, "r") 19 if handle then 20 local content = CRamdiskRead(handle) 21 CRamdiskClose(handle) 22 osprint(" Content: " .. content) 23 end 24 end 25 end 26 end 27 else 28 osprint(" /proc is empty\n") 29 end 30 end 31 else 32 osprint(" /proc directory does not exist yet\n") 33 end 34 end 35 36 -- Check initial state 37 osprint("\n1. Initial state (before any apps):\n") 38 listProc() 39 40 -- Wait a bit for LPM and background to start 41 osprint("\n2. Waiting for system apps to start...\n") 42 for i = 1, 1000000 do end -- Simple busy wait 43 44 osprint("\n3. After system initialization:\n") 45 listProc() 46 47 osprint("\n=== Test Complete ===\n\n")