1.2 dev #21

Merged
Astronand merged 2 commits from 1.2-dev into main 2026-08-15 22:41:41 -04:00
5 changed files with 20 additions and 12 deletions
Showing only changes of commit bb28d24674 - Show all commits
@@ -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)
+2 -2
View File
@@ -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)
+2 -2
View File
@@ -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
+2 -2
View File
@@ -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()
BIN
View File
Binary file not shown.