Compare commits

..

No commits in common. "aa90e4a8d949a64797656126aed35985bbf2c170" and "656667812a5a8e21f5369a62ba0c7a986baa200d" have entirely different histories.

5 changed files with 3 additions and 35 deletions

View File

@ -174,14 +174,6 @@ int main()
}
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;
for (;;)
{

View File

@ -51,6 +51,8 @@ extern "C" void common_handler(Context* context)
StackTracer tracer(context->rbp);
tracer.trace_with_ip(context->rip);
hang(); // FIXME: Remove this when multiple address spaces are working.
Scheduler::task_misbehave(context, -3);
}
}

View File

@ -287,17 +287,8 @@ void Scheduler::task_misbehave(Context* context, int64_t status)
{
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);
if (sched_current_task->id == 1) sched_current_task->state = sched_current_task->Exited;
else
sched_current_task->state = sched_current_task->Dying;
sched_current_task->state = sched_current_task->Exited;
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);
}

View File

@ -42,9 +42,6 @@ extern "C"
/* Returns a new file associated with the file descriptor fd. */
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. */
int fileno(FILE* stream);

View File

@ -51,20 +51,6 @@ extern "C"
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)
{
return stream->f_fd;