forked from Hyperion/HyperionOS
Compare commits
2 Commits
3cc1459769
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 93c3bab263 | |||
| 5bd16b8fd4 |
@@ -1,6 +1,5 @@
|
|||||||
--:Minify:--
|
--:Minify:--
|
||||||
local fs = require("sys.fs")
|
local fs = require("sys.fs")
|
||||||
|
|
||||||
local targetUser = ({ ... })[1] or "root"
|
local targetUser = ({ ... })[1] or "root"
|
||||||
|
|
||||||
local currentUid = syscall.getuid()
|
local currentUid = syscall.getuid()
|
||||||
@@ -72,6 +71,10 @@ if not shellFn then
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
syscall.kill(syscall.getppid())
|
local success, err = syscall.kill(syscall.getppid())
|
||||||
syscall.spawn(shellFn, targetUser .. ":" .. shell, syscall.getEnviron())
|
if success then
|
||||||
syscall.exit(0)
|
syscall.spawn(shellFn, targetUser .. ":" .. shell, syscall.getEnviron())
|
||||||
|
syscall.exit(0)
|
||||||
|
else
|
||||||
|
print("su: "..err)
|
||||||
|
end
|
||||||
@@ -129,9 +129,6 @@ function sys.kill(pid)
|
|||||||
if not tasks[tostring(pid)] then
|
if not tasks[tostring(pid)] then
|
||||||
return false, "Task does not exist"
|
return false, "Task does not exist"
|
||||||
|
|
||||||
elseif not isEqualToAny(tasks[tostring(pid)].pid, table.unpack(children)) and kernel.uid ~= 0 then
|
|
||||||
return false, "You do not own this task"
|
|
||||||
|
|
||||||
elseif tasks[tostring(pid)].status == "Z" then
|
elseif tasks[tostring(pid)].status == "Z" then
|
||||||
return false, "Task is already dead"
|
return false, "Task is already dead"
|
||||||
|
|
||||||
@@ -148,9 +145,6 @@ function sys.stop(pid)
|
|||||||
if not tasks[tostring(pid)] then
|
if not tasks[tostring(pid)] then
|
||||||
return false, "Task does not exist"
|
return false, "Task does not exist"
|
||||||
|
|
||||||
elseif not isEqualToAny(tasks[tostring(pid)].pid, table.unpack(children)) and kernel.uid ~= 0 then
|
|
||||||
return false, "You do not own this task"
|
|
||||||
|
|
||||||
elseif tasks[tostring(pid)].status ~= "R" then
|
elseif tasks[tostring(pid)].status ~= "R" then
|
||||||
return false, "Cannot stop non running task"
|
return false, "Cannot stop non running task"
|
||||||
|
|
||||||
@@ -166,9 +160,6 @@ function sys.continue(pid)
|
|||||||
if not tasks[tostring(pid)] then
|
if not tasks[tostring(pid)] then
|
||||||
return false, "Task does not exist"
|
return false, "Task does not exist"
|
||||||
|
|
||||||
elseif not isEqualToAny(tasks[tostring(pid)].pid, table.unpack(children)) and kernel.uid ~= 0 then
|
|
||||||
return false, "You do not own this task"
|
|
||||||
|
|
||||||
elseif tasks[tostring(pid)].status ~= "T" then
|
elseif tasks[tostring(pid)].status ~= "T" then
|
||||||
return false, "Task is not stopped"
|
return false, "Task is not stopped"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user