fixed task cleanup fd errors
This commit is contained in:
@@ -15,8 +15,7 @@ function fs.open(path, mode)
|
|||||||
end,
|
end,
|
||||||
flush=function()
|
flush=function()
|
||||||
-- close and reopen file to flush buffers
|
-- close and reopen file to flush buffers
|
||||||
syscall.close(fd)
|
syscall.fsync(fd)
|
||||||
fd=syscall.open(path,mode)
|
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
if mode=="r" then
|
if mode=="r" then
|
||||||
|
|||||||
@@ -339,7 +339,6 @@ end
|
|||||||
|
|
||||||
-- Write
|
-- Write
|
||||||
function vfs.write(fd, content)
|
function vfs.write(fd, content)
|
||||||
kernel.log(tostring(fd).."|"..content)
|
|
||||||
local task = kernel.currentTask
|
local task = kernel.currentTask
|
||||||
local file = task.fd[fd]
|
local file = task.fd[fd]
|
||||||
if not file then error("EBADF") end
|
if not file then error("EBADF") end
|
||||||
|
|||||||
@@ -234,6 +234,10 @@ kernel._G.sleep = function(...) coroutine.yield("syscall", "sleep", ...) end
|
|||||||
local function reapDeadTasks()
|
local function reapDeadTasks()
|
||||||
for pid, task in pairs(tasks) do
|
for pid, task in pairs(tasks) do
|
||||||
if task.status == "Z" and not task.reapTime then
|
if task.status == "Z" and not task.reapTime then
|
||||||
|
kernel.currentTask = task
|
||||||
|
kernel.username = task.username
|
||||||
|
kernel.uid = task.uid
|
||||||
|
kernel.process = task.name
|
||||||
task.coro = nil
|
task.coro = nil
|
||||||
task.ivs = nil
|
task.ivs = nil
|
||||||
task.vs = nil
|
task.vs = nil
|
||||||
@@ -302,7 +306,7 @@ function kernel.main()
|
|||||||
kernel.uid = task.uid
|
kernel.uid = task.uid
|
||||||
kernel.process = task.name
|
kernel.process = task.name
|
||||||
N = N + 1
|
N = N + 1
|
||||||
|
|
||||||
-- assign adaptive time slice
|
-- assign adaptive time slice
|
||||||
task.timeSlice = math.min(Tmax, math.max(Tmin, B / (N ^ alpha)))
|
task.timeSlice = math.min(Tmax, math.max(Tmin, B / (N ^ alpha)))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user