Compare commits
No commits in common. "aa90e4a8d949a64797656126aed35985bbf2c170" and "656667812a5a8e21f5369a62ba0c7a986baa200d" have entirely different histories.
aa90e4a8d9
...
656667812a
@ -174,14 +174,6 @@ int main()
|
|||||||
}
|
}
|
||||||
else { printf("Success!! Got PID %ld\n", child); }
|
else { printf("Success!! Got PID %ld\n", child); }
|
||||||
|
|
||||||
child = fork();
|
|
||||||
if (child < 0)
|
|
||||||
{
|
|
||||||
perror("fork");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (child == 0) { *(int*)(0xdeadbeef) = 1234; }
|
|
||||||
|
|
||||||
int status;
|
int status;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
@ -51,6 +51,8 @@ extern "C" void common_handler(Context* context)
|
|||||||
StackTracer tracer(context->rbp);
|
StackTracer tracer(context->rbp);
|
||||||
tracer.trace_with_ip(context->rip);
|
tracer.trace_with_ip(context->rip);
|
||||||
|
|
||||||
|
hang(); // FIXME: Remove this when multiple address spaces are working.
|
||||||
|
|
||||||
Scheduler::task_misbehave(context, -3);
|
Scheduler::task_misbehave(context, -3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,17 +287,8 @@ void Scheduler::task_misbehave(Context* context, int64_t status)
|
|||||||
{
|
{
|
||||||
ASSERT(Interrupts::is_in_handler());
|
ASSERT(Interrupts::is_in_handler());
|
||||||
kdbgln("exit: task %ld misbehaved, used %ld ms of cpu time", sched_current_task->id, sched_current_task->cpu_time);
|
kdbgln("exit: task %ld misbehaved, used %ld ms of cpu time", sched_current_task->id, sched_current_task->cpu_time);
|
||||||
if (sched_current_task->id == 1) sched_current_task->state = sched_current_task->Exited;
|
sched_current_task->state = sched_current_task->Exited;
|
||||||
else
|
|
||||||
sched_current_task->state = sched_current_task->Dying;
|
|
||||||
sched_current_task->exit_status = status;
|
sched_current_task->exit_status = status;
|
||||||
if (sched_current_task->id != 1)
|
|
||||||
{
|
|
||||||
sched_for_each_child(sched_current_task, [](Task* child) {
|
|
||||||
if (child->state != child->Exited) child->ppid = 1;
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
task_yield(context);
|
task_yield(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,9 +42,6 @@ extern "C"
|
|||||||
/* Returns a new file associated with the file descriptor fd. */
|
/* Returns a new file associated with the file descriptor fd. */
|
||||||
FILE* fdopen(int fd, const char* mode);
|
FILE* fdopen(int fd, const char* mode);
|
||||||
|
|
||||||
/* Opens the file specified by pathname and points the file handle stream to it. */
|
|
||||||
FILE* freopen(const char* pathname, const char* mode, FILE* stream);
|
|
||||||
|
|
||||||
/* Returns the file descriptor associated with the file stream. */
|
/* Returns the file descriptor associated with the file stream. */
|
||||||
int fileno(FILE* stream);
|
int fileno(FILE* stream);
|
||||||
|
|
||||||
|
@ -51,20 +51,6 @@ extern "C"
|
|||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE* freopen(const char* pathname, const char* mode,
|
|
||||||
FILE* stream) // FIXME: If pathname is NULL, open the original file with the new mode.
|
|
||||||
{
|
|
||||||
int fd = open(pathname, O_RDWR); // FIXME: Use the mode string.
|
|
||||||
if (fd < 0) { return 0; }
|
|
||||||
|
|
||||||
fflush(stream); // To make it future-proof.
|
|
||||||
fclose(stream);
|
|
||||||
|
|
||||||
stream->f_fd = fd;
|
|
||||||
clearerr(stream);
|
|
||||||
return stream;
|
|
||||||
}
|
|
||||||
|
|
||||||
int fileno(FILE* stream)
|
int fileno(FILE* stream)
|
||||||
{
|
{
|
||||||
return stream->f_fd;
|
return stream->f_fd;
|
||||||
|
Loading…
Reference in New Issue
Block a user