Fix more printf() conformance problems.
[pintos-anon] / solutions / p3.patch
index 806177e853f8763abf0c11f87833fff212a683b4..e891eaf85a17b9e511bb90dc7b291bbb094d24b7 100644 (file)
@@ -141,7 +141,7 @@ diff -urpN pintos.orig/src/threads/thread.c pintos/src/threads/thread.c
  thread_exit (void) 
  {
 +  struct thread *t = thread_current ();
-+  list_elem *e, *next;
++  struct list_elem *e, *next;
 +
    ASSERT (!intr_context ());
  
@@ -184,7 +184,7 @@ diff -urpN pintos.orig/src/threads/thread.c pintos/src/threads/thread.c
 +thread_join (tid_t child_tid) 
 +{
 +  struct thread *cur = thread_current ();
-+  list_elem *e;
++  struct list_elem *e;
 +
 +  for (e = list_begin (&cur->children); e != list_end (&cur->children); ) 
 +    {
@@ -235,11 +235,11 @@ diff -urpN pintos.orig/src/threads/thread.h pintos/src/threads/thread.h
 +    struct latch ready_to_die;          /* Release when thread about to die. */
 +    struct semaphore can_die;           /* Up when thread allowed to die. */
 +    struct list children;               /* List of child threads. */
-+    list_elem children_elem;            /* Element of `children' list. */
++    struct list_elem children_elem;     /* Element of `children' list. */
 +    int ret_code;                       /* Return status. */
 +
      /* Shared between thread.c and synch.c. */
-     list_elem elem;                     /* List element. */
+     struct list_elem elem;              /* List element. */
  
  #ifdef USERPROG
      /* Owned by userprog/process.c. */
@@ -291,7 +291,7 @@ diff -urpN pintos.orig/src/userprog/exception.c pintos/src/userprog/exception.c
    bool user;         /* True: access by user, false: access by kernel. */
    void *fault_addr;  /* Fault address. */
 +  struct user_page tmp_up, *up;
-+  hash_elem *e;
++  struct hash_elem *e;
  
    /* Obtain faulting address, the virtual address that was
       accessed to cause the fault.  It may point to code or to
@@ -400,14 +400,15 @@ diff -urpN pintos.orig/src/userprog/process.c pintos/src/userprog/process.c
      }
  }
  
-@@ -182,7 +189,10 @@ struct Elf32_Phdr
+@@ -182,7 +189,11 @@ struct Elf32_Phdr
  #define PF_R 4          /* Readable. */
  
  static bool load_segment (struct file *, const struct Elf32_Phdr *);
 -static bool setup_stack (void **esp);
 +static bool setup_stack (const char *cmdline, void **esp);
-+static unsigned user_page_hash (const hash_elem *, void *);
-+static bool user_page_less (const hash_elem *, const hash_elem *, void *);
++static unsigned user_page_hash (const struct hash_elem *, void *);
++static bool user_page_less (const struct hash_elem *, const struct hash_elem *,
++                            void *);
 +static struct user_page *make_user_page (void *upage);
  
  /* Aborts loading an executable, with an error message. */
@@ -500,7 +501,7 @@ diff -urpN pintos.orig/src/userprog/process.c pintos/src/userprog/process.c
  
    /* Is this a read-only segment?  Not currently used, so it's
       commented out.  You'll want to use it when implementing VM
-@@ -340,70 +380,206 @@ load_segment (struct file *file, const s
+@@ -340,70 +380,207 @@ load_segment (struct file *file, const s
  
    /* Load the segment page-by-page into memory. */
    filesz_left = phdr->p_filesz + (phdr->p_vaddr & PGMASK);
@@ -634,7 +635,7 @@ diff -urpN pintos.orig/src/userprog/process.c pintos/src/userprog/process.c
 +}
 +
 +static unsigned
-+user_page_hash (const hash_elem *e, void *aux UNUSED) 
++user_page_hash (const struct hash_elem *e, void *aux UNUSED) 
 +{
 +  struct user_page *up = hash_entry (e, struct user_page, elem);
 +  return hash_bytes (&up->upage, sizeof up->upage);
@@ -643,7 +644,8 @@ diff -urpN pintos.orig/src/userprog/process.c pintos/src/userprog/process.c
 -  kpage = palloc_get_page (PAL_USER | PAL_ZERO);
 -  if (kpage != NULL) 
 +static bool
-+user_page_less (const hash_elem *a_, const hash_elem *b_, void *aux UNUSED) 
++user_page_less (const struct hash_elem *a_,
++                const struct hash_elem *b_, void *aux UNUSED) 
 +{
 +  struct user_page *a = hash_entry (a_, struct user_page, elem);
 +  struct user_page *b = hash_entry (b_, struct user_page, elem);
@@ -757,7 +759,7 @@ diff -urpN pintos.orig/src/userprog/process.h pintos/src/userprog/process.h
 +
 +struct user_page 
 +  {
-+    hash_elem elem;
++    struct hash_elem elem;
 +    void *upage;                /* Virtual address of mapping. */
 +
 +    /* If FRAME is nonnull, the page is in memory.
@@ -1005,7 +1007,7 @@ diff -urpN pintos.orig/src/userprog/syscall.c pintos/src/userprog/syscall.c
 +
 +struct fildes
 +  {
-+    list_elem elem;
++    struct list_elem elem;
 +    struct file *file;
 +    int handle;
 +  };
@@ -1042,7 +1044,7 @@ diff -urpN pintos.orig/src/userprog/syscall.c pintos/src/userprog/syscall.c
 +lookup_fd (int handle) 
 +{
 +  struct thread *cur = thread_current ();
-+  list_elem *e;
++  struct list_elem *e;
 +  
 +  for (e = list_begin (&cur->fds); e != list_end (&cur->fds);
 +       e = list_next (e))
@@ -1207,7 +1209,7 @@ diff -urpN pintos.orig/src/userprog/syscall.c pintos/src/userprog/syscall.c
 +syscall_exit (void) 
 +{
 +  struct thread *cur = thread_current ();
-+  list_elem *e, *next;
++  struct list_elem *e, *next;
 +  
 +  for (e = list_begin (&cur->fds); e != list_end (&cur->fds); e = next)
 +    {