forked from Hyperion/HyperionOS
added setuid syscall
This commit is contained in:
@@ -28,6 +28,7 @@ for i,v in ipairs(files) do
|
||||
kernel.log("Error loading startup script '" .. filepath .. "': " .. err, "ERROR")
|
||||
else
|
||||
syscall.spawn(function()
|
||||
syscall.setuid(1)
|
||||
syscall.IO_bind("eventQueue:"..tostring(i))
|
||||
local spot = #eventQueues+1
|
||||
eventQueues[spot]="eventQueue:"..tostring(i)
|
||||
|
||||
@@ -207,6 +207,11 @@ function sys.exit(code)
|
||||
end
|
||||
end
|
||||
|
||||
function sys.setuid(uid)
|
||||
if kernel.uid~=0 then error("EACCES") end
|
||||
kernel.currentTask.uid=uid
|
||||
end
|
||||
|
||||
local sysc=kernel.syscalls
|
||||
sysc["spawn"]=sys.spawn
|
||||
sysc["sleep"]=sys.sleep
|
||||
@@ -221,6 +226,7 @@ sysc["getTasks"]=sys.getTasks
|
||||
sysc["setEnviron"]=sys.setEnviron
|
||||
sysc["getEnviron"]=sys.getEnviron
|
||||
sysc["exit"]=sys.exit
|
||||
sysc["setuid"]=sys.setuid
|
||||
kernel._G.sleep=function(...)coroutine.yield("syscall","sleep",...)end
|
||||
|
||||
local function reapDeadTasks()
|
||||
@@ -291,7 +297,6 @@ function kernel.main()
|
||||
end
|
||||
if task.status == "R" then
|
||||
kernel.currentTask = task
|
||||
kernel.vfs.cwd = task.cwd
|
||||
kernel.user = task.user
|
||||
kernel.uid = task.uid
|
||||
kernel.process = task.name
|
||||
|
||||
@@ -22,8 +22,11 @@ preempt<bool>
|
||||
enable/disable preemptive multitasking
|
||||
|
||||
debugSyscalls<bool>
|
||||
logs syscalls and thier return values aswell as what task executed them
|
||||
logs syscalls and their return values aswell as what task executed them
|
||||
|
||||
logTaskExit<bool>
|
||||
logs task exits and errors
|
||||
|
||||
showModLoad<bool>
|
||||
log mofule loads
|
||||
```
|
||||
Reference in New Issue
Block a user