sys_open(): actually return EMFILE if the process has used all of its file slots
This commit is contained in:
parent
6c51477197
commit
2a755fcd93
@ -19,12 +19,12 @@ void sys_write(Context* context, const char* addr, size_t size)
|
|||||||
void sys_open(Context* context, const char* filename, int flags)
|
void sys_open(Context* context, const char* filename, int flags)
|
||||||
{
|
{
|
||||||
Task* current_task = Scheduler::current_task();
|
Task* current_task = Scheduler::current_task();
|
||||||
int fd = -1;
|
int fd;
|
||||||
for (fd = 0; fd < TASK_MAX_FDS; fd++)
|
for (fd = 0; fd < TASK_MAX_FDS; fd++)
|
||||||
{
|
{
|
||||||
if (!current_task->files[fd].is_open()) break;
|
if (!current_task->files[fd].is_open()) break;
|
||||||
}
|
}
|
||||||
if (fd == -1)
|
if (fd == TASK_MAX_FDS)
|
||||||
{
|
{
|
||||||
STDIO_FAIL(open, EMFILE);
|
STDIO_FAIL(open, EMFILE);
|
||||||
context->rax = -EMFILE;
|
context->rax = -EMFILE;
|
||||||
|
Loading…
Reference in New Issue
Block a user