Skip to content
This repository has been archived by the owner on Feb 19, 2023. It is now read-only.

Commit

Permalink
[struct process] palloc -> malloc
Browse files Browse the repository at this point in the history
  • Loading branch information
CCXXXI committed Jan 12, 2021
1 parent f08d73f commit 077011a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/userprog/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "threads/init.h"
#include "threads/interrupt.h"
#include "threads/palloc.h"
#include "threads/malloc.h"
#include "threads/thread.h"
#include "threads/vaddr.h"

Expand Down Expand Up @@ -207,7 +208,7 @@ int process_wait(tid_t child_tid)
list_remove(&child->elem);
list_remove(&child->allelem);
int exit_code = child->exit_code;
palloc_free_page(child);
free(child);

return exit_code;
}
Expand Down Expand Up @@ -591,7 +592,7 @@ static bool install_page(void *upage, void *kpage, bool writable)
struct process *process_create(struct thread *t)
{
/* Allocate process. */
struct process *p = palloc_get_page(PAL_ZERO);
struct process *p = malloc(sizeof(struct process));
if (p == NULL)
return NULL;

Expand Down
2 changes: 1 addition & 1 deletion src/userprog/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ static pid_t exec(const char *cmd_line)
if (child->status == PROCESS_FAILED)
{
sema_down(&child->sema_wait);
palloc_free_page(child);
free(child);
return -1;
}
else
Expand Down

0 comments on commit 077011a

Please sign in to comment.