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