forked from Hyperion/HyperionOS
made vfs changes
This commit is contained in:
@@ -58,14 +58,12 @@ local function allocFD(task)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function allocFD(task)
|
local function allocFD(task)
|
||||||
-- enforce per-task limit
|
|
||||||
local count = 0
|
local count = 0
|
||||||
for _ in pairs(task.fd) do count = count + 1 end
|
for _ in pairs(task.fd) do count = count + 1 end
|
||||||
if count >= kernel.config.maxFilesPerTask then
|
if count >= kernel.config.maxFilesPerTask then
|
||||||
error("EMFILE") -- Too many open files in this task
|
error("EMFILE")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- find first free FD
|
|
||||||
local fd = 0
|
local fd = 0
|
||||||
while task.fd[fd] do fd = fd + 1 end
|
while task.fd[fd] do fd = fd + 1 end
|
||||||
return fd
|
return fd
|
||||||
@@ -74,7 +72,7 @@ end
|
|||||||
local total=0
|
local total=0
|
||||||
local function checkSystemLimit()
|
local function checkSystemLimit()
|
||||||
if total >= kernel.config.maxOpenFiles-16 then
|
if total >= kernel.config.maxOpenFiles-16 then
|
||||||
error("ENFILE") -- Too many open files in the system
|
error("ENFILE")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user