fix: set content to the new thread_list node
fix: copy child to the current_pcb
This commit is contained in:
@ -61,8 +61,8 @@ static int deep_copy(struct pcb *new_pcb)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
PD[i + USER_PT_END / 2] = (uint32_t)new_pt | INIT_FLAGS;
|
PD[i + USER_PT_END / 2] = (uint32_t)new_pt | INIT_FLAGS;
|
||||||
if (!copy_pt(PTE2VA(1023, i), PTE2VA(1023, i + USER_PT_END / 2),
|
if (copy_pt(PTE2VA(1023, i), PTE2VA(1023, i + USER_PT_END / 2),
|
||||||
i)) {
|
i) < 0) {
|
||||||
free_pts();
|
free_pts();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -83,7 +83,7 @@ pid_t fork(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
new_pcb->daddy = current_pcb;
|
new_pcb->daddy = current_pcb;
|
||||||
lst_add_back(&new_pcb->children, new_node);
|
lst_add_back(¤t_pcb->children, new_node);
|
||||||
|
|
||||||
if (deep_copy(new_pcb) < 0)
|
if (deep_copy(new_pcb) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
@ -105,6 +105,7 @@ pid_t fork(void)
|
|||||||
memcpy(new_content, it->content, sizeof(struct tcb));
|
memcpy(new_content, it->content, sizeof(struct tcb));
|
||||||
new_content->process = new_pcb;
|
new_content->process = new_pcb;
|
||||||
e->next = NULL;
|
e->next = NULL;
|
||||||
|
e->content = new_content;
|
||||||
prev = e;
|
prev = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user