spm works maybe?

This commit is contained in:
2026-08-14 20:44:11 -04:00
parent 56646625c0
commit 10aa0c62ff
82 changed files with 1706 additions and 535 deletions
@@ -690,7 +690,9 @@ function vfs.open(path, mode)
local handle
if disk:type(diskPath) ~= "directory" then
handle = disk:open(diskPath, mode)
if type(handle) ~= "table" then error("ENFILE") end
if type(handle, true) ~= "table" then
error("ENFILE")
end
end
if isNew then
@@ -761,7 +763,7 @@ function vfs.close(fd)
local task = kernel.currentTask
local file = task.fd[fd]
if not file then error("EBADF") end
if not task.fd[fd].isvirt then
if not task.fd[fd].isvirt then
total = total - 1
end
task.fd[fd] = nil
@@ -1147,6 +1149,12 @@ function vfs.devctl(fd, method, ...)
return kernel.currentTask.fd[fd].handle[method](...)
end
function vfs.devlst(fd)
if not kernel.currentTask.fd[fd] then error("EBADF") end
if not kernel.currentTask.fd[fd] then error("EINVAL") end
return table.keys(kernel.currentTask.fd[fd].handle)
end
vfs.resolveMount = resolveMount
local sys = kernel.syscalls
@@ -1179,6 +1187,7 @@ sys["chroot"] = vfs.chroot
sys["dup"] = vfs.dup
sys["dup2"] = vfs.dup2
sys["devctl"] = vfs.devctl
sys["devlst"] = vfs.devlst
sys["symlink"] = vfs.symlink
sys["readlink"] = vfs.readlink
sys["access"] = vfs.access
@@ -214,6 +214,8 @@ end
data[".meta"]=strFile(buildMeta({
stdin="/proc/self/fd/0",
stdout="/proc/self/fd/1",
stderr="/proc/self/2",
fd="/proc/self/fd",
log="/var/log/syslog.log"
}))
@@ -222,6 +224,7 @@ if kernel.EFI.getEEPROM then
if op=="type" then
return "character device"
elseif op=="open" then
if kernel.uid~=0 then error("EACCES") end
if mode=="r" then
local ptr,eeprom=1,kernel.EFI:getEEPROM()
return {
@@ -231,7 +234,6 @@ if kernel.EFI.getEEPROM then
end
}
elseif mode=="w" then
if kernel.uid~=0 then error("EACCES") end
local firstwrite=true
return {
write=function(data)
@@ -243,7 +245,6 @@ if kernel.EFI.getEEPROM then
end
}
elseif mode=="a" then
if kernel.uid~=0 then error("EACCES") end
return {
write=function(data)
kernel.EFI:setEEPROM(kernel.EFI:getEEPROM()..data)
@@ -260,6 +261,7 @@ if kernel.EFI.getNvram then
if op=="type" then
return "character device"
elseif op=="open" then
if kernel.uid~=0 then error("EACCES") end
if mode=="r" then
local ptr,nvram=1,kernel.EFI:getNvram()
return {
@@ -269,7 +271,6 @@ if kernel.EFI.getNvram then
end
}
elseif mode=="w" then
if kernel.uid~=0 then error("EACCES") end
local firstwrite=true
return {
write=function(data)
@@ -281,7 +282,6 @@ if kernel.EFI.getNvram then
end
}
elseif mode=="a" then
if kernel.uid~=0 then error("EACCES") end
return {
write=function(data)
kernel.EFI:setNvram(kernel.EFI:getNvram()..data)
@@ -294,7 +294,15 @@ if kernel.EFI.getNvram then
end
data["disk"]={["by-id"]={}, ["by-path"]={}, ["by-label"]={}}
-- disks
for i,v in pairs(kernel.vfs.mounts) do
end
data["raw"]={["by-type"]={}}
data["gfx"]={}
data["input"]={}
data["tty"]={}
kernel.devfs={}
kernel.devfs.data=data
kernel.devfs.proxy=proxy
@@ -150,7 +150,6 @@ function sys.exec(path, args, envars)
tasks[tostring(task.pid)].status = "Z"
end)
task.syscallReturn = {}
coroutine.yield()
end
function sys.sleep(s)
@@ -1,3 +1,4 @@
--:Minify:--
local kernel = ...
kernel.processes.kgc = function()
while true do
@@ -6,6 +7,6 @@ kernel.processes.kgc = function()
kernel.reqcache[i] = nil
end
end
kernel.sleep(5000)
sleep(5)
end
end