diff --git a/Src/Hyperion-kernel/data/lib/modules/hyperion/45_hypervisor.kmod b/Src/Hyperion-kernel/data/lib/modules/hyperion/45_hypervisor.kmod index 9ab0178..6ad7531 100644 --- a/Src/Hyperion-kernel/data/lib/modules/hyperion/45_hypervisor.kmod +++ b/Src/Hyperion-kernel/data/lib/modules/hyperion/45_hypervisor.kmod @@ -31,10 +31,18 @@ local function loadExecutable(path) return func, euid, suid_set end -local function createTask(func, name, envars, args, tgid, real_uid, eff_uid) +local function createTask(func, name, envars, args, tgid, real_uid, eff_uid, clearFds) local id = nextpid nextpid = nextpid + 1 + local fds={} + if not clearFds then + for id, file in pairs(kernel.currentTask.fd) do + file.refcount=file.refcount+1 + fds[id]=file + end + end + tasks[tostring(id)] = { coro = coroutine.create(function() local ok, err = xpcall(func, debug.traceback, table.unpack(args or {})) @@ -71,7 +79,7 @@ local function createTask(func, name, envars, args, tgid, real_uid, eff_uid) euid = eff_uid, gid = (kernel.currentTask and kernel.currentTask.gid) or 0, groups = (kernel.currentTask and kernel.currentTask.groups) or {}, - fd = {}, + fd = fds, sleep = 0, ivs = 0, vs = 0, @@ -93,14 +101,14 @@ local function createTask(func, name, envars, args, tgid, real_uid, eff_uid) return id end -function sys.spawn(func, name, envars, args, tgid) +function sys.spawn(func, name, envars, args, tgid, clearFds) local caller = kernel.currentTask local real_uid = caller and caller.uid or kernel.uid local eff_uid = caller and caller.euid or real_uid - return createTask(func, name, envars, args, tgid, real_uid, eff_uid) + return createTask(func, name, envars, args, tgid, real_uid, eff_uid, clearFds) end -function sys.execspawn(path, name, envars, args, tgid) +function sys.execspawn(path, name, envars, args, tgid, keepFds) local func, euid, suid_active = loadExecutable(path, kernel._U) local caller = kernel.currentTask @@ -114,7 +122,7 @@ function sys.execspawn(path, name, envars, args, tgid) ) end - return createTask(func, name or path, envars, args, tgid, real_uid, euid) + return createTask(func, name or path, envars, args, tgid, real_uid, euid, not keepFds) end function sys.exec(path, args, envars) diff --git a/Src/hysh/data/bin/hysh b/Src/hysh/data/bin/hysh index 3e178f9..abb0bec 100644 --- a/Src/hysh/data/bin/hysh +++ b/Src/hysh/data/bin/hysh @@ -1222,7 +1222,7 @@ local function runCommand(command) -- compiled from disk by the kernel (via loadExecutable -> freshUserEnv), -- so the child cannot share any upvalue or syscall table state with hysh. syscall.exec(cmdPath, {table.unpack(args, 2)}) - end, progName) + end, progName, nil, nil, nil, true) while true do local exited, code = syscall.collect(proc) @@ -1231,7 +1231,7 @@ local function runCommand(command) return end if terminate then - local ok2 = syscall.kill(proc) + local ok2 = syscall.kill(proc, true) if ok2 then syscall.devctl(1,"sbgc",16); syscall.devctl(1,"sfgc",0xFF0000) print("\nProgram Terminated."); syscall.devctl(1,"sfgc",0xFFFFFF) diff --git a/Src/spm/data/bin/spm b/Src/spm/data/bin/spm index 09e3b13..fc04121 100644 --- a/Src/spm/data/bin/spm +++ b/Src/spm/data/bin/spm @@ -547,7 +547,7 @@ local spm = function(...) if cloptions.u then for i,v in ipairs(table.keys(pkgdb)) do local pkg, err = getPkg(v) - if pkg then + if pkg and not found[v] then needed[#needed+1] = pkg found[v]=true end @@ -586,7 +586,7 @@ local spm = function(...) local files = {} for _,v in ipairs(needed) do - if not pkgdb[v.id] or not pkgdb[v.id].hash==v.hash then + if not pkgdb[v.id] or not pkgdb[v.id].hash==v.hash or cloptions.u then w("Downloading "..v.id) local resp = get(v.tar) if not resp then diff --git a/Src/sysinit/data/usr/lib/sysinit/sysinit b/Src/sysinit/data/usr/lib/sysinit/sysinit index 0b67bfa..dd9ec91 100644 --- a/Src/sysinit/data/usr/lib/sysinit/sysinit +++ b/Src/sysinit/data/usr/lib/sysinit/sysinit @@ -14,7 +14,7 @@ for i,v in pairs(kernel.processes) do else kernel.log("Successfully executed kernel task: " .. i) end - end, i) + end, i, nil,nil,nil,true) end -- config file path setup @@ -42,7 +42,7 @@ for i,v in ipairs(files) do else kernel.log("Successfully executed startup script: " .. filepath) end - end, "startup:" .. v) + end, "startup:" .. v, nil,nil,nil,true) end end kernel.saveLog() diff --git a/out b/out deleted file mode 100644 index f7d6e4d..0000000 Binary files a/out and /dev/null differ