Przeglądaj źródła

[LibOS] Fix compilation errors with -Wunused-parameter flags

Don Porter 5 lat temu
rodzic
commit
27213b18e0
56 zmienionych plików z 433 dodań i 268 usunięć
  1. 3 3
      LibOS/shim/include/shim_checkpoint.h
  2. 8 17
      LibOS/shim/include/shim_fs.h
  3. 2 2
      LibOS/shim/include/shim_handle.h
  4. 42 3
      LibOS/shim/include/shim_internal.h
  5. 0 2
      LibOS/shim/include/shim_ipc.h
  6. 0 10
      LibOS/shim/include/shim_ipc_ns.h
  7. 2 2
      LibOS/shim/include/shim_thread.h
  8. 1 1
      LibOS/shim/src/Makefile
  9. 5 3
      LibOS/shim/src/bookkeep/shim_handle.c
  10. 14 7
      LibOS/shim/src/bookkeep/shim_signal.c
  11. 8 2
      LibOS/shim/src/bookkeep/shim_thread.c
  12. 3 0
      LibOS/shim/src/bookkeep/shim_vma.c
  13. 8 1
      LibOS/shim/src/elf/shim_rtld.c
  14. 8 12
      LibOS/shim/src/fs/chroot/fs.c
  15. 41 3
      LibOS/shim/src/fs/dev/fs.c
  16. 5 0
      LibOS/shim/src/fs/pipe/fs.c
  17. 13 3
      LibOS/shim/src/fs/proc/fs.c
  18. 9 0
      LibOS/shim/src/fs/proc/info.c
  19. 3 1
      LibOS/shim/src/fs/proc/ipc-thread.c
  20. 12 3
      LibOS/shim/src/fs/proc/thread.c
  21. 2 8
      LibOS/shim/src/fs/shim_dcache.c
  22. 11 5
      LibOS/shim/src/fs/shim_fs.c
  23. 9 24
      LibOS/shim/src/fs/shim_namei.c
  24. 2 0
      LibOS/shim/src/fs/socket/fs.c
  25. 1 0
      LibOS/shim/src/ipc/shim_ipc.c
  26. 14 26
      LibOS/shim/src/ipc/shim_ipc_child.c
  27. 5 1
      LibOS/shim/src/ipc/shim_ipc_helper.c
  28. 1 55
      LibOS/shim/src/ipc/shim_ipc_nsimpl.h
  29. 5 2
      LibOS/shim/src/ipc/shim_ipc_pid.c
  30. 6 0
      LibOS/shim/src/ipc/shim_ipc_sysv.c
  31. 1 1
      LibOS/shim/src/shim_async.c
  32. 28 1
      LibOS/shim/src/shim_checkpoint.c
  33. 8 0
      LibOS/shim/src/shim_debug.c
  34. 6 0
      LibOS/shim/src/shim_init.c
  35. 49 47
      LibOS/shim/src/shim_parser.c
  36. 1 0
      LibOS/shim/src/shim_syscalls.c
  37. 2 2
      LibOS/shim/src/sys/shim_access.c
  38. 6 0
      LibOS/shim/src/sys/shim_alarm.c
  39. 4 0
      LibOS/shim/src/sys/shim_brk.c
  40. 1 1
      LibOS/shim/src/sys/shim_clone.c
  41. 4 0
      LibOS/shim/src/sys/shim_epoll.c
  42. 3 3
      LibOS/shim/src/sys/shim_exec.c
  43. 1 0
      LibOS/shim/src/sys/shim_fork.c
  44. 6 0
      LibOS/shim/src/sys/shim_fs.c
  45. 13 1
      LibOS/shim/src/sys/shim_ioctl.c
  46. 4 5
      LibOS/shim/src/sys/shim_migrate.c
  47. 11 0
      LibOS/shim/src/sys/shim_msgget.c
  48. 3 0
      LibOS/shim/src/sys/shim_poll.c
  49. 1 0
      LibOS/shim/src/sys/shim_sandbox.c
  50. 1 0
      LibOS/shim/src/sys/shim_sched.c
  51. 11 6
      LibOS/shim/src/sys/shim_sigaction.c
  52. 14 0
      LibOS/shim/src/sys/shim_socket.c
  53. 1 0
      LibOS/shim/src/sys/shim_stat.c
  54. 2 0
      LibOS/shim/src/sys/shim_time.c
  55. 1 0
      LibOS/shim/src/sys/shim_wait.c
  56. 8 5
      LibOS/shim/src/utils/printf.c

+ 3 - 3
LibOS/shim/include/shim_checkpoint.h

@@ -282,7 +282,8 @@ enum {
 
 #define END_CP_FUNC_NO_RS(name)                                     \
     END_CP_FUNC(name)                                               \
-    BEGIN_RS_FUNC(name) {} END_RS_FUNC(name)
+    BEGIN_RS_FUNC(name) {__UNUSED(entry); __UNUSED(base);           \
+        __UNUSED(offset); __UNUSED(rebase); } END_RS_FUNC(name)
 
 #define BEGIN_RS_FUNC(name)                                         \
     DEFINE_RS_FUNC(name)                                            \
@@ -460,7 +461,6 @@ int restore_from_file (const char * filename, struct newproc_cp_header * hdr,
 void restore_context (struct shim_context * context);
 
 int create_checkpoint (const char * cpdir, IDTYPE * session);
-int join_checkpoint (struct shim_thread * cur, ucontext_t * context,
-                     IDTYPE sid);
+int join_checkpoint (struct shim_thread * cur, IDTYPE sid);
 
 #endif /* _SHIM_CHECKPOINT_H_ */

+ 8 - 17
LibOS/shim/include/shim_fs.h

@@ -41,8 +41,8 @@ struct shim_handle;
 #define FS_POLL_SZ         0x08
 
 struct shim_fs_ops {
-    /* mount: moun an uri to the certain location */
-    int (*mount) (const char * uri, const char * root, void ** mount_data);
+    /* mount: mount an uri to the certain location */
+    int (*mount) (const char * uri, void ** mount_data);
     int (*unmount) (void * mount_data);
 
     /* close: clean up the file state inside the handle */
@@ -180,13 +180,11 @@ struct shim_d_ops {
      * On a successful lookup  (non-error, can be negative),
      * this function should call get_new_dentry(), populating additional fields,
      * and storing the new dentry in dent.
-     *
-     * Maybe drop force?
      */
-    int (*lookup) (struct shim_dentry * dent, bool force);
+    int (*lookup) (struct shim_dentry * dent);
 
     /* this is to check file type and access, returning the stat.st_mode */
-    int (*mode) (struct shim_dentry * dent, mode_t * mode, bool force);
+    int (*mode) (struct shim_dentry * dent, mode_t * mode);
 
     /* detach internal data from dentry */
     int (*dput) (struct shim_dentry * dent);
@@ -341,21 +339,16 @@ extern struct shim_lock dcache_lock;
 /* check permission (specified by mask) of a dentry. If force is not set,
  * permission is considered granted on invalid dentries */
 /* Assume caller has acquired dcache_lock */
-int permission (struct shim_dentry * dent, mode_t mask, bool force);
+int permission (struct shim_dentry * dent, mode_t mask);
 
 /* This function looks up a single dentry based on its parent dentry pointer
  * and the name.  Namelen is the length of char * name.
  * The dentry is returned in pointer *new.
  *
- * The force flag causes the libOS to query the underlying file system for the
- * existence of the dentry, whereas without force, a negative dentry is
- * treated as definitive.  In some cases, this can be elided as an
- * optimization.
- *
  * The caller should hold the dcache_lock.
  */
 int lookup_dentry (struct shim_dentry * parent, const char * name, int namelen,
-                   bool force, struct shim_dentry ** new, struct shim_mount * fs);
+                   struct shim_dentry ** new, struct shim_mount * fs);
 
 /* Looks up path under start dentry.  Saves in dent.
  *
@@ -517,9 +510,7 @@ struct shim_dentry * get_new_dentry (struct shim_mount *mount,
                                      const char * name, int namelen,
                                      HASHTYPE * hashptr);
 
-/* This function searches for name/namelen (as the relative path;
- * path/pathlen is the fully-qualified path),
- * under parent dentry (start).
+/* This function searches for name/namelen (as the relative path).
  *
  * If requested, the expected hash of the dentry is returned in hashptr,
  * primarily so that the hashing can be reused to add the dentry later.
@@ -530,7 +521,7 @@ struct shim_dentry * get_new_dentry (struct shim_mount *mount,
  */
 struct shim_dentry *
 __lookup_dcache (struct shim_dentry * start, const char * name, int namelen,
-                 const char * path, int pathlen, HASHTYPE * hashptr);
+                 HASHTYPE * hashptr);
 
 /* This function recursively deletes and frees all dentries under root
  *

+ 2 - 2
LibOS/shim/include/shim_handle.h

@@ -419,8 +419,8 @@ int flush_handle_map (struct shim_handle_map * map);
 void get_handle_map (struct shim_handle_map * map);
 void put_handle_map (struct shim_handle_map * map);
 int walk_handle_map (int (*callback) (struct shim_fd_handle *,
-                                      struct shim_handle_map *, void *),
-                     struct shim_handle_map * map, void * arg);
+                                      struct shim_handle_map *),
+                     struct shim_handle_map * map);
 
 int init_handle (void);
 int init_important_handles (void);

+ 42 - 3
LibOS/shim/include/shim_internal.h

@@ -378,6 +378,44 @@ void parse_syscall_after (int sysno, const char * name, int nr, ...);
 #define SHIM_PASS_ARGS_5 SHIM_PASS_ARGS_4, __arg5
 #define SHIM_PASS_ARGS_6 SHIM_PASS_ARGS_5, __arg6
 
+#define SHIM_UNUSED_ARGS_0()
+
+#define SHIM_UNUSED_ARGS_1() do {               \
+        __UNUSED(__arg1);                       \
+    } while (0)
+#define SHIM_UNUSED_ARGS_2() do {               \
+        __UNUSED(__arg1);                       \
+        __UNUSED(__arg2);                       \
+    } while (0)
+#define SHIM_UNUSED_ARGS_3() do {               \
+        __UNUSED(__arg1);                       \
+        __UNUSED(__arg2);                       \
+        __UNUSED(__arg3);                       \
+    } while (0)
+#define SHIM_UNUSED_ARGS_4() do {               \
+        __UNUSED(__arg1);                       \
+        __UNUSED(__arg2);                       \
+        __UNUSED(__arg3);                       \
+        __UNUSED(__arg4);                       \
+    } while (0)
+
+#define SHIM_UNUSED_ARGS_5() do {               \
+        __UNUSED(__arg1);                       \
+        __UNUSED(__arg2);                       \
+        __UNUSED(__arg3);                       \
+        __UNUSED(__arg4);                       \
+        __UNUSED(__arg5);                       \
+    } while (0)
+
+#define SHIM_UNUSED_ARGS_6() do {               \
+        __UNUSED(__arg1);                       \
+        __UNUSED(__arg2);                       \
+        __UNUSED(__arg3);                       \
+        __UNUSED(__arg4);                       \
+        __UNUSED(__arg5);                       \
+        __UNUSED(__arg6);                       \
+    } while (0)
+
 #define DO_SYSCALL(...) DO_SYSCALL2(__VA_ARGS__)
 #define DO_SYSCALL2(n, ...) -ENOSYS
 
@@ -394,6 +432,7 @@ void parse_syscall_after (int sysno, const char * name, int nr, ...);
     DEFINE_PROFILE_INTERVAL(syscall_##name, syscall);               \
     BEGIN_SHIM(name, SHIM_PROTO_ARGS_##n)                           \
         debug("WARNING: shim_" #name " not implemented\n");         \
+        SHIM_UNUSED_ARGS_##n();                                     \
         ret = DO_SYSCALL_##n(__NR_##name);                          \
     END_SHIM(name)                                                  \
     EXPORT_SHIM_SYSCALL(name, n, __VA_ARGS__)
@@ -422,7 +461,7 @@ static inline void enable_locking (void)
         lock_enabled = true;
 }
 
-static inline PAL_HANDLE thread_create (void * func, void * arg, int option)
+static inline PAL_HANDLE thread_create (void * func, void * arg)
 {
     assert(lock_enabled);
     return DkThreadCreate(func, arg);
@@ -454,7 +493,7 @@ static inline void __enable_preempt (shim_tcb_t * tcb)
     //debug("enable preempt: %d\n", tcb->context.preempt & ~SIGNAL_DELAYED);
 }
 
-void __handle_signal (shim_tcb_t * tcb, int sig, ucontext_t * uc);
+void __handle_signal (shim_tcb_t * tcb, int sig);
 
 static inline void enable_preempt (shim_tcb_t * tcb)
 {
@@ -465,7 +504,7 @@ static inline void enable_preempt (shim_tcb_t * tcb)
         return;
 
     if ((tcb->context.preempt & ~SIGNAL_DELAYED) == 1)
-        __handle_signal(tcb, 0, NULL);
+        __handle_signal(tcb, 0);
 
     __enable_preempt(tcb);
 }

+ 0 - 2
LibOS/shim/include/shim_ipc.h

@@ -596,8 +596,6 @@ int do_ipc_duplex (struct shim_ipc_msg_obj * msg,
                    struct shim_ipc_port * port, unsigned long * seq,
                    void * private_data);
 
-void ipc_parent_exit  (struct shim_ipc_port * port, IDTYPE vmid,
-                       unsigned int exitcode);
 void ipc_child_exit   (struct shim_ipc_port * port, IDTYPE vmid,
                        unsigned int exitcode);
 

+ 0 - 10
LibOS/shim/include/shim_ipc_ns.h

@@ -32,7 +32,6 @@
     /* LEASE    */ &ipc_##ns##_lease_callback,      \
     /* OFFER    */ &ipc_##ns##_offer_callback,      \
     /* RENEW    */ &ipc_##ns##_renew_callback,      \
-    /* REVOKE   */ &ipc_##ns##_revoke_callback,     \
     /* SUBLEASE */ &ipc_##ns##_sublease_callback,   \
     /* QUERY    */ &ipc_##ns##_query_callback,      \
     /* QUERYALL */ &ipc_##ns##_queryall_callback,   \
@@ -103,7 +102,6 @@ enum {
     NS_CODE(LEASE),
     NS_CODE(OFFER),
     NS_CODE(RENEW),
-    NS_CODE(REVOKE),
     NS_CODE(SUBLEASE),
     NS_CODE(QUERY),
     NS_CODE(QUERYALL),
@@ -155,14 +153,6 @@ NS_MSG_TYPE(renew) {
 int NS_SEND(renew) (IDTYPE base, IDTYPE size);
 int NS_CALLBACK(renew) (IPC_CALLBACK_ARGS);
 
-/* REVOKE: revoke lease of a range of name */
-NS_MSG_TYPE(revoke) {
-    IDTYPE base, size;
-} __attribute__((packed));
-
-int NS_SEND(revoke) (IDTYPE base, IDTYPE size);
-int NS_CALLBACK(revoke) (IPC_CALLBACK_ARGS);
-
 /* SUBLEASE: lease a range of names */
 NS_MSG_TYPE(sublease) {
     IDTYPE tenant;

+ 2 - 2
LibOS/shim/include/shim_thread.h

@@ -267,10 +267,10 @@ int check_last_thread (struct shim_thread * self);
 void switch_dummy_thread (struct shim_thread * thread);
 
 int walk_thread_list (int (*callback) (struct shim_thread *, void *, bool *),
-                      void * arg, bool may_write);
+                      void * arg);
 int walk_simple_thread_list (int (*callback) (struct shim_simple_thread *,
                                               void *, bool *),
-                             void * arg, bool may_write);
+                             void * arg);
 
 /* reference counting of handle maps */
 void get_handle_map (struct shim_handle_map * map);

+ 1 - 1
LibOS/shim/src/Makefile

@@ -12,7 +12,7 @@ CFLAGS	= -Wall -fPIC -std=c11 -Winline -Wwrite-strings \
 	  -fno-stack-protector -fno-builtin -Wno-inline \
 	  -I../include -I../../../Pal/lib -I../../../Pal/include/pal
 
-EXTRAFLAGS = -Wextra -Wno-unused-parameter
+EXTRAFLAGS = -Wextra
 
 CFLAGS += $(EXTRAFLAGS)
 

+ 5 - 3
LibOS/shim/src/bookkeep/shim_handle.c

@@ -754,8 +754,8 @@ done:
 }
 
 int walk_handle_map (int (*callback) (struct shim_fd_handle *,
-                                      struct shim_handle_map *, void *),
-                     struct shim_handle_map * map, void * arg)
+                                      struct shim_handle_map *),
+                     struct shim_handle_map * map)
 {
     int ret = 0;
     lock(&map->lock);
@@ -767,7 +767,7 @@ int walk_handle_map (int (*callback) (struct shim_fd_handle *,
         if (!HANDLE_ALLOCATED(map->map[i]))
             continue;
 
-        if ((ret = (*callback) (map->map[i], map, arg)) < 0)
+        if ((ret = (*callback) (map->map[i], map)) < 0)
             break;
     }
 
@@ -841,6 +841,7 @@ END_CP_FUNC(handle)
 BEGIN_RS_FUNC(handle)
 {
     struct shim_handle * hdl = (void *) (base + GET_CP_FUNC_ENTRY());
+    __UNUSED(offset);
 
     CP_REBASE(hdl->fs);
     CP_REBASE(hdl->dentry);
@@ -938,6 +939,7 @@ END_CP_FUNC(handle_map)
 BEGIN_RS_FUNC(handle_map)
 {
     struct shim_handle_map * handle_map = (void *) (base + GET_CP_FUNC_ENTRY());
+    __UNUSED(offset);
 
     CP_REBASE(handle_map->map);
     assert(handle_map->map);

+ 14 - 7
LibOS/shim/src/bookkeep/shim_signal.c

@@ -60,7 +60,7 @@ allocate_signal_log (struct shim_thread * thread, int sig)
 }
 
 static struct shim_signal *
-fetch_signal_log (shim_tcb_t * tcb, struct shim_thread * thread, int sig)
+fetch_signal_log (struct shim_thread * thread, int sig)
 {
     struct shim_signal_log * log = &thread->signal_logs[sig - 1];
     struct shim_signal * signal = NULL;
@@ -175,7 +175,7 @@ void deliver_signal (siginfo_t * info, PAL_CONTEXT * context)
             free(signal);
         }
     } else {
-        __handle_signal(tcb, sig, &signal->context);
+        __handle_signal(tcb, sig);
         __handle_one_signal(tcb, sig, signal);
     }
 
@@ -523,6 +523,8 @@ static void illegal_upcall (PAL_PTR event, PAL_NUM arg, PAL_CONTEXT * context)
 
 static void quit_upcall (PAL_PTR event, PAL_NUM arg, PAL_CONTEXT * context)
 {
+    __UNUSED(arg);
+    __UNUSED(context);
     if (!is_internal_tid(get_cur_tid())) {
         deliver_signal(ALLOC_SIGINFO(SIGTERM, SI_USER, si_pid, 0), NULL);
     }
@@ -531,6 +533,8 @@ static void quit_upcall (PAL_PTR event, PAL_NUM arg, PAL_CONTEXT * context)
 
 static void suspend_upcall (PAL_PTR event, PAL_NUM arg, PAL_CONTEXT * context)
 {
+    __UNUSED(arg);
+    __UNUSED(context);
     if (!is_internal_tid(get_cur_tid())) {
         deliver_signal(ALLOC_SIGINFO(SIGINT, SI_USER, si_pid, 0), NULL);
     }
@@ -539,6 +543,8 @@ static void suspend_upcall (PAL_PTR event, PAL_NUM arg, PAL_CONTEXT * context)
 
 static void resume_upcall (PAL_PTR event, PAL_NUM arg, PAL_CONTEXT * context)
 {
+    __UNUSED(arg);
+    __UNUSED(context);
     shim_tcb_t * tcb = shim_get_tls();
     if (!tcb || !tcb->tp)
         return;
@@ -548,7 +554,7 @@ static void resume_upcall (PAL_PTR event, PAL_NUM arg, PAL_CONTEXT * context)
         if ((tcb->context.preempt & ~SIGNAL_DELAYED) > 1) {
             tcb->context.preempt |= SIGNAL_DELAYED;
         } else {
-            __handle_signal(tcb, 0, NULL);
+            __handle_signal(tcb, 0);
         }
         __enable_preempt(tcb);
     }
@@ -600,7 +606,7 @@ __handle_one_signal (shim_tcb_t * tcb, int sig, struct shim_signal * signal)
     void (*handler) (int, siginfo_t *, void *) = NULL;
 
     if (signal->info.si_signo == SIGCP) {
-        join_checkpoint(thread, &signal->context, SI_CP_SESSION(&signal->info));
+        join_checkpoint(thread, SI_CP_SESSION(&signal->info));
         return;
     }
 
@@ -662,7 +668,7 @@ __handle_one_signal (shim_tcb_t * tcb, int sig, struct shim_signal * signal)
                sizeof(PAL_CONTEXT));
 }
 
-void __handle_signal (shim_tcb_t * tcb, int sig, ucontext_t * uc)
+void __handle_signal (shim_tcb_t * tcb, int sig)
 {
     struct shim_thread * thread = (struct shim_thread *) tcb->tp;
     int begin_sig = 1, end_sig = NUM_KNOWN_SIGS;
@@ -677,7 +683,7 @@ void __handle_signal (shim_tcb_t * tcb, int sig, ucontext_t * uc)
 
         for ( ; sig < end_sig ; sig++)
             if (!__sigismember(&thread->signal_mask, sig) &&
-                (signal = fetch_signal_log(tcb, thread, sig)))
+                (signal = fetch_signal_log(thread, sig)))
                 break;
 
         if (!signal)
@@ -710,7 +716,7 @@ void handle_signal (bool delayed_only)
         debug("signal delayed (%ld)\n", tcb->context.preempt & ~SIGNAL_DELAYED);
         tcb->context.preempt |= SIGNAL_DELAYED;
     } else if (!(delayed_only && !(tcb->context.preempt & SIGNAL_DELAYED))) {
-        __handle_signal(tcb, 0, NULL);
+        __handle_signal(tcb, 0);
     }
 
     __enable_preempt(tcb);
@@ -750,6 +756,7 @@ void append_signal (struct shim_thread * thread, int sig, siginfo_t * info,
 
 static void sighandler_kill (int sig, siginfo_t * info, void * ucontext)
 {
+    __UNUSED(ucontext);
     debug("killed by %s\n", signal_name(sig));
 
     if (!info->si_pid)

+ 8 - 2
LibOS/shim/src/bookkeep/shim_thread.c

@@ -487,7 +487,7 @@ int check_last_thread (struct shim_thread * self)
 }
 
 int walk_thread_list (int (*callback) (struct shim_thread *, void *, bool *),
-                      void * arg, bool may_write)
+                      void * arg)
 {
     struct shim_thread * tmp, * n;
     bool srched = false;
@@ -528,7 +528,7 @@ out:
 
 int walk_simple_thread_list (int (*callback) (struct shim_simple_thread *,
                                               void *, bool *),
-                             void * arg, bool may_write)
+                             void * arg)
 {
     struct shim_simple_thread * tmp, * n;
     bool srched = false;
@@ -654,6 +654,7 @@ END_CP_FUNC(thread)
 BEGIN_RS_FUNC(thread)
 {
     struct shim_thread * thread = (void *) (base + GET_CP_FUNC_ENTRY());
+    __UNUSED(offset);
 
     CP_REBASE(thread->children);
     CP_REBASE(thread->siblings);
@@ -693,6 +694,7 @@ END_RS_FUNC(thread)
 
 BEGIN_CP_FUNC(running_thread)
 {
+    __UNUSED(objp);
     assert(size == sizeof(struct shim_thread));
 
     struct shim_thread * thread = (struct shim_thread *) obj;
@@ -732,6 +734,7 @@ int resume_wrapper (void * param)
 
 BEGIN_RS_FUNC(running_thread)
 {
+    __UNUSED(offset);
     struct shim_thread * thread = (void *) (base + GET_CP_FUNC_ENTRY());
     struct shim_thread * cur_thread = get_cur_thread();
     thread->in_vm = true;
@@ -790,6 +793,9 @@ END_RS_FUNC(running_thread)
 
 BEGIN_CP_FUNC(all_running_threads)
 {
+    __UNUSED(obj);
+    __UNUSED(size);
+    __UNUSED(objp);
     struct shim_thread * thread;
     lock(&thread_list_lock);
 

+ 3 - 0
LibOS/shim/src/bookkeep/shim_vma.c

@@ -1214,6 +1214,9 @@ BEGIN_CP_FUNC(all_vmas)
     size_t count = DEFAULT_VMA_COUNT;
     struct shim_vma_val * vmas = malloc(sizeof(*vmas) * count);
     int ret;
+    __UNUSED(obj);
+    __UNUSED(size);
+    __UNUSED(objp);
 
     if (!vmas)
         return -ENOMEM;

+ 8 - 1
LibOS/shim/src/elf/shim_rtld.c

@@ -1414,7 +1414,7 @@ err:
 
         if (fs->d_ops->mode) {
             mode_t mode;
-            if ((ret = fs->d_ops->mode(dent, &mode, 1)) < 0)
+            if ((ret = fs->d_ops->mode(dent, &mode)) < 0)
                 goto err;
         }
 
@@ -1565,6 +1565,7 @@ noreturn void execute_elf_object (struct shim_handle * exec,
 
     /* populate ELF aux vectors */
     assert(REQUIRED_ELF_AUXV >= 7); /* stack allocated enough space */
+
     auxp[0].a_type = AT_PHDR;
     auxp[0].a_un.a_val = (__typeof(auxp[0].a_un.a_val)) exec_map->l_phdr;
     auxp[1].a_type = AT_PHNUM;
@@ -1684,6 +1685,7 @@ DEFINE_PROFILE_INTERVAL(add_or_replace_library, inside_rs_library);
 
 BEGIN_RS_FUNC(library)
 {
+    __UNUSED(offset);
     struct link_map * map = (void *) (base + GET_CP_FUNC_ENTRY());
 
     CP_REBASE(map->l_name);
@@ -1723,6 +1725,9 @@ END_RS_FUNC(library)
 
 BEGIN_CP_FUNC(loaded_libraries)
 {
+    __UNUSED(obj);
+    __UNUSED(size);
+    __UNUSED(objp);
     struct link_map * map = loaded_libraries, * new_interp_map = NULL;
     while (map) {
         struct link_map * new_map = NULL;
@@ -1742,6 +1747,8 @@ END_CP_FUNC(loaded_libraries)
 
 BEGIN_RS_FUNC(loaded_libraries)
 {
+    __UNUSED(base);
+    __UNUSED(offset);
     interp_map = (void *) GET_CP_FUNC_ENTRY();
 
     if (interp_map) {

+ 8 - 12
LibOS/shim/src/fs/chroot/fs.c

@@ -59,8 +59,7 @@ struct mount_data {
 #define HANDLE_MOUNT_DATA(h) ((struct mount_data*)(h)->fs->data)
 #define DENTRY_MOUNT_DATA(d) ((struct mount_data*)(d)->fs->data)
 
-static int chroot_mount (const char * uri, const char * root,
-                         void ** mount_data)
+static int chroot_mount (const char * uri, void ** mount_data)
 {
     enum shim_file_type type;
 
@@ -365,11 +364,8 @@ static int query_dentry (struct shim_dentry * dent, PAL_HANDLE pal_handle,
     return 0;
 }
 
-static int chroot_mode (struct shim_dentry * dent, mode_t * mode, bool force)
+static int chroot_mode (struct shim_dentry * dent, mode_t * mode)
 {
-    if (!force)
-        return -ESKIPPED;
-
     return query_dentry(dent, NULL, mode, NULL);
 }
 
@@ -378,14 +374,14 @@ static int chroot_stat (struct shim_dentry * dent, struct stat * statbuf)
     return query_dentry(dent, NULL, NULL, statbuf);
 }
 
-static int chroot_lookup (struct shim_dentry * dent, bool force)
+static int chroot_lookup (struct shim_dentry * dent)
 {
 
     return query_dentry(dent, NULL, NULL, NULL);
 }
 
 static int __chroot_open (struct shim_dentry * dent,
-                          const char * uri, size_t len, int flags, mode_t mode,
+                          const char * uri, int flags, mode_t mode,
                           struct shim_handle * hdl,
                           struct shim_file_data * data)
 {
@@ -457,7 +453,7 @@ static int chroot_open (struct shim_handle * hdl, struct shim_dentry * dent,
         unlock(&data->lock);
     }
 
-    if ((ret = __chroot_open(dent, NULL, 0, flags, dent->mode, hdl, data)) < 0)
+    if ((ret = __chroot_open(dent, NULL, flags, dent->mode, hdl, data)) < 0)
         return ret;
 
     struct shim_file_handle * file = &hdl->info.file;
@@ -483,7 +479,7 @@ static int chroot_creat (struct shim_handle * hdl, struct shim_dentry * dir,
     if ((ret = try_create_data(dent, NULL, 0, &data)) < 0)
         return ret;
 
-    if ((ret = __chroot_open(dent, NULL, 0, flags|O_CREAT|O_EXCL, mode, hdl,
+    if ((ret = __chroot_open(dent, NULL, flags|O_CREAT|O_EXCL, mode, hdl,
                              data)) < 0)
         return ret;
 
@@ -528,7 +524,7 @@ static int chroot_mkdir (struct shim_dentry * dir, struct shim_dentry * dent,
             return ret;
     }
 
-    ret = __chroot_open(dent, NULL, 0, O_CREAT|O_EXCL, mode, NULL, data);
+    ret = __chroot_open(dent, NULL, O_CREAT|O_EXCL, mode, NULL, data);
 
     /* Increment the parent's link count */
     struct shim_file_data *parent_data = FILE_DENTRY_DATA(dir);
@@ -569,7 +565,7 @@ static int chroot_recreate (struct shim_handle * hdl)
      * when recreating a file handle after migration, the file should
      * not be created again.
      */
-    return __chroot_open(hdl->dentry, uri, len, hdl->flags & ~(O_CREAT|O_EXCL),
+    return __chroot_open(hdl->dentry, uri, hdl->flags & ~(O_CREAT|O_EXCL),
                          0, hdl, data);
 }
 

+ 41 - 3
LibOS/shim/src/fs/dev/fs.c

@@ -57,28 +57,45 @@
 
 static ssize_t dev_null_read (struct shim_handle * hdl, void * buf, size_t count)
 {
+    // Arguments for compatibility
+    __UNUSED(hdl);
+    __UNUSED(buf);
+    __UNUSED(count);
+
     return 0;
 }
 
 static ssize_t dev_zero_read (struct shim_handle * hdl, void * buf, size_t count)
 {
+    // Argument for compatibility
+    __UNUSED(hdl);
+
     memset(buf, 0, count);
     return count;
 }
 
 static ssize_t dev_null_write (struct shim_handle * hdl, const void * buf, size_t count)
 {
+    // Arguments for compatibility
+    __UNUSED(hdl);
+    __UNUSED(buf);
+    __UNUSED(count);
+
     return count;
 }
 
 static int dev_null_mode (const char * name, mode_t * mode)
 {
+    __UNUSED(name); // We know it is /dev/null
+
     *mode = 0666|S_IFCHR;
     return 0;
 }
 
 static int dev_null_stat (const char * name, struct stat * stat)
 {
+    __UNUSED(name); // We know it is /dev/null
+
     stat->st_mode = 0666|S_IFCHR;
     stat->st_uid = 0;
     stat->st_gid = 0;
@@ -89,6 +106,8 @@ static int dev_null_stat (const char * name, struct stat * stat)
 
 static int dev_null_hstat (struct shim_handle * hdl, struct stat * stat)
 {
+    __UNUSED(hdl); // We know it is /dev/null
+
     stat->st_mode = 0666|S_IFCHR;
     stat->st_uid = 0;
     stat->st_gid = 0;
@@ -99,18 +118,26 @@ static int dev_null_hstat (struct shim_handle * hdl, struct stat * stat)
 
 static int dev_null_truncate (struct shim_handle * hdl, uint64_t size)
 {
+    // Arguments for compatibility
+    __UNUSED(hdl);
+    __UNUSED(size);
+
     return 0;
 }
 
 static int dev_random_mode (const char * name, mode_t * mode)
 {
+    __UNUSED(name); // We know it is /dev/random
+
     *mode = 0666|S_IFCHR;
     return 0;
 }
 
 static ssize_t dev_urandom_read (struct shim_handle * hdl, void * buf, size_t count)
 {
+    __UNUSED(hdl);
     ssize_t ret = DkRandomBitsRead(buf, count);
+
     if (ret < 0)
         return -convert_pal_errno(-ret);
     return count;
@@ -123,6 +150,8 @@ static ssize_t dev_random_read (struct shim_handle * hdl, void * buf, size_t cou
 
 static int dev_random_stat (const char * name, struct stat * stat)
 {
+    __UNUSED(name); // we know it is /dev/random
+
     stat->st_mode = 0666|S_IFCHR;
     stat->st_uid = 0;
     stat->st_gid = 0;
@@ -133,6 +162,8 @@ static int dev_random_stat (const char * name, struct stat * stat)
 
 static int dev_random_hstat (struct shim_handle * hdl, struct stat * stat)
 {
+    __UNUSED(hdl); // pseudo-device
+
     stat->st_mode = 0444|S_IFCHR;
     stat->st_uid = 0;
     stat->st_gid = 0;
@@ -188,14 +219,21 @@ random_dev:
     return -ENOENT;
 }
 
-static int dev_mount (const char * uri, const char * root, void ** mount_data)
+static int dev_mount (const char * uri, void ** mount_data)
 {
+    // Arguments for compatibility
+    __UNUSED(uri);
+    __UNUSED(mount_data);
+
     /* do nothing */
     return 0;
 }
 
 static int dev_unmount (void * mount_data)
 {
+    // Arguments for compatibility
+    __UNUSED(mount_data);
+
     /* do nothing */
     return 0;
 }
@@ -228,7 +266,7 @@ static int dev_open (struct shim_handle * hdl, struct shim_dentry * dent,
     return 0;
 }
 
-static int dev_lookup (struct shim_dentry * dent, bool force)
+static int dev_lookup (struct shim_dentry * dent)
 {
     if (qstrempty(&dent->rel_path)) {
         dent->state |= DENTRY_ISDIRECTORY;
@@ -240,7 +278,7 @@ static int dev_lookup (struct shim_dentry * dent, bool force)
     return search_dev_driver(qstrgetstr(&dent->rel_path), NULL);
 }
 
-static int dev_mode (struct shim_dentry * dent, mode_t * mode, bool force)
+static int dev_mode (struct shim_dentry * dent, mode_t * mode)
 {
     if (qstrempty(&dent->rel_path)) {
         dent->ino = DEV_INO_BASE;

+ 5 - 0
LibOS/shim/src/fs/pipe/fs.c

@@ -74,6 +74,11 @@ static ssize_t pipe_write (struct shim_handle * hdl, const void * buf,
 
 static int pipe_hstat (struct shim_handle * hdl, struct stat * stat)
 {
+    /* XXX: Is any of this right?
+     * Shouldn't we be using hdl to figure something out?
+     * if stat is NULL, should we not return -EFAULT?
+     */
+    __UNUSED(hdl);
     if (!stat)
         return 0;
 

+ 13 - 3
LibOS/shim/src/fs/proc/fs.c

@@ -63,12 +63,14 @@ const struct proc_dir proc_root = {
 
 static int proc_root_mode (const char * name, mode_t * mode)
 {
+    __UNUSED(name); // We know this is /proc
     *mode = 0555;
     return 0;
 }
 
 static int proc_root_stat (const char * name, struct stat * buf)
 {
+    __UNUSED(name); // We know this is /proc
     memset(buf, 0, sizeof(struct stat));
 
     buf->st_dev = buf->st_ino = 1;
@@ -84,6 +86,9 @@ static int proc_root_stat (const char * name, struct stat * buf)
 static int proc_root_open (struct shim_handle * hdl,
                            const char * name, int flags)
 {
+    __UNUSED(hdl); // this is a placeholder function
+    __UNUSED(name); // We know this is /proc
+
 
     if (flags & (O_WRONLY|O_RDWR))
         return -EISDIR;
@@ -159,7 +164,7 @@ found:
     return 0;
 }
 
-static int proc_mode (struct shim_dentry * dent, mode_t * mode, bool force)
+static int proc_mode (struct shim_dentry * dent, mode_t * mode)
 {
     if (qstrempty(&dent->rel_path)) {
         dent->ino = PROC_INO_BASE;
@@ -181,7 +186,7 @@ static int proc_mode (struct shim_dentry * dent, mode_t * mode, bool force)
     return ent->fs_ops->mode(rel_path, mode);
 }
 
-static int proc_lookup (struct shim_dentry * dent, bool force)
+static int proc_lookup (struct shim_dentry * dent)
 {
     if (qstrempty(&dent->rel_path)) {
         dent->ino = PROC_INO_BASE;
@@ -202,14 +207,19 @@ static int proc_lookup (struct shim_dentry * dent, bool force)
      return ret;
 }
 
-static int proc_mount (const char * uri, const char * root, void ** mount_data)
+static int proc_mount (const char * uri, void ** mount_data)
 {
+    // Arguments for compatibility with other FSes
+    __UNUSED(uri);
+    __UNUSED(mount_data);
     /* do nothing */
     return 0;
 }
 
 static int proc_unmount (void * mount_data)
 {
+    // Arguments for compatibility with other FSes
+    __UNUSED(mount_data);
     /* do nothing */
     return 0;
 }

+ 9 - 0
LibOS/shim/src/fs/proc/info.c

@@ -16,12 +16,16 @@
 
 static int proc_info_mode (const char * name, mode_t * mode)
 {
+    // The path is implicitly set by calling this function
+    __UNUSED(name);
     *mode = 0444;
     return 0;
 }
 
 static int proc_info_stat (const char * name, struct stat * buf)
 {
+    // The path is implicitly set by calling this function
+    __UNUSED(name);
     memset(buf, 0, sizeof(struct stat));
     buf->st_dev = buf->st_ino = 1;
     buf->st_mode = 0444|S_IFREG;
@@ -34,6 +38,8 @@ static int proc_info_stat (const char * name, struct stat * buf)
 static int proc_meminfo_open (struct shim_handle * hdl, const char * name,
                               int flags)
 {
+    // This function only serves one file
+    __UNUSED(name);
     if (flags & (O_WRONLY|O_RDWR))
         return -EACCES;
 
@@ -83,6 +89,9 @@ retry:
 static int proc_cpuinfo_open (struct shim_handle * hdl, const char * name,
                               int flags)
 {
+    // This function only serves one file
+    __UNUSED(name);
+
     if (flags & (O_WRONLY|O_RDWR))
         return -EACCES;
 

+ 3 - 1
LibOS/shim/src/fs/proc/ipc-thread.c

@@ -147,7 +147,7 @@ static int proc_ipc_thread_link_mode (const char * name, mode_t * mode)
         goto out;
     }
 
-    ret = dent->fs->d_ops->mode(dent, mode, true);
+    ret = dent->fs->d_ops->mode(dent, mode);
 out:
     put_dentry(dent);
     return ret;
@@ -272,6 +272,8 @@ int get_all_pid_status (struct pid_status ** status);
 static int proc_list_ipc_thread (const char * name, struct shim_dirent ** buf,
                                  int len)
 {
+    // Only one valid name
+    __UNUSED(name);
     struct pid_status_cache * status = NULL;
     int ret = 0;
 

+ 12 - 3
LibOS/shim/src/fs/proc/thread.c

@@ -179,7 +179,7 @@ static int proc_thread_link_mode (const char * name, mode_t * mode)
         goto out;
     }
 
-    ret = dent->fs->d_ops->mode(dent, mode, true);
+    ret = dent->fs->d_ops->mode(dent, mode);
 out:
     put_dentry(dent);
     return ret;
@@ -426,7 +426,7 @@ static int proc_thread_each_fd_mode (const char * name, mode_t * mode)
         goto out;
     }
 
-    ret = dent->fs->d_ops->mode(dent, mode, true);
+    ret = dent->fs->d_ops->mode(dent, mode);
 out:
     put_dentry(dent);
     return 0;
@@ -609,12 +609,16 @@ err:
 
 static int proc_thread_maps_mode (const char * name, mode_t * mode)
 {
+    // Only used by one file
+    __UNUSED(name);
     *mode = 0400;
     return 0;
 }
 
 static int proc_thread_maps_stat (const char * name, struct stat * buf)
 {
+    // Only used by one file
+    __UNUSED(name);
     memset(buf, 0, sizeof(struct stat));
 
     buf->st_dev = buf->st_ino = 1;
@@ -635,6 +639,8 @@ static const struct proc_fs_ops fs_thread_maps = {
 static int proc_thread_dir_open (struct shim_handle * hdl,
                                  const char * name, int flags)
 {
+    __UNUSED(hdl);
+    __UNUSED(name);
 
     if (flags & (O_WRONLY|O_RDWR))
         return -EISDIR;
@@ -706,6 +712,8 @@ struct walk_thread_arg {
 
 static int walk_cb (struct shim_thread * thread, void * arg, bool * unlocked)
 {
+    // unlocked needed for kill
+    __UNUSED(unlocked);
     struct walk_thread_arg * args = (struct walk_thread_arg *) arg;
     IDTYPE pid = thread->tid;
     int p = pid, l = 0;
@@ -730,10 +738,11 @@ static int walk_cb (struct shim_thread * thread, void * arg, bool * unlocked)
 static int proc_list_thread (const char * name, struct shim_dirent ** buf,
                              int len)
 {
+    __UNUSED(name); // We know this is for "/proc/self"
     struct walk_thread_arg args =
         { .buf = *buf, .buf_end = (void *) *buf + len, };
 
-    int ret = walk_thread_list(&walk_cb, &args, false);
+    int ret = walk_thread_list(&walk_cb, &args);
     if (ret < 0)
         return ret;
 

+ 2 - 8
LibOS/shim/src/fs/shim_dcache.c

@@ -211,11 +211,6 @@ struct shim_dentry * get_new_dentry (struct shim_mount *mount,
 /* This function searches for name/namelen (as the relative path) under
  * the parent directory (start).
  *
- * path/pathlen is the fully-qualified path, and an optional (unused)
- * argument.  XXX: I am not sure what the case is where the full path
- * would resolve but the relative path would not; consider dropping
- * this argument, or documenting the reason (after testing).
- *
  * If requested, the expected hash of the dentry is returned in hashptr,
  * primarily so that the hashing can be reused to add the dentry later.
  *
@@ -225,7 +220,7 @@ struct shim_dentry * get_new_dentry (struct shim_mount *mount,
  */
 struct shim_dentry *
 __lookup_dcache (struct shim_dentry * start, const char * name, int namelen,
-                 const char * path, int pathlen, HASHTYPE * hashptr) {
+                 HASHTYPE * hashptr) {
 
     /* In this implementation, we just look at the children
      * under the parent and see if there are matches.  It so,
@@ -367,6 +362,7 @@ END_CP_FUNC(dentry)
 
 BEGIN_RS_FUNC(dentry)
 {
+    __UNUSED(offset);
     struct shim_dentry * dent = (void *) (base + GET_CP_FUNC_ENTRY());
 
     CP_REBASE(dent->hlist);
@@ -393,5 +389,3 @@ BEGIN_RS_FUNC(dentry)
              dent->fs ? qstrgetstr(&dent->fs->path) : NULL);
 }
 END_RS_FUNC(dentry)
-
-

+ 11 - 5
LibOS/shim/src/fs/shim_fs.c

@@ -289,7 +289,7 @@ int __mount_fs (struct shim_mount * mount, struct shim_dentry * dent)
         /* mount_root->state |= DENTRY_VALID; */
         mount_root = get_new_dentry(mount, NULL, "", 0, NULL);
         assert(mount->d_ops && mount->d_ops->lookup);
-        ret = mount->d_ops->lookup(mount_root, 0);
+        ret = mount->d_ops->lookup(mount_root);
         if (ret < 0) {
             /* Try getting rid of ESKIPPED case */
             assert (ret != -ESKIPPED);
@@ -425,7 +425,7 @@ int mount_fs (const char * type, const char * uri, const char * mount_point,
     void * mount_data = NULL;
 
     /* call fs-specific mount to allocate mount_data */
-    if ((ret = fs->fs_ops->mount(uri, mount_point, &mount_data)) < 0)
+    if ((ret = fs->fs_ops->mount(uri, &mount_data)) < 0)
         goto out_with_unlock;
 
 
@@ -443,9 +443,7 @@ int mount_fs (const char * type, const char * uri, const char * mount_point,
     if (last_len == 0)
         dent = dentry_root;
     else {
-        dent = __lookup_dcache(parent, last,
-                               last_len,
-                               NULL, 0, NULL);
+        dent = __lookup_dcache(parent, last, last_len, NULL);
 
         if (!dent) {
             dent = get_new_dentry(mount, parent, last, last_len, NULL);
@@ -607,6 +605,7 @@ END_CP_FUNC(mount)
 
 BEGIN_RS_FUNC(mount)
 {
+    __UNUSED(offset);
     struct shim_mount * mount = (void *) (base + GET_CP_FUNC_ENTRY());
 
     CP_REBASE(mount->cpdata);
@@ -639,6 +638,9 @@ END_RS_FUNC(mount)
 
 BEGIN_CP_FUNC(all_mounts)
 {
+    __UNUSED(obj);
+    __UNUSED(size);
+    __UNUSED(objp);
     struct shim_mount * mount;
     lock(&mount_list_lock);
     LISTP_FOR_EACH_ENTRY(mount, &mount_list, list)
@@ -652,6 +654,10 @@ END_CP_FUNC(all_mounts)
 
 BEGIN_RS_FUNC(all_mounts)
 {
+    __UNUSED(entry);
+    __UNUSED(base);
+    __UNUSED(offset);
+    __UNUSED(rebase);
     /* to prevent file system from being mount again */
     mount_migrated = true;
 }

+ 9 - 24
LibOS/shim/src/fs/shim_namei.c

@@ -71,7 +71,7 @@ static inline int __lookup_flags (int flags)
  * Returns 0 on success, negative on failure.
  */
 /* Assume caller has acquired dcache_lock */
-int permission (struct shim_dentry * dent, mode_t mask, bool force) {
+int permission (struct shim_dentry * dent, mode_t mask) {
 
     mode_t mode = 0;
 
@@ -94,9 +94,6 @@ int permission (struct shim_dentry * dent, mode_t mask, bool force) {
      * just NO_MODE.
      */
     if (dent->mode == NO_MODE) {
-        /* DEP 6/16/17: This semantic seems risky to me */
-        if (!force)
-            return 0;
 
         /* DEP 6/16/17: I don't think we should be defaulting to 0 if
          * there isn't a mode function. */
@@ -105,7 +102,7 @@ int permission (struct shim_dentry * dent, mode_t mask, bool force) {
         assert(dent->fs->d_ops->mode);
 
         /* Fall back to the low-level file system */
-        int err = dent->fs->d_ops->mode(dent, &mode, force);
+        int err = dent->fs->d_ops->mode(dent, &mode);
 
         /*
          * DEP 6/16/17: I think the low-level file system should be
@@ -148,11 +145,6 @@ int permission (struct shim_dentry * dent, mode_t mask, bool force) {
  * This function checks the dcache first, and then, on a miss, falls back
  * to the low-level file system.
  *
- * The force flag causes the libOS to query the underlying file system for the
- * existence of the dentry, even on a dcache hit, whereas without force, a
- * negative dentry is treated as definitive.  A hit with a valid dentry is
- * _always_ treated as definitive, even if force is set.
- *
  * XXX: The original code returned whether the process can exec the task?
  *       Not clear this is needed; try not doing this.
  *
@@ -161,16 +153,14 @@ int permission (struct shim_dentry * dent, mode_t mask, bool force) {
  *
  * The caller should hold the dcache_lock.
  */
-int lookup_dentry (struct shim_dentry * parent, const char * name, int namelen,
-                   bool force, struct shim_dentry ** new,
-                   struct shim_mount * fs)
+int lookup_dentry (struct shim_dentry * parent, const char * name, int namelen, struct shim_dentry ** new, struct shim_mount * fs)
 {
     struct shim_dentry * dent = NULL;
     int do_fs_lookup = 0;
     int err = 0;
 
     /* Look up the name in the dcache first, one atom at a time. */
-    dent = __lookup_dcache(parent, name, namelen, NULL, 0, NULL);
+    dent = __lookup_dcache(parent, name, namelen, NULL);
 
     if (!dent) {
         dent = get_new_dentry(fs, parent, name, namelen, NULL);
@@ -183,8 +173,6 @@ int lookup_dentry (struct shim_dentry * parent, const char * name, int namelen,
     } else {
         if (!(dent->state & DENTRY_VALID))
             do_fs_lookup = 1;
-        else if (force && (dent->state & DENTRY_NEGATIVE))
-            do_fs_lookup = 1;
     }
 
     if (do_fs_lookup) {
@@ -193,7 +181,7 @@ int lookup_dentry (struct shim_dentry * parent, const char * name, int namelen,
         assert (dent->fs);
         assert (dent->fs->d_ops);
         assert (dent->fs->d_ops->lookup);
-        err = dent->fs->d_ops->lookup(dent, force);
+        err = dent->fs->d_ops->lookup(dent);
 
         /* XXX: On an error, it seems like we should probably destroy
          * the dentry, rather than keep some malformed dentry lying around.
@@ -342,8 +330,7 @@ int __path_lookupat (struct shim_dentry * start, const char * path, int flags,
 
         } else {
             // Once we have an atom, look it up and update start
-            // XXX: Assume we don't need the force flag here?
-            err = lookup_dentry(start, path, my_pathlen, 0, &my_dent, fs);
+            err = lookup_dentry(start, path, my_pathlen, &my_dent, fs);
             // my_dent's refcount is incremented after this, consistent with cases above
 
             // Allow a negative dentry to move forward
@@ -515,7 +502,7 @@ int open_namei (struct shim_handle * hdl, struct shim_dentry * start,
         }
 
         // Check the parent permission first
-        err = permission(dir, MAY_WRITE | MAY_EXEC, true);
+        err = permission(dir, MAY_WRITE | MAY_EXEC);
         if (err)  goto out;
 
         // Try EINVAL when creat isn't an option
@@ -557,7 +544,7 @@ int open_namei (struct shim_handle * hdl, struct shim_dentry * start,
     // creat/O_CREAT have idiosyncratic semantics about opening a
     // newly-created, read-only file for writing, but only the first time.
     if (!newly_created) {
-        if ((err = permission(mydent, acc_mode, true)) < 0)
+        if ((err = permission(mydent, acc_mode)) < 0)
             goto out;
     }
 
@@ -724,7 +711,7 @@ int list_directory_dentry (struct shim_dentry *dent) {
     struct shim_dirent * d = dirent;
     for ( ; d ; d = d->next) {
         struct shim_dentry * child;
-        if ((ret = lookup_dentry(dent, d->name, strlen(d->name), false,
+        if ((ret = lookup_dentry(dent, d->name, strlen(d->name),
                                  &child, fs)) < 0)
             goto done_read;
 
@@ -837,5 +824,3 @@ int path_startat (int dfd, struct shim_dentry ** dir)
         return 0;
     }
 }
-
-

+ 2 - 0
LibOS/shim/src/fs/socket/fs.c

@@ -39,6 +39,8 @@
 
 static int socket_close (struct shim_handle * hdl)
 {
+    /* XXX: Shouldn't this do something? */
+    __UNUSED(hdl);
     return 0;
 }
 

+ 1 - 0
LibOS/shim/src/ipc/shim_ipc.c

@@ -725,6 +725,7 @@ END_CP_FUNC(process)
 
 BEGIN_RS_FUNC(process)
 {
+    __UNUSED(offset);
     struct shim_process * proc = (void *) (base + GET_CP_FUNC_ENTRY());
 
     CP_REBASE(proc->self);

+ 14 - 26
LibOS/shim/src/ipc/shim_ipc_child.c

@@ -33,14 +33,16 @@
 
 #include <errno.h>
 
-static int ipc_thread_exit (IDTYPE vmid, IDTYPE ppid, IDTYPE tid,
-                            unsigned int exitcode, unsigned int term_signal, unsigned long exit_time)
+static int ipc_thread_exit (IDTYPE vmid, IDTYPE tid, unsigned int exitcode,
+                            unsigned int term_signal, unsigned long exit_time)
 {
     assert(vmid != cur_process.vmid);
 
 #ifdef PROFILE
     if (!exit_time)
         exit_time = GET_PROFILE_INTERVAL();
+#else
+    __UNUSED(exit_time);
 #endif
 
     struct shim_thread * thread = __lookup_thread(tid);
@@ -78,27 +80,6 @@ static int ipc_thread_exit (IDTYPE vmid, IDTYPE ppid, IDTYPE tid,
     return 0;
 }
 
-void ipc_parent_exit (struct shim_ipc_port * port, IDTYPE vmid,
-                      unsigned int exitcode)
-{
-    debug("ipc port %p of process %u closed suggests parent exiting\n",
-          port, vmid);
-
-    struct shim_ipc_info * parent = NULL;
-
-    lock(&cur_process.lock);
-
-    if (parent && vmid == cur_process.parent->vmid) {
-        parent = cur_process.parent;
-        cur_process.parent = NULL;
-    }
-
-    unlock(&cur_process.lock);
-
-    if (parent)
-        put_ipc_info(parent);
-}
-
 struct thread_info {
     IDTYPE vmid;
     unsigned int exitcode;
@@ -108,6 +89,7 @@ struct thread_info {
 static int child_sthread_exit (struct shim_simple_thread * thread, void * arg,
                                bool * unlocked)
 {
+    __UNUSED(unlocked); // Used by other callbacks
     struct thread_info * info = (struct thread_info *) arg;
     if (thread->vmid == info->vmid) {
         if (thread->is_alive) {
@@ -124,6 +106,7 @@ static int child_sthread_exit (struct shim_simple_thread * thread, void * arg,
 static int child_thread_exit (struct shim_thread * thread, void * arg,
                               bool * unlocked)
 {
+    __UNUSED(unlocked); // Used by other callbacks
     struct thread_info * info = (struct thread_info *) arg;
     if (thread->vmid == info->vmid) {
         if (thread->is_alive) {
@@ -143,10 +126,10 @@ int remove_child_thread (IDTYPE vmid, unsigned int exitcode, unsigned int term_s
 
     assert(vmid != cur_process.vmid);
 
-    if ((ret = walk_thread_list(&child_thread_exit, &info, false)) > 0)
+    if ((ret = walk_thread_list(&child_thread_exit, &info)) > 0)
         nkilled += ret;
 
-    if ((ret = walk_simple_thread_list(&child_sthread_exit, &info, false)) > 0)
+    if ((ret = walk_simple_thread_list(&child_sthread_exit, &info)) > 0)
         nkilled += ret;
 
     if (!nkilled)
@@ -215,6 +198,9 @@ int ipc_cld_exit_send (IDTYPE ppid, IDTYPE tid, unsigned int exitcode, unsigned
 
 int ipc_cld_exit_callback (IPC_CALLBACK_ARGS)
 {
+    // XXX: Should we close/free port?
+    __UNUSED(port);
+
     struct shim_ipc_cld_exit * msgin =
                 (struct shim_ipc_cld_exit *) &msg->msg;
 
@@ -229,7 +215,9 @@ int ipc_cld_exit_callback (IPC_CALLBACK_ARGS)
     debug("ipc callback from %u: IPC_CLD_EXIT(%u, %u, %d)\n",
           msg->src, msgin->ppid, msgin->tid, msgin->exitcode);
 
-    int ret = ipc_thread_exit(msg->src, msgin->ppid, msgin->tid,
+    // XXX: Assert that we are the msgin->ppid?
+
+    int ret = ipc_thread_exit(msg->src, msgin->tid,
                               msgin->exitcode, msgin->term_signal,
                               time);
     SAVE_PROFILE_INTERVAL(ipc_cld_exit_callback);

+ 5 - 1
LibOS/shim/src/ipc/shim_ipc_helper.c

@@ -106,6 +106,9 @@ static int init_ipc_port (struct shim_ipc_info * info, PAL_HANDLE hdl, IDTYPE ty
 static void ipc_broadcast_exit (struct shim_ipc_port * port, IDTYPE vmid,
                                 unsigned exitcode)
 {
+    // Arguments for compatibility
+    __UNUSED(vmid);
+    __UNUSED(exitcode);
     if (port == broadcast_port) {
         MASTER_LOCK();
         broadcast_port = NULL;
@@ -833,6 +836,7 @@ noreturn static void shim_ipc_helper_end(struct shim_thread * self)
 
 noreturn static void __shim_ipc_helper (void * dummy)
 {
+    __UNUSED(dummy);
     struct shim_thread * self = get_cur_thread();
     void * stack = self->stack;
 
@@ -1073,7 +1077,7 @@ static int create_ipc_helper (void)
     ipc_helper_thread = new;
     ipc_helper_state = HELPER_ALIVE;
 
-    PAL_HANDLE handle = thread_create(shim_ipc_helper, new, 0);
+    PAL_HANDLE handle = thread_create(shim_ipc_helper, new);
 
     if (!handle) {
         ret = -PAL_ERRNO;

+ 1 - 55
LibOS/shim/src/ipc/shim_ipc_nsimpl.h

@@ -739,6 +739,7 @@ static inline void init_namespace (void)
 static void ipc_leader_exit (struct shim_ipc_port * port, IDTYPE vmid,
                              unsigned int exitcode)
 {
+    __UNUSED(exitcode); // Kept for API compatibility
     lock(&cur_process.lock);
 
     if (!NS_LEADER || NS_LEADER->port != port) {
@@ -1318,61 +1319,6 @@ out:
     return ret;
 }
 
-DEFINE_PROFILE_INTERVAL(NS_SEND(revoke), ipc);
-DEFINE_PROFILE_INTERVAL(NS_CALLBACK(revoke), ipc);
-
-int NS_SEND(revoke) (IDTYPE base, IDTYPE size)
-{
-    BEGIN_PROFILE_INTERVAL();
-    IDTYPE leader;
-    struct shim_ipc_port * port = NULL;
-    int ret = 0;
-
-    if ((ret = connect_ns(&leader, &port)) < 0)
-        goto out;
-
-    struct shim_ipc_msg * msg =
-            create_ipc_msg_on_stack(NS_CODE(REVOKE),
-                                    sizeof(NS_MSG_TYPE(revoke)), leader);
-    NS_MSG_TYPE(revoke) * msgin = (void *) &msg->msg;
-    msgin->base = base;
-    msgin->size = size;
-
-    debug("ipc send to %u: " NS_CODE_STR(REVOKE) "(%u, %u)\n",
-          leader, base, size);
-
-    ret = send_ipc_message(msg, port);
-    put_ipc_port(port);
-out:
-    SAVE_PROFILE_INTERVAL(NS_SEND(revoke));
-    return ret;
-}
-
-int NS_CALLBACK(revoke) (IPC_CALLBACK_ARGS)
-{
-    BEGIN_PROFILE_INTERVAL();
-    NS_MSG_TYPE(revoke) * msgin = (void *) &msg->msg;
-    int ret = 0;
-
-    debug("ipc callback from %u: " NS_CODE_STR(REVOKE) "(%u, %u)\n",
-           msg->src, msgin->base, msgin->size);
-
-    switch (msgin->size) {
-        case RANGE_SIZE:
-            ret = CONCAT3(del, NS, range)(msgin->base);
-            break;
-        case 1:
-            ret = CONCAT3(del, NS, subrange)(msgin->size);
-            break;
-        default:
-            ret = -EINVAL;
-            break;
-    }
-
-    SAVE_PROFILE_INTERVAL(NS_CALLBACK(revoke));
-    return ret;
-}
-
 DEFINE_PROFILE_INTERVAL(NS_SEND(sublease), ipc);
 DEFINE_PROFILE_INTERVAL(NS_CALLBACK(sublease), ipc);
 

+ 5 - 2
LibOS/shim/src/ipc/shim_ipc_pid.c

@@ -43,6 +43,7 @@
 static int thread_add_subrange (struct shim_thread * thread, void * arg,
                                 bool * unlocked)
 {
+    __UNUSED(unlocked); // Kept for API compatibility - used by some callbacks
     if (!thread->in_vm)
         return 0;
 
@@ -63,7 +64,7 @@ int init_ns_pid (void)
     if ((ret = create_ipc_location(&info)) < 0)
         return ret;
 
-    walk_thread_list(&thread_add_subrange, info, false);
+    walk_thread_list(&thread_add_subrange, info);
     return 0;
 }
 
@@ -210,6 +211,7 @@ int ipc_pid_getstatus_callback (IPC_CALLBACK_ARGS)
     int check_thread (struct shim_thread * thread, void * arg,
                       bool * unlocked)
     {
+        __UNUSED(unlocked); // Kept for API compatibility
         struct thread_status * status = (struct thread_status *) arg;
 
         for (int i = 0 ; i < status->npids ; i++)
@@ -231,7 +233,7 @@ int ipc_pid_getstatus_callback (IPC_CALLBACK_ARGS)
     status.nstatus = 0;
     status.status = __alloca(sizeof(struct pid_status) * msgin->npids);
 
-    ret = walk_thread_list(&check_thread, &status, false);
+    ret = walk_thread_list(&check_thread, &status);
     if (ret < 0 && ret != -ESRCH)
         goto out;
 
@@ -789,6 +791,7 @@ int get_rpc_msg (IDTYPE * sender, void * buf, int len)
 
 int ipc_pid_sendrpc_callback (IPC_CALLBACK_ARGS)
 {
+    __UNUSED(port); // API compatibility
     BEGIN_PROFILE_INTERVAL();
     int ret = 0;
     struct shim_ipc_pid_sendrpc * msgin =

+ 6 - 0
LibOS/shim/src/ipc/shim_ipc_sysv.c

@@ -108,6 +108,8 @@ out:
 
 int ipc_sysv_delres_callback (IPC_CALLBACK_ARGS)
 {
+    __UNUSED(port);
+
     BEGIN_PROFILE_INTERVAL();
     int ret = 0;
     struct shim_ipc_sysv_delres * msgin  =
@@ -416,6 +418,8 @@ int ipc_sysv_msgmov_send (struct shim_ipc_port * port, IDTYPE dest,
 
 int ipc_sysv_msgmov_callback (IPC_CALLBACK_ARGS)
 {
+    __UNUSED(port);
+
     BEGIN_PROFILE_INTERVAL();
     int ret = 0;
     struct shim_ipc_sysv_msgmov * msgin =
@@ -800,6 +804,8 @@ int ipc_sysv_semmov_send (struct shim_ipc_port * port, IDTYPE dest,
 
 int ipc_sysv_semmov_callback (IPC_CALLBACK_ARGS)
 {
+    __UNUSED(port);
+
     BEGIN_PROFILE_INTERVAL();
     int ret = 0;
     struct shim_ipc_sysv_semmov * msgin =

+ 1 - 1
LibOS/shim/src/shim_async.c

@@ -281,7 +281,7 @@ static int create_async_helper(void) {
     if (!new)
         return -ENOMEM;
 
-    PAL_HANDLE handle = thread_create(shim_async_helper, new, 0);
+    PAL_HANDLE handle = thread_create(shim_async_helper, new);
 
     if (!handle) {
         async_helper_thread = NULL;

+ 28 - 1
LibOS/shim/src/shim_checkpoint.c

@@ -196,6 +196,7 @@ END_CP_FUNC_NO_RS(memory)
 
 BEGIN_CP_FUNC(palhdl)
 {
+    __UNUSED(size);
     ptr_t off = ADD_CP_OFFSET(sizeof(struct shim_palhdl_entry));
     struct shim_palhdl_entry * entry = (void *) (base + off);
 
@@ -215,6 +216,9 @@ END_CP_FUNC(palhdl)
 
 BEGIN_RS_FUNC(palhdl)
 {
+    __UNUSED(offset);
+    __UNUSED(rebase);
+
     struct shim_palhdl_entry * ent = (void *) (base + GET_CP_FUNC_ENTRY());
 
     if (ent->phandle && !ent->phandle && ent->uri) {
@@ -225,6 +229,9 @@ END_RS_FUNC(palhdl)
 
 BEGIN_CP_FUNC(migratable)
 {
+    __UNUSED(obj);
+    __UNUSED(size);
+    __UNUSED(objp);
     struct shim_mem_entry * mem_entry;
 
     DO_CP_SIZE(memory, &__migratable, &__migratable_end - &__migratable,
@@ -237,6 +244,9 @@ END_CP_FUNC(migratable)
 
 BEGIN_RS_FUNC(migratable)
 {
+    __UNUSED(base);
+    __UNUSED(offset);
+
     void * data = (void *) GET_CP_FUNC_ENTRY();
     CP_REBASE(data);
     memcpy(&__migratable, data, &__migratable_end - &__migratable);
@@ -245,6 +255,9 @@ END_RS_FUNC(migratable)
 
 BEGIN_CP_FUNC(environ)
 {
+    __UNUSED(size);
+    __UNUSED(objp);
+
     const char ** e, ** envp = (void *) obj;
     int nenvp = 0;
     int envp_bytes = 0;
@@ -272,6 +285,8 @@ END_CP_FUNC(environ)
 
 BEGIN_RS_FUNC(environ)
 {
+    __UNUSED(offset);
+
     const char ** envp = (void *) base + GET_CP_FUNC_ENTRY();
     const char ** e;
 
@@ -286,6 +301,9 @@ END_RS_FUNC(environ)
 
 BEGIN_CP_FUNC(qstr)
 {
+    __UNUSED(size);
+    __UNUSED(objp);
+
     struct shim_qstr * qstr = (struct shim_qstr *) obj;
 
     if (qstr->len < QSTR_SIZE) {
@@ -305,6 +323,8 @@ END_CP_FUNC(qstr)
 
 BEGIN_RS_FUNC(qstr)
 {
+    __UNUSED(offset);
+
     struct shim_qstr * qstr = (void *) (base + GET_CP_FUNC_ENTRY());
     CP_REBASE(qstr->oflow);
 }
@@ -343,6 +363,11 @@ END_CP_FUNC(gipc)
 
 BEGIN_RS_FUNC(gipc)
 {
+    __UNUSED(rebase);
+    __UNUSED(offset);
+    __UNUSED(base);
+    __UNUSED(entry);
+
 #if HASH_GIPC == 1
     struct shim_gipc_entry * entry = (void *) (base + GET_CP_FUNC_ENTRY());
 
@@ -664,7 +689,7 @@ int init_from_checkpoint_file (const char * filename,
     struct shim_dirent * d = dirent;
     for ( ; d ; d = d->next) {
         struct shim_dentry * file;
-        if ((ret = lookup_dentry(dir, d->name, strlen(d->name), false,
+        if ((ret = lookup_dentry(dir, d->name, strlen(d->name),
                                  &file, dir->fs)) < 0)
             continue;
         if (file->state & DENTRY_NEGATIVE)
@@ -812,6 +837,8 @@ int receive_handles_on_stream (struct palhdl_header * hdr, ptr_t base,
 
 static void * cp_alloc (struct shim_cp_store * store, void * addr, size_t size)
 {
+    // Keeping for api compatibility; not 100% sure this is needed
+    __UNUSED(store);
     if (addr) {
         /*
          * If the checkpoint needs more space, try to extend the checkpoint

+ 8 - 0
LibOS/shim/src/shim_debug.c

@@ -40,11 +40,15 @@ void clean_link_map_list (void)
 
 void remove_r_debug (void * addr)
 {
+    __UNUSED(addr);
     /* do nothing */
 }
 
 void append_r_debug (const char * uri, void * addr, void * dyn_addr)
 {
+    __UNUSED(uri);
+    __UNUSED(addr);
+    __UNUSED(dyn_addr);
     /* do nothing */
 }
 
@@ -136,6 +140,9 @@ void append_r_debug (const char * uri, void * addr, void * dyn_addr)
 
 BEGIN_CP_FUNC(gdb_map)
 {
+    __UNUSED(obj);
+    __UNUSED(size);
+    __UNUSED(objp);
     struct gdb_link_map *m = link_map_list;
     struct gdb_link_map *newm = NULL;
 
@@ -158,6 +165,7 @@ END_CP_FUNC(gdb_map)
 
 BEGIN_RS_FUNC(gdb_map)
 {
+    __UNUSED(offset);
     struct gdb_link_map * map = (void *) (base + GET_CP_FUNC_ENTRY());
 
     CP_REBASE(map->l_name);

+ 6 - 0
LibOS/shim/src/shim_init.c

@@ -51,6 +51,8 @@ const unsigned int glibc_version = GLIBC_VERSION;
 
 static void handle_failure (PAL_PTR event, PAL_NUM arg, PAL_CONTEXT * context)
 {
+    __UNUSED(event);
+    __UNUSED(context);
     shim_get_tls()->pal_errno = (arg <= PAL_ERROR_BOUND) ? arg : 0;
 }
 
@@ -972,6 +974,10 @@ static int output_path (char * path, size_t size, const void * id,
                         struct shim_qstr * qstr)
 {
     size_t len = strlen(path);
+    // API compatibility
+    __UNUSED(size);
+    __UNUSED(id);
+
     if (qstr)
         qstrsetstr(qstr, path, len);
     return len;

+ 49 - 47
LibOS/shim/src/shim_parser.c

@@ -47,33 +47,33 @@
 #include <linux/in6.h>
 #include <linux/un.h>
 
-static void parse_open_flags    (const char *, va_list *);
-static void parse_open_mode     (const char *, va_list *);
-static void parse_access_mode   (const char *, va_list *);
-static void parse_clone_flags   (const char *, va_list *);
-static void parse_mmap_prot     (const char *, va_list *);
-static void parse_mmap_flags    (const char *, va_list *);
-static void parse_exec_args     (const char *, va_list *);
-static void parse_exec_envp     (const char *, va_list *);
-static void parse_pipe_fds      (const char *, va_list *);
-static void parse_signum        (const char *, va_list *);
-static void parse_sigmask       (const char *, va_list *);
-static void parse_sigprocmask_how (const char *, va_list *);
-static void parse_timespec      (const char *, va_list *);
-static void parse_sockaddr      (const char *, va_list *);
-static void parse_domain        (const char *, va_list *);
-static void parse_socktype      (const char *, va_list *);
-static void parse_futexop       (const char *, va_list *);
-static void parse_ioctlop       (const char *, va_list *);
-static void parse_fcntlop       (const char *, va_list *);
-static void parse_seek          (const char *, va_list *);
-static void parse_at_fdcwd      (const char *, va_list *);
-static void parse_wait_option   (const char *, va_list *);
+static void parse_open_flags    (va_list *);
+static void parse_open_mode     (va_list *);
+static void parse_access_mode   (va_list *);
+static void parse_clone_flags   (va_list *);
+static void parse_mmap_prot     (va_list *);
+static void parse_mmap_flags    (va_list *);
+static void parse_exec_args     (va_list *);
+static void parse_exec_envp     (va_list *);
+static void parse_pipe_fds      (va_list *);
+static void parse_signum        (va_list *);
+static void parse_sigmask       (va_list *);
+static void parse_sigprocmask_how (va_list *);
+static void parse_timespec      (va_list *);
+static void parse_sockaddr      (va_list *);
+static void parse_domain        (va_list *);
+static void parse_socktype      (va_list *);
+static void parse_futexop       (va_list *);
+static void parse_ioctlop       (va_list *);
+static void parse_fcntlop       (va_list *);
+static void parse_seek          (va_list *);
+static void parse_at_fdcwd      (va_list *);
+static void parse_wait_option   (va_list *);
 
 struct parser_table {
     int slow;
     int stop;
-    void (*parser[6]) (const char *, va_list *);
+    void (*parser[6]) (va_list *);
 } syscall_parser_table[LIBOS_SYSCALL_BOUND] = {
     { .slow = 1, .parser = { NULL } }, /* read */
     { .slow = 1, .parser = { NULL } }, /* write */
@@ -508,7 +508,8 @@ void parse_syscall_before (int sysno, const char * name, int nr, ...)
 
         if (parser->parser[i]) {
             const char * type = va_arg(ap, const char *);
-            (*parser->parser[i])(type, &ap);
+            __UNUSED(type); // type not needed on this path
+            (*parser->parser[i])(&ap);
         } else
             parse_syscall_args(&ap);
     }
@@ -556,7 +557,8 @@ void parse_syscall_after (int sysno, const char * name, int nr, ...)
 
             if (parser->parser[i]) {
                 const char * type = va_arg(ap, const char *);
-                (*parser->parser[i])(type, &ap);
+                __UNUSED(type); // type not needed on this path
+                (*parser->parser[i])(&ap);
             } else
                 parse_syscall_args(&ap);
         }
@@ -576,7 +578,7 @@ void parse_syscall_after (int sysno, const char * name, int nr, ...)
     va_end (ap);
 }
 
-static void parse_open_flags (const char * type, va_list * ap)
+static void parse_open_flags (va_list * ap)
 {
     int flags = va_arg(*ap, int);
 
@@ -610,12 +612,12 @@ static void parse_open_flags (const char * type, va_list * ap)
         PRINTF("|%o", flags);
 }
 
-static void parse_open_mode (const char * type, va_list * ap)
+static void parse_open_mode (va_list * ap)
 {
     VPRINTF("%04o", ap);
 }
 
-static void parse_access_mode (const char * type, va_list * ap)
+static void parse_access_mode (va_list * ap)
 {
     int mode = va_arg(*ap, int);
 
@@ -631,7 +633,7 @@ static void parse_access_mode (const char * type, va_list * ap)
     }
 }
 
-static void parse_clone_flags (const char * type, va_list * ap)
+static void parse_clone_flags (va_list * ap)
 {
     int flags = va_arg(*ap, int);
 
@@ -662,7 +664,7 @@ static void parse_clone_flags (const char * type, va_list * ap)
         PRINTF("|0x%x", flags);
 }
 
-static void parse_mmap_prot (const char * type, va_list * ap)
+static void parse_mmap_prot (va_list * ap)
 {
     int prot = va_arg(*ap, int);
     int nflags = 0;
@@ -692,7 +694,7 @@ static void parse_mmap_prot (const char * type, va_list * ap)
     }
 }
 
-static void parse_mmap_flags (const char * type, va_list * ap)
+static void parse_mmap_flags (va_list * ap)
 {
     int flags = va_arg(*ap, int);
 
@@ -732,7 +734,7 @@ static void parse_mmap_flags (const char * type, va_list * ap)
         PRINTF("|0x%x", flags);
 }
 
-static void parse_exec_args (const char * type, va_list * ap)
+static void parse_exec_args (va_list * ap)
 {
     const char ** args = va_arg(*ap, const char **);
 
@@ -756,7 +758,7 @@ static void parse_exec_args (const char * type, va_list * ap)
     PUTS("]");
 }
 
-static void parse_exec_envp (const char * type, va_list * ap)
+static void parse_exec_envp (va_list * ap)
 {
     const char ** envp = va_arg(*ap, const char **);
 
@@ -789,7 +791,7 @@ static void parse_exec_envp (const char * type, va_list * ap)
     PUTS("]");
 }
 
-static void parse_pipe_fds (const char * type, va_list * ap)
+static void parse_pipe_fds (va_list * ap)
 {
     int * fds = va_arg(*ap, int *);
 
@@ -835,7 +837,7 @@ const char *const siglist[NUM_KNOWN_SIGS + 1] =
         S(SIGRTMIN),
     };
 
-static void parse_signum (const char * type, va_list * ap)
+static void parse_signum (va_list * ap)
 {
     int signum = va_arg(*ap, int);
 
@@ -845,7 +847,7 @@ static void parse_signum (const char * type, va_list * ap)
         PRINTF("[SIG %d]", signum);
 }
 
-static void parse_sigmask (const char * type, va_list * ap)
+static void parse_sigmask (va_list * ap)
 {
     __sigset_t * sigset = va_arg(*ap, __sigset_t *);
 
@@ -870,7 +872,7 @@ static void parse_sigmask (const char * type, va_list * ap)
     PUTS("]");
 }
 
-static void parse_sigprocmask_how (const char * type, va_list * ap)
+static void parse_sigprocmask_how (va_list * ap)
 {
     int how = va_arg(*ap, int);
 
@@ -890,7 +892,7 @@ static void parse_sigprocmask_how (const char * type, va_list * ap)
     }
 }
 
-static void parse_timespec (const char * type, va_list * ap)
+static void parse_timespec (va_list * ap)
 {
     const struct timespec * tv = va_arg(*ap, const struct timespec *);
 
@@ -907,7 +909,7 @@ static void parse_timespec (const char * type, va_list * ap)
     PRINTF("[%ld,%ld]", tv->tv_sec, tv->tv_nsec);
 }
 
-static void parse_sockaddr (const char * type, va_list *ap)
+static void parse_sockaddr (va_list *ap)
 {
     const struct sockaddr *addr = va_arg(*ap, const struct sockaddr *);
 
@@ -955,7 +957,7 @@ static void parse_sockaddr (const char * type, va_list *ap)
     }
 }
 
-static void parse_domain (const char * type, va_list * ap)
+static void parse_domain (va_list * ap)
 {
     int domain = va_arg(*ap, int);
 
@@ -1010,7 +1012,7 @@ static void parse_domain (const char * type, va_list * ap)
     }
 }
 
-static void parse_socktype (const char * type, va_list * ap)
+static void parse_socktype (va_list * ap)
 {
     int socktype = va_arg(*ap, int);
 
@@ -1055,7 +1057,7 @@ static void parse_socktype (const char * type, va_list * ap)
     }
 }
 
-static void parse_futexop (const char * type, va_list * ap)
+static void parse_futexop (va_list * ap)
 {
     int op = va_arg(*ap, int);
 
@@ -1106,7 +1108,7 @@ static void parse_futexop (const char * type, va_list * ap)
     }
 }
 
-static void parse_fcntlop (const char * type, va_list * ap)
+static void parse_fcntlop (va_list * ap)
 {
     int op = va_arg(*ap, int);
 
@@ -1171,7 +1173,7 @@ static void parse_fcntlop (const char * type, va_list * ap)
     }
 }
 
-static void parse_ioctlop (const char * type, va_list * ap)
+static void parse_ioctlop (va_list * ap)
 {
     int op = va_arg(*ap, int);
 
@@ -1232,7 +1234,7 @@ static void parse_ioctlop (const char * type, va_list * ap)
     PRINTF("OP 0x%04x", op);
 }
 
-static void parse_seek (const char * type, va_list * ap)
+static void parse_seek (va_list * ap)
 {
     int seek = va_arg(*ap, int);
 
@@ -1252,7 +1254,7 @@ static void parse_seek (const char * type, va_list * ap)
     }
 }
 
-static void parse_at_fdcwd (const char * type, va_list * ap)
+static void parse_at_fdcwd (va_list * ap)
 {
     int fd = va_arg(*ap, int);
 
@@ -1266,7 +1268,7 @@ static void parse_at_fdcwd (const char * type, va_list * ap)
     }
 }
 
-static void parse_wait_option (const char * type, va_list * ap)
+static void parse_wait_option (va_list * ap)
 {
     int option = va_arg(*ap, int);
 

+ 1 - 0
LibOS/shim/src/shim_syscalls.c

@@ -478,6 +478,7 @@ DEFINE_SHIM_SYSCALL (getrlimit, 2, shim_do_getrlimit, int, int, resource,
 
 int shim_do_getrusage (int who, struct __kernel_rusage * ru)
 {
+    __UNUSED(who);
     memset(ru, 0, sizeof(struct __kernel_rusage));
     return -ENOSYS;
 }

+ 2 - 2
LibOS/shim/src/sys/shim_access.c

@@ -45,7 +45,7 @@ int shim_do_access (const char * file, mode_t mode)
 
     ret = path_lookupat(NULL, file, LOOKUP_ACCESS|LOOKUP_FOLLOW, &dent, NULL);
     if (!ret)
-        ret = permission(dent, mode, 1);
+        ret = permission(dent, mode);
 
     return ret;
 }
@@ -71,7 +71,7 @@ int shim_do_faccessat (int dfd, const char * filename, mode_t mode)
     if (ret < 0)
         goto out;
 
-    ret = permission(dent, mode, 1);
+    ret = permission(dent, mode);
 
 out:
     put_dentry(dir);

+ 6 - 0
LibOS/shim/src/sys/shim_alarm.c

@@ -28,6 +28,9 @@
 
 void signal_alarm (IDTYPE target, void * arg)
 {
+    // Kept for API compatibility wtih signal_itimer
+    __UNUSED(arg);
+
     debug("alarm goes off, signaling thread %u\n", target);
 
     struct shim_thread * thread = lookup_thread(target);
@@ -58,6 +61,9 @@ static struct {
 
 void signal_itimer (IDTYPE target, void * arg)
 {
+    // XXX: Can we simplify this code or streamline with the other callback?
+    __UNUSED(target);
+
     MASTER_LOCK();
 
     if (real_itimer.timeout != (unsigned long) arg) {

+ 4 - 0
LibOS/shim/src/sys/shim_brk.c

@@ -247,6 +247,9 @@ out:
 
 BEGIN_CP_FUNC(brk)
 {
+    __UNUSED(obj);
+    __UNUSED(size);
+    __UNUSED(objp);
     if (region.brk_start) {
         ADD_CP_FUNC_ENTRY((ptr_t)region.brk_start);
         ADD_CP_ENTRY(ADDR, region.brk_current);
@@ -259,6 +262,7 @@ END_CP_FUNC(bek)
 
 BEGIN_RS_FUNC(brk)
 {
+    __UNUSED(rebase);
     region.brk_start   = (void *) GET_CP_FUNC_ENTRY();
     region.brk_current = (void *) GET_CP_ENTRY(ADDR);
     region.brk_end     = region.brk_start + GET_CP_ENTRY(SIZE);

+ 1 - 1
LibOS/shim/src/sys/shim_clone.c

@@ -398,7 +398,7 @@ int shim_do_clone (int flags, void * user_stack_addr, int * parent_tidptr,
     // returns .The parent comes back here - however, the child is Happily
     // running the function we gave to DkThreadCreate.
     PAL_HANDLE pal_handle = thread_create(clone_implementation_wrapper,
-                                          &new_args, flags);
+                                          &new_args);
     if (!pal_handle) {
         ret = -PAL_ERRNO;
         goto clone_thread_failed;

+ 4 - 0
LibOS/shim/src/sys/shim_epoll.c

@@ -384,12 +384,15 @@ int shim_do_epoll_pwait (int epfd, struct __kernel_epoll_event * events,
                          int maxevents, int timeout, const __sigset_t * sigmask,
                          size_t sigsetsize)
 {
+    __UNUSED(sigmask);
+    __UNUSED(sigsetsize);
     int ret = shim_do_epoll_wait (epfd, events, maxevents, timeout);
     return ret;
 }
 
 static int epoll_close (struct shim_handle * hdl)
 {
+    __UNUSED(hdl);
     return 0;
 }
 
@@ -435,6 +438,7 @@ END_CP_FUNC(epoll_fd)
 
 BEGIN_RS_FUNC(epoll_fd)
 {
+    __UNUSED(offset);
     LISTP_TYPE(shim_epoll_fd) * list = (void *) (base + GET_CP_FUNC_ENTRY());
     struct shim_epoll_fd * epoll_fd;
 

+ 3 - 3
LibOS/shim/src/sys/shim_exec.c

@@ -39,7 +39,7 @@
 #include <asm/prctl.h>
 
 static int close_on_exec (struct shim_fd_handle * fd_hdl,
-                          struct shim_handle_map * map, void * arg)
+                          struct shim_handle_map * map)
 {
     if (fd_hdl->flags & FD_CLOEXEC) {
         struct shim_handle * hdl = __detach_fd_handle(fd_hdl, NULL, map);
@@ -50,7 +50,7 @@ static int close_on_exec (struct shim_fd_handle * fd_hdl,
 
 static int close_cloexec_handle (struct shim_handle_map * map)
 {
-    return walk_handle_map(&close_on_exec, map, NULL);
+    return walk_handle_map(&close_on_exec, map);
 }
 
 DEFINE_PROFILE_CATEGORY(exec_rtld, exec);
@@ -348,7 +348,7 @@ err:
 
     if (fs->d_ops->mode) {
         __kernel_mode_t mode;
-        if ((ret = fs->d_ops->mode(dent, &mode, 1)) < 0)
+        if ((ret = fs->d_ops->mode(dent, &mode)) < 0)
             goto err;
     }
 

+ 1 - 0
LibOS/shim/src/sys/shim_fork.c

@@ -40,6 +40,7 @@ int migrate_fork (struct shim_cp_store * store,
                   struct shim_thread * thread,
                   struct shim_process * process, va_list ap)
 {
+    __UNUSED(ap);
     BEGIN_MIGRATION_DEF(fork, struct shim_thread * thread,
                         struct shim_process * process)
     {

+ 6 - 0
LibOS/shim/src/sys/shim_fs.c

@@ -292,6 +292,8 @@ int shim_do_chown (const char * path, uid_t uid, gid_t gid)
 {
     struct shim_dentry * dent = NULL;
     int ret = 0;
+    __UNUSED(uid);
+    __UNUSED(gid);
 
     if (!path)
         return -EINVAL;
@@ -310,6 +312,7 @@ int shim_do_chown (const char * path, uid_t uid, gid_t gid)
 int shim_do_fchownat (int dfd, const char * filename, uid_t uid, gid_t gid,
                       int flags)
 {
+    __UNUSED(flags);
     if (!filename)
         return -EINVAL;
 
@@ -337,6 +340,9 @@ out:
 
 int shim_do_fchown (int fd, uid_t uid, gid_t gid)
 {
+    __UNUSED(uid);
+    __UNUSED(gid);
+
     struct shim_handle * hdl = get_fd_handle(fd, NULL, NULL);
     if (!hdl)
         return -EBADF;

+ 13 - 1
LibOS/shim/src/sys/shim_ioctl.c

@@ -166,6 +166,11 @@ static int ioctl_termios (struct shim_handle * hdl, unsigned int cmd,
 static int ioctl_fd (struct shim_handle * hdl, unsigned int cmd,
                      unsigned long arg)
 {
+    // This is just a placeholder function; arguments are not actually used
+    // right now
+    __UNUSED(hdl);
+    __UNUSED(arg);
+
     switch(cmd) {
         /* <include/linux/fd.h> */
 
@@ -228,6 +233,10 @@ static int ioctl_fd (struct shim_handle * hdl, unsigned int cmd,
 static int ioctl_netdevice (struct shim_handle * hdl, unsigned int cmd,
                             unsigned long arg)
 {
+    // This is just a placeholder function; arguments are not actually used
+    // right now
+    __UNUSED(arg);
+
     if (hdl->type != TYPE_SOCK)
         return -ENOTSOCK;
 
@@ -287,8 +296,11 @@ static int ioctl_netdevice (struct shim_handle * hdl, unsigned int cmd,
     return -EAGAIN;
 }
 
-void signal_io (IDTYPE target, void * arg)
+void signal_io (IDTYPE target, void *arg)
 {
+    // Kept for compatibility with signal_itimer
+    __UNUSED(arg);
+
     debug("detecting input, signaling thread %u\n", target);
 
     struct shim_thread * thread = lookup_thread(target);

+ 4 - 5
LibOS/shim/src/sys/shim_migrate.c

@@ -143,6 +143,7 @@ static int finish_checkpoint (struct cp_session * session);
 static int check_thread (struct shim_thread * thread, void * arg,
                          bool * unlocked)
 {
+    __UNUSED(unlocked); // Retained for API compatibility
     LISTP_TYPE(cp_thread) * registered = (LISTP_TYPE(cp_thread) *) arg;
     struct cp_thread * t;
 
@@ -156,8 +157,7 @@ static int check_thread (struct shim_thread * thread, void * arg,
     return 1;
 }
 
-int join_checkpoint (struct shim_thread * thread, ucontext_t * context,
-                     IDTYPE sid)
+int join_checkpoint (struct shim_thread * thread, IDTYPE sid)
 {
     struct cp_session * s, * cpsession = NULL;
     struct cp_thread cpthread;
@@ -183,8 +183,7 @@ int join_checkpoint (struct shim_thread * thread, ucontext_t * context,
 
     /* find out if there is any thread that is not registered yet */
     ret = walk_thread_list(&check_thread,
-                           &cpsession->registered_threads,
-                           false);
+                           &cpsession->registered_threads);
 
     if (ret == -ESRCH)
         do_checkpoint = true;
@@ -288,7 +287,7 @@ int shim_do_checkpoint (const char * filename)
     ipc_checkpoint_send(filename, session);
     kill_all_threads(tcb->tp, session, SIGCP);
 
-    ret = join_checkpoint(tcb->tp, &signal.context, session);
+    ret = join_checkpoint(tcb->tp, session);
     if (ret < 0) {
         shim_do_rmdir(filename);
         return ret;

+ 11 - 0
LibOS/shim/src/sys/shim_msgget.c

@@ -371,6 +371,9 @@ out:
 int shim_do_msgsnd (int msqid, const void * msgp, size_t msgsz, int msgflg)
 {
     INC_PROFILE_OCCURENCE(syscall_use_ipc);
+    // Issue #755 - https://github.com/oscarlab/graphene/issues/755
+    __UNUSED(msgflg);
+
     int ret;
 
     if (msgsz > MSGMAX)
@@ -399,6 +402,10 @@ int shim_do_msgrcv (int msqid, void * msgp, size_t msgsz, long msgtype,
                     int msgflg)
 {
     INC_PROFILE_OCCURENCE(syscall_use_ipc);
+
+    // Issue #755 - https://github.com/oscarlab/graphene/issues/755
+    __UNUSED(msgflg);
+
     int ret;
 
     if (msgsz > MSGMAX)
@@ -421,6 +428,10 @@ int shim_do_msgrcv (int msqid, void * msgp, size_t msgsz, long msgtype,
 int shim_do_msgctl (int msqid, int cmd, struct msqid_ds * buf)
 {
     INC_PROFILE_OCCURENCE(syscall_use_ipc);
+
+    // Issue #756 - https://github.com/oscarlab/graphene/issues/756
+    __UNUSED(buf);
+
     struct shim_msg_handle * msgq;
     int ret;
     __try_create_lock();

+ 3 - 0
LibOS/shim/src/sys/shim_poll.c

@@ -432,6 +432,8 @@ out:
 int shim_do_ppoll (struct pollfd * fds, int nfds, struct timespec * tsp,
                    const __sigset_t * sigmask, size_t sigsetsize)
 {
+    __UNUSED(sigmask);
+    __UNUSED(sigsetsize);
     struct shim_thread * cur = get_cur_thread();
 
     struct poll_handle * polls =
@@ -598,6 +600,7 @@ int shim_do_pselect6 (int nfds, fd_set * readfds, fd_set * writefds,
                       fd_set * errorfds, const struct __kernel_timespec * tsp,
                       const __sigset_t * sigmask)
 {
+    __UNUSED(sigmask);
     if (!nfds)
         return tsp ? shim_do_nanosleep (tsp, NULL) : -EINVAL;
 

+ 1 - 0
LibOS/shim/src/sys/shim_sandbox.c

@@ -389,6 +389,7 @@ err:
 
 int shim_do_sandbox_attach (unsigned int sbid)
 {
+    __UNUSED(sbid);
     return -ENOSYS;
 }
 

+ 1 - 0
LibOS/shim/src/sys/shim_sched.c

@@ -36,6 +36,7 @@ int shim_do_sched_yield (void)
 int shim_do_sched_getaffinity (pid_t pid, size_t len,
                                __kernel_cpu_set_t * user_mask_ptr)
 {
+    __UNUSED(pid);
     int ncpus = PAL_CB(cpu_info.cpu_num);
 
     /* Check that user_mask_ptr is valid; if not, should return -EFAULT */

+ 11 - 6
LibOS/shim/src/sys/shim_sigaction.c

@@ -88,6 +88,7 @@ out:
 
 int shim_do_sigreturn (int __unused)
 {
+    __UNUSED(__unused);
     /* do nothing */
     return 0;
 }
@@ -220,7 +221,10 @@ int shim_do_sigsuspend (const __sigset_t * mask)
 
 int shim_do_sigpending (__sigset_t * set, size_t sigsetsize)
 {
-    if (!set || test_user_memory(set, sizeof(*set), false))
+    if (sigsetsize != sizeof(*set))
+        return -EINVAL;
+
+    if (!set || test_user_memory(set, sigsetsize, false))
         return -EFAULT;
 
     struct shim_thread * cur = get_cur_thread();
@@ -351,13 +355,13 @@ int do_kill_proc (IDTYPE sender, IDTYPE tgid, int sig, bool use_ipc)
 
     bool srched = false;
 
-    if (!walk_thread_list(__kill_proc, &arg, false))
+    if (!walk_thread_list(__kill_proc, &arg))
         srched = true;
 
     if (!use_ipc || srched)
         goto out;
 
-    if (!walk_simple_thread_list(__kill_proc_simple, &arg, false))
+    if (!walk_simple_thread_list(__kill_proc_simple, &arg))
         srched = true;
 
     if (!srched && !ipc_pid_kill_send(sender, tgid, KILL_PROCESS, sig))
@@ -445,13 +449,13 @@ int do_kill_pgroup (IDTYPE sender, IDTYPE pgid, int sig, bool use_ipc)
 
     bool srched = false;
 
-    if (!walk_thread_list(__kill_pgroup, &arg, false))
+    if (!walk_thread_list(__kill_pgroup, &arg))
         srched = true;
 
     if (!use_ipc || srched)
         goto out;
 
-    if (!walk_simple_thread_list(__kill_pgroup_simple, &arg, false))
+    if (!walk_simple_thread_list(__kill_pgroup_simple, &arg))
         srched = true;
 
     if (!srched && !ipc_pid_kill_send(sender, pgid, KILL_PGROUP, sig))
@@ -464,6 +468,7 @@ out:
 static int __kill_all_threads (struct shim_thread * thread, void * arg,
                                bool * unlocked)
 {
+    __UNUSED(unlocked); // Retained for API compatibility
     int srched = 0;
     struct walk_arg * warg = (struct walk_arg *) arg;
 
@@ -494,7 +499,7 @@ int kill_all_threads (struct shim_thread * cur, IDTYPE sender, int sig)
     arg.id      = 0;
     arg.sig     = sig;
     arg.use_ipc = false;
-    walk_thread_list(__kill_all_threads, &arg, false);
+    walk_thread_list(__kill_all_threads, &arg);
     return 0;
 }
 

+ 14 - 0
LibOS/shim/src/sys/shim_socket.c

@@ -1025,6 +1025,9 @@ int shim_do_accept4 (int fd, struct sockaddr * addr, socklen_t * addrlen,
 static ssize_t do_sendmsg (int fd, struct iovec * bufs, int nbufs, int flags,
                            const struct sockaddr * addr, socklen_t addrlen)
 {
+    // Issue #752 - https://github.com/oscarlab/graphene/issues/752
+    __UNUSED(flags);
+
     struct shim_handle * hdl = get_fd_handle(fd, NULL, NULL);
     if (!hdl)
         return -EBADF;
@@ -1345,6 +1348,14 @@ ssize_t shim_do_recvmmsg (int sockfd, struct mmsghdr * msg, size_t vlen, int fla
 {
     ssize_t total = 0;
 
+    // Issue # 753 - https://github.com/oscarlab/graphene/issues/753
+    /* TODO(donporter): timeout properly. For now, explicitly return an error. */
+    if (timeout) {
+        debug("recvmmsg(): timeout parameter unsupported.\n");
+        return -EOPNOTSUPP;
+    }
+
+
     for (size_t i = 0 ; i * sizeof(struct mmsghdr) < vlen ; i++) {
         struct msghdr * m = &msg[i].msg_hdr;
 
@@ -1520,6 +1531,9 @@ struct __kernel_linger {
 static int __do_setsockopt (struct shim_handle * hdl, int level, int optname,
                             char * optval, int optlen, PAL_STREAM_ATTR * attr)
 {
+    // Issue 754 - https://github.com/oscarlab/graphene/issues/754
+    __UNUSED(optlen);
+
     int intval = *((int *) optval);
     PAL_BOL bolval = intval ? PAL_TRUE : PAL_FALSE;
 

+ 1 - 0
LibOS/shim/src/sys/shim_stat.c

@@ -152,6 +152,7 @@ out:
 
 static int __do_statfs (struct shim_mount * fs, struct statfs * buf)
 {
+    __UNUSED(fs);
     if (!buf || test_user_memory(buf, sizeof(*buf), true))
         return -EFAULT;
 

+ 2 - 0
LibOS/shim/src/sys/shim_time.c

@@ -74,6 +74,7 @@ int shim_do_clock_gettime (clockid_t which_clock,
                            struct timespec * tp)
 {
     /* all clock are the same */
+    __UNUSED(which_clock);
 
     if (!tp)
         return -EINVAL;
@@ -95,6 +96,7 @@ int shim_do_clock_getres (clockid_t which_clock,
                           struct timespec * tp)
 {
     /* all clock are the same */
+    __UNUSED(which_clock);
 
     if (!tp)
         return -EINVAL;

+ 1 - 0
LibOS/shim/src/sys/shim_wait.c

@@ -44,6 +44,7 @@ pid_t shim_do_wait4 (pid_t pid, int * status, int option,
     struct shim_thread * cur = get_cur_thread();
     struct shim_thread * thread = NULL;
     int ret = 0;
+    __UNUSED(ru);
 
     INC_PROFILE_OCCURENCE(syscall_use_ipc);
 

+ 8 - 5
LibOS/shim/src/utils/printf.c

@@ -27,7 +27,7 @@
 PAL_HANDLE debug_handle = NULL;
 
 static inline int
-debug_fputs (void * f, const char * buf, int len)
+debug_fputs (const char * buf, int len)
 {
     if (DkStreamWrite(debug_handle, 0, len, (void *) buf, NULL) == (PAL_NUM) len)
         return 0;
@@ -38,11 +38,12 @@ debug_fputs (void * f, const char * buf, int len)
 static int
 debug_fputch (void * f, int ch, void * b)
 {
+    __UNUSED(f);
     struct debug_buf * buf = (struct debug_buf *) b;
     buf->buf[buf->end++] = ch;
 
     if (ch == '\n') {
-        int ret = debug_fputs(NULL, buf->buf, buf->end);
+        int ret = debug_fputs(buf->buf, buf->end);
         buf->end = buf->start;
         return ret;
     }
@@ -52,14 +53,14 @@ debug_fputch (void * f, int ch, void * b)
         buf->buf[buf->end++] = '.';
         buf->buf[buf->end++] = '.';
         buf->buf[buf->end++] = '\n';
-        debug_fputs(NULL, buf->buf, buf->end);
+        debug_fputs(buf->buf, buf->end);
         buf->end = buf->start;
         buf->buf[buf->end++] = '.';
         buf->buf[buf->end++] = '.';
     }
 #else
     if (buf->end == DEBUGBUF_SIZE) {
-        debug_fputs(NULL, buf->buf, buf->end);
+        debug_fputs(buf->buf, buf->end);
         buf->end = buf->start;
     }
 #endif
@@ -91,7 +92,7 @@ void debug_puts (const char * str)
             buf->buf[buf->end++] = '.';
             buf->buf[buf->end++] = '.';
             buf->buf[buf->end++] = '\n';
-            debug_fputs(NULL, buf->buf, buf->end);
+            debug_fputs(buf->buf, buf->end);
             buf->end = buf->start;
             buf->buf[buf->end++] = '.';
             buf->buf[buf->end++] = '.';
@@ -151,6 +152,8 @@ sys_fputs (void * f, const char * str, int len)
 static void
 sys_fputch (void * f, int ch, void * b)
 {
+    __UNUSED(b);
+
     sys_putdat.buf[sys_putdat.cnt++] = ch;
 
     if (ch == '\n') {