Compare commits
No commits in common. "9c3792718ce2e9f0b4ed8c752acc07c04a630a49" and "c68d040484c89ba121ebdb88ab44b47c7a65999c" have entirely different histories.
9c3792718c
...
c68d040484
@ -7,7 +7,6 @@
|
|||||||
#define E2BIG 7
|
#define E2BIG 7
|
||||||
#define ENOEXEC 8
|
#define ENOEXEC 8
|
||||||
#define EBADF 9
|
#define EBADF 9
|
||||||
#define ECHILD 10
|
|
||||||
#define EAGAIN 11
|
#define EAGAIN 11
|
||||||
#define ENOMEM 12
|
#define ENOMEM 12
|
||||||
#define EACCES 13
|
#define EACCES 13
|
||||||
|
@ -510,16 +510,10 @@ void sys_waitpid(Context* context, long pid, int* wstatus,
|
|||||||
child = Scheduler::find_by_pid(pid);
|
child = Scheduler::find_by_pid(pid);
|
||||||
if (!child)
|
if (!child)
|
||||||
{
|
{
|
||||||
context->rax = -ECHILD;
|
context->rax = -ESRCH;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (child->ppid != sched_current_task->id)
|
|
||||||
{
|
|
||||||
// We are trying to call waitpid() on a task that isn't a child of ours. This is not allowed.
|
|
||||||
context->rax = -ECHILD;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (child->state != child->Dying)
|
if (child->state != child->Dying)
|
||||||
{
|
{
|
||||||
if (options & WNOHANG)
|
if (options & WNOHANG)
|
||||||
@ -537,6 +531,7 @@ void sys_waitpid(Context* context, long pid, int* wstatus,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
kdbgln("blocking wait on pid %ld", pid);
|
||||||
sched_current_task->state = sched_current_task->Blocking;
|
sched_current_task->state = sched_current_task->Blocking;
|
||||||
sched_current_task->block_reason = BlockReason::Waiting;
|
sched_current_task->block_reason = BlockReason::Waiting;
|
||||||
sched_current_task->blocking_wait_info.wait_pid = pid;
|
sched_current_task->blocking_wait_info.wait_pid = pid;
|
||||||
@ -588,8 +583,6 @@ bool Task::is_wait_still_blocking()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
child = Scheduler::find_by_pid(blocking_wait_info.wait_pid);
|
child = Scheduler::find_by_pid(blocking_wait_info.wait_pid);
|
||||||
ASSERT(child); // since sys_waitpid should have validated this child, and the only way for it to disappear from
|
|
||||||
// the process list is for someone to wait for it, this should be pretty safe.
|
|
||||||
if (child->state != child->Dying) return true;
|
if (child->state != child->Dying) return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
@ -603,6 +596,8 @@ void Task::resume_wait()
|
|||||||
Task* child = Scheduler::find_by_pid(blocking_wait_info.wait_pid);
|
Task* child = Scheduler::find_by_pid(blocking_wait_info.wait_pid);
|
||||||
ASSERT(child); // This should also already have been validated.
|
ASSERT(child); // This should also already have been validated.
|
||||||
|
|
||||||
|
kdbgln("resuming wait on child %ld", child->id);
|
||||||
|
|
||||||
if (blocking_wait_info.wstatus)
|
if (blocking_wait_info.wstatus)
|
||||||
{
|
{
|
||||||
*blocking_wait_info.wstatus = (int)(child->exit_status & 0xff);
|
*blocking_wait_info.wstatus = (int)(child->exit_status & 0xff);
|
||||||
|
@ -12,7 +12,6 @@ extern int errno;
|
|||||||
#define E2BIG 7 // Argument list too long
|
#define E2BIG 7 // Argument list too long
|
||||||
#define ENOEXEC 8 // Exec format error
|
#define ENOEXEC 8 // Exec format error
|
||||||
#define EBADF 9 // Bad file descriptor
|
#define EBADF 9 // Bad file descriptor
|
||||||
#define ECHILD 10 // No child processes
|
|
||||||
#define EAGAIN 11 // Resource temporarily unavailable
|
#define EAGAIN 11 // Resource temporarily unavailable
|
||||||
#define ENOMEM 12 // Cannot allocate memory
|
#define ENOMEM 12 // Cannot allocate memory
|
||||||
#define EACCES 13 // Permission denied
|
#define EACCES 13 // Permission denied
|
||||||
|
@ -265,7 +265,6 @@ extern "C"
|
|||||||
case E2BIG: return "Argument list too long";
|
case E2BIG: return "Argument list too long";
|
||||||
case ENOEXEC: return "Exec format error";
|
case ENOEXEC: return "Exec format error";
|
||||||
case EBADF: return "Bad file descriptor";
|
case EBADF: return "Bad file descriptor";
|
||||||
case ECHILD: return "No child processes";
|
|
||||||
case EAGAIN: return "Resource temporarily unavailable";
|
case EAGAIN: return "Resource temporarily unavailable";
|
||||||
case ENOMEM: return "Cannot allocate memory";
|
case ENOMEM: return "Cannot allocate memory";
|
||||||
case EACCES: return "Permission denied";
|
case EACCES: return "Permission denied";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user