bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Fix some warnings with -Wmissing-prototypes.


From: Flavio Cruz
Subject: [PATCH] Fix some warnings with -Wmissing-prototypes.
Date: Sun, 25 Dec 2022 20:41:46 -0500

Marked some functions as static (private) as needed and added missing
includes.

This also revealed some dead code which was removed.

Note that -Wmissing-prototypes is not enabled here since there is a
bunch more warnings.
---
 ddb/db_break.c           |  8 ++--
 ddb/db_command.c         |  8 ++--
 ddb/db_expr.c            | 16 +++----
 ddb/db_input.c           | 10 ++---
 ddb/db_output.c          |  2 +-
 ddb/db_print.c           |  8 ++--
 ddb/db_sym.c             |  6 +--
 ddb/db_task_thread.c     |  2 +-
 ddb/db_variables.c       |  4 +-
 ddb/db_watch.c           |  4 +-
 ddb/db_write_cmd.c       |  1 +
 device/blkio.c           |  2 +
 device/blkio.h           |  2 +
 device/chario.c          | 11 +++--
 device/cirbuf.c          | 25 -----------
 device/dev_lookup.c      |  6 +--
 device/dev_name.c        | 23 ----------
 device/dev_pager.c       | 20 ++++-----
 device/device_init.c     |  1 +
 device/ds_routines.c     |  4 +-
 device/net_io.c          | 12 +++---
 device/subrs.c           |  1 +
 i386/i386/db_disasm.c    |  6 +--
 i386/i386/db_interface.c |  4 +-
 i386/i386/db_trace.c     | 12 +++---
 i386/i386/fpu.c          | 17 --------
 i386/i386/hardclock.c    |  1 +
 i386/i386/io_map.c       |  2 +-
 i386/i386/loose_ends.c   | 16 +------
 i386/i386at/kd.c         |  4 +-
 i386/i386at/kd_event.c   |  4 +-
 i386/i386at/mem.c        |  1 +
 i386/i386at/model_dep.c  |  2 +-
 i386/i386at/rtc.c        | 12 +++---
 ipc/ipc_kmsg.c           | 10 ++---
 ipc/ipc_notify.c         | 12 +++---
 ipc/mach_port.c          |  4 +-
 kern/bootstrap.c         |  1 +
 kern/debug.c             |  2 +
 kern/ipc_mig.c           | 10 ++---
 kern/mach_clock.c        |  2 +-
 kern/machine.c           |  3 +-
 kern/priority.c          |  1 +
 kern/processor.c         |  2 +-
 kern/queue.c             | 10 -----
 kern/sched_prim.c        | 12 +++---
 kern/syscall_emulation.c |  2 +-
 kern/syscall_subr.c      |  6 +--
 kern/syscall_sw.c        |  4 +-
 kern/task.c              |  2 +-
 kern/thread.c            |  9 ++--
 kern/timer.c             | 18 --------
 util/putchar.c           |  1 +
 vm/vm_debug.c            |  2 +-
 vm/vm_fault.c            |  4 +-
 vm/vm_init.c             |  1 +
 vm/vm_map.c              | 92 +++-------------------------------------
 vm/vm_object.c           |  6 +--
 vm/vm_pageout.c          |  2 +-
 vm/vm_resident.c         |  1 +
 60 files changed, 154 insertions(+), 322 deletions(-)

diff --git a/ddb/db_break.c b/ddb/db_break.c
index c3a9e181..c0962161 100644
--- a/ddb/db_break.c
+++ b/ddb/db_break.c
@@ -61,7 +61,7 @@ static db_thread_breakpoint_t         
db_free_thread_break_list = 0;
 static boolean_t                       db_thread_break_init = FALSE;
 static int                             db_breakpoint_number = 0;
 
-db_breakpoint_t
+static db_breakpoint_t
 db_breakpoint_alloc()
 {
        db_breakpoint_t bkpt;
@@ -80,7 +80,7 @@ db_breakpoint_alloc()
        return (bkpt);
 }
 
-void
+static void
 db_breakpoint_free(bkpt)
        db_breakpoint_t bkpt;
 {
@@ -319,7 +319,7 @@ db_set_breakpoint(task, addr, count, thread, task_bpt)
        }
 }
 
-void
+static void
 db_delete_breakpoint(task, addr, task_thd)
        const task_t    task;
        db_addr_t       addr;
@@ -523,7 +523,7 @@ db_delete_temp_breakpoint(
 /*
  * List breakpoints.
  */
-void
+static void
 db_list_breakpoints(void)
 {
        db_breakpoint_t bkpt;
diff --git a/ddb/db_command.c b/ddb/db_command.c
index 1d4052cd..57200fe3 100644
--- a/ddb/db_command.c
+++ b/ddb/db_command.c
@@ -96,7 +96,7 @@ boolean_t     db_ed_style = TRUE;
 /*
  * Search for command prefix.
  */
-int
+static int
 db_cmd_search(name, table, cmdp)
        const char *            name;
        const struct db_command *table;
@@ -143,7 +143,7 @@ db_cmd_search(name, table, cmdp)
        return (result);
 }
 
-void
+static void
 db_cmd_list(table)
        const struct db_command *table;
 {
@@ -155,7 +155,7 @@ db_cmd_list(table)
        }
 }
 
-void
+static void
 db_command(
        struct db_command       **last_cmdp,    /* IN_OUT */
        struct db_command       *cmd_table)
@@ -295,7 +295,7 @@ db_command(
        }
 }
 
-void
+static void
 db_command_list(
        struct db_command       **last_cmdp,    /* IN_OUT */
        struct db_command       *cmd_table)
diff --git a/ddb/db_expr.c b/ddb/db_expr.c
index c9e6752a..9e20a840 100644
--- a/ddb/db_expr.c
+++ b/ddb/db_expr.c
@@ -41,7 +41,7 @@
 #include <ddb/db_variables.h>
 #include <kern/task.h>
 
-boolean_t
+static boolean_t
 db_term(db_expr_t *valuep)
 {
        int     t;
@@ -124,7 +124,7 @@ db_size_option(modif, u_option, t_option)
        return(size);
 }
 
-boolean_t
+static boolean_t
 db_unary(db_expr_t *valuep)
 {
        int       t;
@@ -173,7 +173,7 @@ db_unary(db_expr_t *valuep)
        return (db_term(valuep));
 }
 
-boolean_t
+static boolean_t
 db_mult_expr(db_expr_t *valuep)
 {
        db_expr_t       lhs = 0, rhs;
@@ -218,7 +218,7 @@ db_mult_expr(db_expr_t *valuep)
        return (TRUE);
 }
 
-boolean_t
+static boolean_t
 db_add_expr(db_expr_t *valuep)
 {
        db_expr_t       lhs, rhs;
@@ -249,7 +249,7 @@ db_add_expr(db_expr_t *valuep)
        return (TRUE);
 }
 
-boolean_t
+static boolean_t
 db_shift_expr(db_expr_t *valuep)
 {
        db_expr_t       lhs, rhs;
@@ -283,7 +283,7 @@ db_shift_expr(db_expr_t *valuep)
        return (TRUE);
 }
 
-boolean_t
+static boolean_t
 db_logical_relation_expr(db_expr_t *valuep)
 {
        db_expr_t       lhs, rhs;
@@ -332,7 +332,7 @@ db_logical_relation_expr(db_expr_t *valuep)
        return (TRUE);
 }
 
-boolean_t
+static boolean_t
 db_logical_and_expr(db_expr_t *valuep)
 {
        db_expr_t       lhs, rhs;
@@ -354,7 +354,7 @@ db_logical_and_expr(db_expr_t *valuep)
        return (TRUE);
 }
 
-boolean_t
+static boolean_t
 db_logical_or_expr(db_expr_t *valuep)
 {
        db_expr_t       lhs, rhs;
diff --git a/ddb/db_input.c b/ddb/db_input.c
index b70299d3..a564025e 100644
--- a/ddb/db_input.c
+++ b/ddb/db_input.c
@@ -67,7 +67,7 @@ char *  db_history_prev = (char *) 0; /* start of previous 
line */
 #define        BLANK           ' '
 #define        BACKUP          '\b'
 
-void
+static void
 db_putstring(s, count)
        const char      *s;
        int             count;
@@ -76,7 +76,7 @@ db_putstring(s, count)
            cnputc(*s++);
 }
 
-void
+static void
 db_putnchars(c, count)
        int     c;
        int     count;
@@ -90,7 +90,7 @@ db_putnchars(c, count)
  */
 #define        DEL_FWD         0
 #define        DEL_BWD         1
-void
+static void
 db_delete(
        int     n,
        int     bwd)
@@ -110,7 +110,7 @@ db_delete(
        db_le -= n;
 }
 
-void
+static void
 db_delete_line(void)
 {
        db_delete(db_le - db_lc, DEL_FWD);
@@ -136,7 +136,7 @@ db_delete_line(void)
 #endif /* DB_HISTORY_SIZE */
 
 /* returns TRUE at end-of-line */
-boolean_t
+static boolean_t
 db_inputchar(int c)
 {
        static int escaped, csi;
diff --git a/ddb/db_output.c b/ddb/db_output.c
index ded9fa96..9a76f545 100644
--- a/ddb/db_output.c
+++ b/ddb/db_output.c
@@ -178,7 +178,7 @@ db_putchar(int c)           /* character to output */
        /* other characters are assumed non-printing */
 }
 
-void
+static void
 db_id_putc(char c, vm_offset_t dummy)
 {
   db_putchar(c);
diff --git a/ddb/db_print.c b/ddb/db_print.c
index 8a76beea..6c2ea238 100644
--- a/ddb/db_print.c
+++ b/ddb/db_print.c
@@ -127,7 +127,7 @@ db_show_regs(
 #define db_thread_fp_used(thread)      FALSE
 #endif
 
-char *
+static char *
 db_thread_stat(thread, status)
        const thread_t  thread;
        char            *status;
@@ -145,7 +145,7 @@ db_thread_stat(thread, status)
        return(status);
 }
 
-void
+static void
 db_print_thread(
        thread_t thread,
        int      thread_id,
@@ -244,7 +244,7 @@ db_print_thread(
        }
 }
 
-void
+static void
 db_print_task(
        task_t  task,
        int     task_id,
@@ -466,7 +466,7 @@ db_show_one_task(addr, have_addr, count, modif)
        db_print_task(task, task_id, flag);
 }
 
-int
+static int
 db_port_iterate(thread, func)
        const thread_t thread;
        void (*func)();
diff --git a/ddb/db_sym.c b/ddb/db_sym.c
index 2abd5746..a6a64eae 100644
--- a/ddb/db_sym.c
+++ b/ddb/db_sym.c
@@ -264,7 +264,7 @@ out:
  */
 boolean_t db_qualify_ambiguous_names = FALSE;
 
-boolean_t
+static boolean_t
 db_name_is_ambiguous(char *sym_name)
 {
        int             i;
@@ -507,8 +507,8 @@ void db_free_symbol(db_sym_t s)
  * Switch into symbol-table specific routines
  */
 
-void dummy_db_free_symbol(db_sym_t symbol) { }
-boolean_t dummy_db_sym_init(char *a, char *b, char *c, char *d) {
+static void dummy_db_free_symbol(db_sym_t symbol) { }
+static boolean_t dummy_db_sym_init(char *a, char *b, char *c, char *d) {
   return FALSE;
 }
 
diff --git a/ddb/db_task_thread.c b/ddb/db_task_thread.c
index f7fbb805..93e44c25 100644
--- a/ddb/db_task_thread.c
+++ b/ddb/db_task_thread.c
@@ -152,7 +152,7 @@ db_check_thread_address_valid(thread)
 /*
  * convert task_id(queue position) to task address
  */
-task_t
+static task_t
 db_lookup_task_id(int task_id)
 {
        task_t task;
diff --git a/ddb/db_variables.c b/ddb/db_variables.c
index 0fd9bad0..5403cc9a 100644
--- a/ddb/db_variables.c
+++ b/ddb/db_variables.c
@@ -70,7 +70,7 @@ struct db_variable db_vars[] = {
 };
 struct db_variable *db_evars = db_vars + sizeof(db_vars)/sizeof(db_vars[0]);
 
-const char *
+static const char *
 db_get_suffix(suffix, suffix_value)
        const char      *suffix;
        short           *suffix_value;
@@ -116,7 +116,7 @@ db_cmp_variable_name(vp, name, ap)
        return(TRUE);
 }
 
-int
+static int
 db_find_variable(
        struct db_variable      **varp,
        db_var_aux_param_t      ap)
diff --git a/ddb/db_watch.c b/ddb/db_watch.c
index f0d0443f..5a845eca 100644
--- a/ddb/db_watch.c
+++ b/ddb/db_watch.c
@@ -64,7 +64,7 @@ db_watchpoint_t               db_watchpoint_list = 0;
 
 extern vm_map_t                kernel_map;
 
-db_watchpoint_t
+static db_watchpoint_t
 db_watchpoint_alloc(void)
 {
        db_watchpoint_t watch;
@@ -83,7 +83,7 @@ db_watchpoint_alloc(void)
        return (watch);
 }
 
-void
+static void
 db_watchpoint_free(watch)
        db_watchpoint_t watch;
 {
diff --git a/ddb/db_write_cmd.c b/ddb/db_write_cmd.c
index 46a2ee32..1a1e5fc9 100644
--- a/ddb/db_write_cmd.c
+++ b/ddb/db_write_cmd.c
@@ -43,6 +43,7 @@
 #include <ddb/db_output.h>
 #include <ddb/db_sym.h>
 #include <ddb/db_task_thread.h>
+#include <ddb/db_write_cmd.h>
 
 
 
diff --git a/device/blkio.c b/device/blkio.c
index 62fc6295..0dfa33c4 100644
--- a/device/blkio.c
+++ b/device/blkio.c
@@ -31,6 +31,8 @@
  */
 #include <mach/kern_return.h>
 
+#include <device/blkio.h>
+#include <device/buf.h>
 #include <device/param.h>
 #include <device/device_types.h>
 #include <device/io_req.h>
diff --git a/device/blkio.h b/device/blkio.h
index aaff9f8a..b188f388 100644
--- a/device/blkio.h
+++ b/device/blkio.h
@@ -19,6 +19,8 @@
 #ifndef _DEVICE_BLKIO_H_
 #define _DEVICE_BLKIO_H_
 
+#include <sys/types.h>
+
 extern vm_offset_t block_io_mmap(dev_t dev, vm_offset_t off, int prot);
 
 #endif /* _DEVICE_BLKIO_H_ */
diff --git a/device/chario.c b/device/chario.c
index 0e9dd70b..64640981 100644
--- a/device/chario.c
+++ b/device/chario.c
@@ -230,7 +230,7 @@ boolean_t char_open_done(
        return TRUE;
 }
 
-boolean_t tty_close_open_reply(
+static boolean_t tty_close_open_reply(
        io_req_t        ior)
 {
        ior->io_error = D_DEVICE_DOWN;
@@ -366,7 +366,7 @@ boolean_t char_write_done(
        return TRUE;
 }
 
-boolean_t tty_close_write_reply(
+static boolean_t tty_close_write_reply(
        io_req_t        ior)
 {
        ior->io_residual = ior->io_count;
@@ -473,7 +473,7 @@ boolean_t char_read_done(
        return TRUE;
 }
 
-boolean_t tty_close_read_reply(
+static boolean_t tty_close_read_reply(
        io_req_t        ior)
 {
        ior->io_residual = ior->io_count;
@@ -524,7 +524,7 @@ void ttyclose(
 /*
  * Port-death routine to clean up reply messages.
  */
-boolean_t
+static boolean_t
 tty_queue_clean(
        queue_t                 q,
        const ipc_port_t        port,
@@ -882,8 +882,7 @@ void tty_output(
 /*
  * Send any buffered recvd chars up to user
  */
-void ttypush(
-       void * _tp)
+static void ttypush(void * _tp)
 {
        struct tty      *tp = _tp;
        spl_t   s = spltty();
diff --git a/device/cirbuf.c b/device/cirbuf.c
index a3c9407a..ed09f3d1 100644
--- a/device/cirbuf.c
+++ b/device/cirbuf.c
@@ -202,31 +202,6 @@ b_to_q( char       *cp,
        return count;
 }
 
-/*
- * Return number of contiguous characters up to a character
- * that matches the mask.
- */
-int
-ndqb(  struct cirbuf *cb,
-       int     mask)
-{
-       char *cp, *lim;
-
-       if (cb->c_cl < cb->c_cf)
-           lim = cb->c_end;
-       else
-           lim = cb->c_cl;
-       if (mask == 0)
-           return (lim - cb->c_cf);
-       cp = cb->c_cf;
-       while (cp < lim) {
-           if (*cp & mask)
-               break;
-           cp++;
-       }
-       return (cp - cb->c_cf);
-}
-
 /*
  * Flush characters from circular buffer.
  */
diff --git a/device/dev_lookup.c b/device/dev_lookup.c
index e9d38925..febaebdd 100644
--- a/device/dev_lookup.c
+++ b/device/dev_lookup.c
@@ -69,7 +69,7 @@ struct kmem_cache     dev_hdr_cache;
  * Enter device in the number lookup table.
  * The number table lock must be held.
  */
-void
+static void
 dev_number_enter(const mach_device_t device)
 {
        queue_t q;
@@ -82,7 +82,7 @@ dev_number_enter(const mach_device_t device)
  * Remove device from the device-number lookup table.
  * The device-number table lock must be held.
  */
-void
+static void
 dev_number_remove(const mach_device_t device)
 {
        queue_t q;
@@ -95,7 +95,7 @@ dev_number_remove(const mach_device_t device)
  * Lookup a device by device operations and minor number.
  * The number table lock must be held.
  */
-mach_device_t
+static mach_device_t
 dev_number_lookup(const dev_ops_t ops, int devnum)
 {
        queue_t q;
diff --git a/device/dev_name.c b/device/dev_name.c
index 13ff6dc9..66e6eafe 100644
--- a/device/dev_name.c
+++ b/device/dev_name.c
@@ -241,26 +241,3 @@ dev_set_indirection(const char *name, dev_ops_t ops, int 
unit)
            }
        }
 }
-
-boolean_t dev_change_indirect(const char *iname, const char *dname, int unit)
-{
-    struct dev_ops *dp;
-    struct dev_indirect *di;
-    boolean_t found = FALSE;
-
-    dev_search(dp) {
-       if (!strcmp(dp->d_name, dname)) {
-           found = TRUE;
-           break;
-       }
-    }
-    if (!found) return FALSE;
-    dev_indirect_search(di) {
-       if (!strcmp(di->d_name, iname)) {
-           di->d_ops = dp;
-           di->d_unit = unit;
-           return TRUE;
-       }
-    }
-    return FALSE;
-}
diff --git a/device/dev_pager.c b/device/dev_pager.c
index 6729d507..3a37a14d 100644
--- a/device/dev_pager.c
+++ b/device/dev_pager.c
@@ -128,14 +128,14 @@ typedef struct dev_pager *dev_pager_t;
 
 struct kmem_cache      dev_pager_cache;
 
-void dev_pager_reference(dev_pager_t   ds)
+static void dev_pager_reference(dev_pager_t ds)
 {
        simple_lock(&ds->lock);
        ds->ref_count++;
        simple_unlock(&ds->lock);
 }
 
-void dev_pager_deallocate(dev_pager_t  ds)
+static void dev_pager_deallocate(dev_pager_t ds)
 {
        simple_lock(&ds->lock);
        if (--ds->ref_count > 0) {
@@ -189,7 +189,7 @@ decl_simple_lock_data(,
 #define        dev_hash(name_port) \
                (((vm_offset_t)(name_port) & 0xffffff) % DEV_HASH_COUNT)
 
-void dev_pager_hash_init(void)
+static void dev_pager_hash_init(void)
 {
        int             i;
        vm_size_t       size;
@@ -202,7 +202,7 @@ void dev_pager_hash_init(void)
        simple_lock_init(&dev_pager_hash_lock);
 }
 
-void dev_pager_hash_insert(
+static void dev_pager_hash_insert(
        const ipc_port_t        name_port,
        const dev_pager_t       rec)
 {
@@ -218,7 +218,7 @@ void dev_pager_hash_insert(
        simple_unlock(&dev_pager_hash_lock);
 }
 
-void dev_pager_hash_delete(const ipc_port_t name_port)
+static void dev_pager_hash_delete(const ipc_port_t name_port)
 {
        queue_t                 bucket;
        dev_pager_entry_t       entry;
@@ -239,7 +239,7 @@ void dev_pager_hash_delete(const ipc_port_t name_port)
            kmem_cache_free(&dev_pager_hash_cache, (vm_offset_t)entry);
 }
 
-dev_pager_t dev_pager_hash_lookup(const ipc_port_t name_port)
+static dev_pager_t dev_pager_hash_lookup(const ipc_port_t name_port)
 {
        queue_t                 bucket;
        dev_pager_entry_t       entry;
@@ -262,7 +262,7 @@ dev_pager_t dev_pager_hash_lookup(const ipc_port_t 
name_port)
        return (DEV_PAGER_NULL);
 }
 
-void dev_device_hash_init(void)
+static void dev_device_hash_init(void)
 {
        int             i;
        vm_size_t       size;
@@ -276,7 +276,7 @@ void dev_device_hash_init(void)
        simple_lock_init(&dev_device_hash_lock);
 }
 
-void dev_device_hash_insert(
+static void dev_device_hash_insert(
        const mach_device_t     device,
        const vm_offset_t       offset,
        const dev_pager_t       rec)
@@ -294,7 +294,7 @@ void dev_device_hash_insert(
        simple_unlock(&dev_device_hash_lock);
 }
 
-void dev_device_hash_delete(
+static void dev_device_hash_delete(
        const mach_device_t     device,
        const vm_offset_t       offset)
 {
@@ -317,7 +317,7 @@ void dev_device_hash_delete(
            kmem_cache_free(&dev_device_hash_cache, (vm_offset_t)entry);
 }
 
-dev_pager_t dev_device_hash_lookup(
+static dev_pager_t dev_device_hash_lookup(
        const mach_device_t     device,
        const vm_offset_t       offset)
 {
diff --git a/device/device_init.c b/device/device_init.c
index 794186ee..287d0a20 100644
--- a/device/device_init.c
+++ b/device/device_init.c
@@ -38,6 +38,7 @@
 #include <device/device_types.h>
 #include <device/device_port.h>
 #include <device/tty.h>
+#include <device/device_init.h>
 #include <device/ds_routines.h>
 #include <device/net_io.h>
 #include <device/chario.h>
diff --git a/device/ds_routines.c b/device/ds_routines.c
index ba233a91..11589d63 100644
--- a/device/ds_routines.c
+++ b/device/ds_routines.c
@@ -1680,7 +1680,7 @@ mach_device_trap_init(void)
  * Could have lists of different size caches.
  * Could call a device-specific routine.
  */
-io_req_t
+static io_req_t
 ds_trap_req_alloc(const mach_device_t device, vm_size_t data_size)
 {
        return (io_req_t) kmem_cache_alloc(&io_trap_cache);
@@ -1689,7 +1689,7 @@ ds_trap_req_alloc(const mach_device_t device, vm_size_t 
data_size)
 /*
  * Called by iodone to release ior.
  */
-boolean_t
+static boolean_t
 ds_trap_write_done(const io_req_t ior)
 {
        mach_device_t   dev;
diff --git a/device/net_io.c b/device/net_io.c
index 338b433c..4392f711 100644
--- a/device/net_io.c
+++ b/device/net_io.c
@@ -235,7 +235,7 @@ net_kmsg_collect(void)
        (void) splx(s);
 }
 
-void
+static void
 net_kmsg_more(void)
 {
        ipc_kmsg_t kmsg;
@@ -412,7 +412,7 @@ mach_msg_type_t packet_type = {
  *     Dequeues a message and delivers it at spl0.
  *     Returns FALSE if no messages.
  */
-boolean_t net_deliver(boolean_t nonblocking)
+static boolean_t net_deliver(boolean_t nonblocking)
 {
        ipc_kmsg_t kmsg;
        boolean_t high_priority;
@@ -549,7 +549,7 @@ void net_ast(void)
        (void) splx(s);
 }
 
-void __attribute__ ((noreturn)) net_thread_continue(void)
+static void __attribute__ ((noreturn)) net_thread_continue(void)
 {
        for (;;) {
                spl_t s;
@@ -602,7 +602,7 @@ void net_thread(void)
        /*NOTREACHED*/
 }
 
-void
+static void
 reorder_queue(
        queue_t         first, 
        queue_t         last)
@@ -1010,7 +1010,7 @@ net_do_filter(infp, data, data_count, header)
 /*
  * Check filter for invalid operations or stack over/under-flow.
  */
-boolean_t
+static boolean_t
 parse_net_filter(
        filter_t                *filter,
        unsigned int            count)
@@ -2100,7 +2100,7 @@ net_add_q_info(ipc_port_t rcv_port)
        return (int)qlimit;
 }
 
-void
+static void
 net_del_q_info(int qlimit)
 {
        simple_lock(&net_kmsg_total_lock);
diff --git a/device/subrs.c b/device/subrs.c
index 7a56f4b7..2cf7e6f4 100644
--- a/device/subrs.c
+++ b/device/subrs.c
@@ -34,6 +34,7 @@
 #include <device/buf.h>
 #include <device/if_hdr.h>
 #include <device/if_ether.h>
+#include <device/subrs.h>
 
 
 
diff --git a/i386/i386/db_disasm.c b/i386/i386/db_disasm.c
index de268ed8..9271e08c 100644
--- a/i386/i386/db_disasm.c
+++ b/i386/i386/db_disasm.c
@@ -862,7 +862,7 @@ int db_lengths[] = {
 /*
  * Read address at location and return updated location.
  */
-db_addr_t
+static db_addr_t
 db_read_address(
        db_addr_t       loc,
        int             short_addr,
@@ -948,7 +948,7 @@ db_read_address(
        return loc;
 }
 
-void
+static void
 db_print_address(
        const char *            seg,
        int                     size,
@@ -980,7 +980,7 @@ db_print_address(
  * Disassemble floating-point ("escape") instruction
  * and return updated location.
  */
-db_addr_t
+static db_addr_t
 db_disasm_esc(
        db_addr_t       loc,
        int             inst,
diff --git a/i386/i386/db_interface.c b/i386/i386/db_interface.c
index 0b11910d..3a331490 100644
--- a/i386/i386/db_interface.c
+++ b/i386/i386/db_interface.c
@@ -236,7 +236,7 @@ db_clear_hw_watchpoint(
 /*
  * Print trap reason.
  */
-void
+static void
 kdbprinttrap(
        int     type, 
        int     code)
@@ -444,7 +444,7 @@ kdb_kentry(
 
 boolean_t db_no_vm_fault = TRUE;
 
-int
+static int
 db_user_to_phys_address(
        const task_t    task,
        vm_offset_t     addr,
diff --git a/i386/i386/db_trace.c b/i386/i386/db_trace.c
index 5e2bef8b..5eebc727 100644
--- a/i386/i386/db_trace.c
+++ b/i386/i386/db_trace.c
@@ -114,7 +114,7 @@ struct i386_kregs {
        { 0 },
 };
 
-long *
+static long *
 db_lookup_i386_kreg(
        const char *name,
        const long *kregp)
@@ -182,7 +182,7 @@ db_i386_reg_value(
            *valuep = *dp;
 }
 
-void
+static void
 db_find_trace_symbols(void)
 {
        db_expr_t       value;
@@ -210,7 +210,7 @@ db_find_trace_symbols(void)
  */
 const int db_numargs_default = 5;
 
-int
+static int
 db_numargs(
        struct i386_frame *fp,
        task_t task)
@@ -261,7 +261,7 @@ struct interrupt_frame {
  *   It might be possible to dig out from the next frame up the name
  *   of the function that faulted, but that could get hairy.
  */
-void
+static void
 db_nextframe(
        struct i386_frame **lfp,        /* in/out */
        struct i386_frame **fp,         /* in/out */
@@ -562,7 +562,7 @@ db_i386_stack_trace(
 
 #if    CTHREADS_SUPPORT
 
-thread_t
+static thread_t
 db_find_kthread(
        vm_offset_t     ustack_base,
        vm_size_t       ustack_top,
@@ -613,7 +613,7 @@ const int db_cprocsw_pc_offset = 4 * 4;
 
 extern jmp_buf_t *db_recover;
 
-void db_trace_cproc(
+static void db_trace_cproc(
        vm_offset_t     cproc,
        thread_t        thread)
 {
diff --git a/i386/i386/fpu.c b/i386/i386/fpu.c
index e184ca72..36bdb41d 100644
--- a/i386/i386/fpu.c
+++ b/i386/i386/fpu.c
@@ -899,23 +899,6 @@ ASSERT_IPL(SPL0);
        ifps->fp_valid = FALSE;         /* in FPU */
 }
 
-/*
- * Allocate and initialize FP state for current thread.
- * Don't load state.
- *
- * Locking not needed; always called on the current thread.
- */
-void
-fp_state_alloc(void)
-{
-       pcb_t   pcb = current_thread()->pcb;
-       struct i386_fpsave_state *ifps;
-
-       ifps = (struct i386_fpsave_state *)kmem_cache_alloc(&ifps_cache);
-       memcpy(ifps, fp_default_state, fp_xsave_size);
-       pcb->ims.ifps = ifps;
-}
-
 #if    (defined(AT386) || defined(ATX86_64)) && !defined(MACH_XEN)
 /*
  *     Handle a coprocessor error interrupt on the AT386.
diff --git a/i386/i386/hardclock.c b/i386/i386/hardclock.c
index 57259ff3..e804b97c 100644
--- a/i386/i386/hardclock.c
+++ b/i386/i386/hardclock.c
@@ -34,6 +34,7 @@
 
 #include <kern/mach_clock.h>
 #include <i386/thread.h>
+#include <i386/hardclock.h>
 
 #if    defined(AT386) || defined(ATX86_64)
 #include <i386/ipl.h>
diff --git a/i386/i386/io_map.c b/i386/i386/io_map.c
index 3e45f316..368f200b 100644
--- a/i386/i386/io_map.c
+++ b/i386/i386/io_map.c
@@ -36,7 +36,7 @@ extern vm_offset_t kernel_virtual_start;
  * Allocate and map memory for devices that may need to be mapped before
  * Mach VM is running.
  */
-vm_offset_t
+static vm_offset_t
 io_map(
        phys_addr_t     phys_addr,
        vm_size_t       size)
diff --git a/i386/i386/loose_ends.c b/i386/i386/loose_ends.c
index 64b53b71..7e7f943b 100644
--- a/i386/i386/loose_ends.c
+++ b/i386/i386/loose_ends.c
@@ -26,6 +26,8 @@
 /*
  */
 
+#include <i386/i386/loose_ends.h>
+
 #ifndef NDEBUG
 #define MACH_ASSERT 1
 #else
@@ -45,17 +47,3 @@ delay(int n)
 {
        DELAY(n);
 }
-
-#if    MACH_ASSERT
-
-/*
- * Machine-dependent routine to fill in an array with up to callstack_max
- * levels of return pc information.
- */
-void machine_callstack(
-       const unsigned long     *buf,
-       int                     callstack_max)
-{
-}
-
-#endif /* MACH_ASSERT */
diff --git a/i386/i386at/kd.c b/i386/i386at/kd.c
index 5b932889..70737479 100644
--- a/i386/i386at/kd.c
+++ b/i386/i386at/kd.c
@@ -1448,7 +1448,7 @@ kd_parseesc(void)
  */
 
 #define reverse_video_char(a)       (((a) & 0x88) | ((((a) >> 4) | ((a) << 4)) 
& 0x77))
-void
+static void
 kd_update_kd_attr(void)
 {
        kd_attr = kd_color;
@@ -2721,7 +2721,7 @@ bmpput(
  * bmpcp1char: copy 1 char from one place in the frame buffer to
  * another.
  */
-void
+static void
 bmpcp1char(
        csrpos_t from, 
        csrpos_t to)
diff --git a/i386/i386at/kd_event.c b/i386/i386at/kd_event.c
index 518e4859..5b1f7098 100644
--- a/i386/i386at/kd_event.c
+++ b/i386/i386at/kd_event.c
@@ -90,7 +90,7 @@ static boolean_t initialized = FALSE;
  * kbdinit - set up event queue.
  */
 
-void
+static void
 kbdinit(void)
 {
        spl_t s = SPLKD();
@@ -304,7 +304,7 @@ kbd_enqueue(kd_event *ev)
 u_int X_kdb_enter_str[512], X_kdb_exit_str[512];
 int   X_kdb_enter_len = 0,  X_kdb_exit_len = 0;
 
-void
+static void
 kdb_in_out(const u_int *p)
 {
        int t = p[0];
diff --git a/i386/i386at/mem.c b/i386/i386at/mem.c
index ac0fd301..f46fc038 100644
--- a/i386/i386at/mem.c
+++ b/i386/i386at/mem.c
@@ -27,6 +27,7 @@
 #include <device/io_req.h>
 #include <i386/model_dep.h>
 #include <i386at/biosmem.h>
+#include <i386at/mem.h>
 
 /* This provides access to any memory that is not main RAM */
 
diff --git a/i386/i386at/model_dep.c b/i386/i386at/model_dep.c
index 1819526b..0fc99406 100644
--- a/i386/i386at/model_dep.c
+++ b/i386/i386at/model_dep.c
@@ -361,7 +361,7 @@ register_boot_data(const struct multiboot_raw_info *mbi)
  * Basic PC VM initialization.
  * Turns on paging and changes the kernel segments to use high linear 
addresses.
  */
-void
+static void
 i386at_init(void)
 {
        /* XXX move to intel/pmap.h */
diff --git a/i386/i386at/rtc.c b/i386/i386at/rtc.c
index d771df8e..b2068416 100644
--- a/i386/i386at/rtc.c
+++ b/i386/i386at/rtc.c
@@ -60,7 +60,7 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
 static boolean_t first_rtcopen_ever = TRUE;
 
-void
+static void
 rtcinit(void)
 {
        outb(RTC_ADDR, RTC_A);
@@ -70,7 +70,7 @@ rtcinit(void)
 }
 
 
-int
+static int
 rtcget(struct rtc_st *st)
 {
        unsigned char *regs = (unsigned char *)st;
@@ -87,7 +87,7 @@ rtcget(struct rtc_st *st)
        return(0);
 }
 
-void
+static void
 rtcput(struct rtc_st *st)
 {
        unsigned char *regs = (unsigned char *)st;
@@ -111,7 +111,7 @@ extern struct timeval time;
 
 static int month[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
 
-int
+static int
 yeartoday(int year)
 {
        if (year%4)
@@ -134,13 +134,13 @@ yeartoday(int year)
        return 366;
 }
 
-int
+static int
 hexdectodec(char n)
 {
        return(((n>>4)&0x0F)*10 + (n&0x0F));
 }
 
-char
+static char
 dectohexdec(int n)
 {
        return((char)(((n/10)<<4)&0xF0) | ((n%10)&0x0F));
diff --git a/ipc/ipc_kmsg.c b/ipc/ipc_kmsg.c
index 1e00b355..73041703 100644
--- a/ipc/ipc_kmsg.c
+++ b/ipc/ipc_kmsg.c
@@ -217,7 +217,7 @@ ipc_kmsg_destroy(
  *             No locks held.
  */
 
-void
+static void
 ipc_kmsg_clean_body(
        vm_offset_t saddr,
        vm_offset_t eaddr)
@@ -359,7 +359,7 @@ ipc_kmsg_clean(ipc_kmsg_t kmsg)
  *             Nothing locked.
  */
 
-void
+static void
 ipc_kmsg_clean_partial(
        ipc_kmsg_t              kmsg,
        vm_offset_t             eaddr,
@@ -1292,7 +1292,7 @@ ipc_kmsg_copyin_header(
        return MACH_SEND_INVALID_REPLY;
 }
 
-mach_msg_return_t
+static mach_msg_return_t
 ipc_kmsg_copyin_body(
        ipc_kmsg_t      kmsg,
        ipc_space_t     space,
@@ -2639,7 +2639,7 @@ ipc_kmsg_copyout_dest(
 
 #if    MACH_KDB
 
-char *
+static char *
 ipc_type_name(
        int             type_name,
        boolean_t       received)
@@ -2707,7 +2707,7 @@ ipc_type_name(
        }
 }
 
-void
+static void
 ipc_print_type_name(
        int     type_name)
 {
diff --git a/ipc/ipc_notify.c b/ipc/ipc_notify.c
index 1fff8ead..eea60116 100644
--- a/ipc/ipc_notify.c
+++ b/ipc/ipc_notify.c
@@ -58,7 +58,7 @@ mach_dead_name_notification_t         
ipc_notify_dead_name_template;
  *             Initialize a template for port-deleted notifications.
  */
 
-void
+static void
 ipc_notify_init_port_deleted(mach_port_deleted_notification_t *n)
 {
        mach_msg_header_t *m = &n->not_header;
@@ -88,7 +88,7 @@ ipc_notify_init_port_deleted(mach_port_deleted_notification_t 
*n)
  *             Initialize a template for msg-accepted notifications.
  */
 
-void
+static void
 ipc_notify_init_msg_accepted(mach_msg_accepted_notification_t *n)
 {
        mach_msg_header_t *m = &n->not_header;
@@ -118,7 +118,7 @@ 
ipc_notify_init_msg_accepted(mach_msg_accepted_notification_t *n)
  *             Initialize a template for port-destroyed notifications.
  */
 
-void
+static void
 ipc_notify_init_port_destroyed(mach_port_destroyed_notification_t *n)
 {
        mach_msg_header_t *m = &n->not_header;
@@ -149,7 +149,7 @@ 
ipc_notify_init_port_destroyed(mach_port_destroyed_notification_t *n)
  *             Initialize a template for no-senders notifications.
  */
 
-void
+static void
 ipc_notify_init_no_senders(
        mach_no_senders_notification_t  *n)
 {
@@ -180,7 +180,7 @@ ipc_notify_init_no_senders(
  *             Initialize a template for send-once notifications.
  */
 
-void
+static void
 ipc_notify_init_send_once(
        mach_send_once_notification_t   *n)
 {
@@ -200,7 +200,7 @@ ipc_notify_init_send_once(
  *             Initialize a template for dead-name notifications.
  */
 
-void
+static void
 ipc_notify_init_dead_name(
        mach_dead_name_notification_t   *n)
 {
diff --git a/ipc/mach_port.c b/ipc/mach_port.c
index db6e05dc..e5a5e978 100644
--- a/ipc/mach_port.c
+++ b/ipc/mach_port.c
@@ -69,7 +69,7 @@
  *             A helper function for mach_port_names.
  */
 
-void
+static void
 mach_port_names_helper(
        ipc_port_timestamp_t    timestamp,
        ipc_entry_t             entry,
@@ -856,7 +856,7 @@ mach_port_set_seqno(
  *             A helper function for mach_port_get_set_status.
  */
 
-void
+static void
 mach_port_gst_helper(
        ipc_pset_t              pset,
        ipc_port_t              port,
diff --git a/kern/bootstrap.c b/kern/bootstrap.c
index 6593fed1..fdc75757 100644
--- a/kern/bootstrap.c
+++ b/kern/bootstrap.c
@@ -40,6 +40,7 @@
 #include <machine/pcb.h>
 #include <ipc/ipc_port.h>
 #include <ipc/mach_port.h>
+#include <kern/bootstrap.h>
 #include <kern/debug.h>
 #include <kern/host.h>
 #include <kern/printf.h>
diff --git a/kern/debug.c b/kern/debug.c
index 78c55f81..3b472ff2 100644
--- a/kern/debug.c
+++ b/kern/debug.c
@@ -205,6 +205,8 @@ unsigned char __stack_chk_guard [ sizeof (vm_offset_t) ] =
        [ sizeof (vm_offset_t) - 1 ] = 0xff,
 };
 
+void __stack_chk_fail (void);
+
 void
 __stack_chk_fail (void)
 {
diff --git a/kern/ipc_mig.c b/kern/ipc_mig.c
index f353009e..a9e3f53b 100644
--- a/kern/ipc_mig.c
+++ b/kern/ipc_mig.c
@@ -330,7 +330,7 @@ MACRO_BEGIN                                                 
        \
        is_read_unlock(space);                                          \
 MACRO_END
 
-device_t
+static device_t
 port_name_to_device(mach_port_name_t name)
 {
        ipc_port_t port;
@@ -373,7 +373,7 @@ port_name_to_device(mach_port_name_t name)
     }
 }
 
-thread_t
+static thread_t
 port_name_to_thread(mach_port_name_t name)
 {
        ipc_port_t port;
@@ -418,7 +418,7 @@ port_name_to_thread(mach_port_name_t name)
     }
 }
 
-task_t
+static task_t
 port_name_to_task(mach_port_name_t name)
 {
        ipc_port_t port;
@@ -465,7 +465,7 @@ port_name_to_task(mach_port_name_t name)
     }
 }
 
-vm_map_t
+static vm_map_t
 port_name_to_map(
        mach_port_name_t        name)
 {
@@ -513,7 +513,7 @@ port_name_to_map(
     }
 }
 
-ipc_space_t
+static ipc_space_t
 port_name_to_space(mach_port_name_t name)
 {
        ipc_port_t port;
diff --git a/kern/mach_clock.c b/kern/mach_clock.c
index 3a568647..6f964f73 100644
--- a/kern/mach_clock.c
+++ b/kern/mach_clock.c
@@ -405,7 +405,7 @@ struct time_value clock_boottime_offset;
  * This function must be called when the real-time clock is updated.
  * This function must be called at SPLHIGH.
  */
-void
+static void
 clock_boottime_update(struct time_value *new_time)
 {
        struct time_value delta = time;
diff --git a/kern/machine.c b/kern/machine.c
index 0e1781cc..6f481a5c 100644
--- a/kern/machine.c
+++ b/kern/machine.c
@@ -44,6 +44,7 @@
 #include <kern/debug.h>
 #include <kern/ipc_host.h>
 #include <kern/host.h>
+#include <kern/machine.h>
 #include <kern/lock.h>
 #include <kern/processor.h>
 #include <kern/queue.h>
@@ -103,7 +104,7 @@ void cpu_up(int cpu)
  *     Flag specified cpu as down.  Called when a processor is about to
  *     go offline.
  */
-void cpu_down(int cpu)
+static void cpu_down(int cpu)
 {
        struct machine_slot     *ms;
        processor_t             processor;
diff --git a/kern/priority.c b/kern/priority.c
index 587ea2f9..3dba0c80 100644
--- a/kern/priority.c
+++ b/kern/priority.c
@@ -42,6 +42,7 @@
 #include <kern/sched.h>
 #include <kern/sched_prim.h>
 #include <kern/thread.h>
+#include <kern/priority.h>
 #include <kern/processor.h>
 #include <kern/timer.h>
 #include <kern/time_stamp.h>
diff --git a/kern/processor.c b/kern/processor.c
index ec56952e..75d2ff53 100644
--- a/kern/processor.c
+++ b/kern/processor.c
@@ -845,7 +845,7 @@ processor_set_policy_disable(
  *
  *     Common internals for processor_set_{threads,tasks}
  */
-kern_return_t
+static kern_return_t
 processor_set_things(
        processor_set_t pset,
        mach_port_t     **thing_list,
diff --git a/kern/queue.c b/kern/queue.c
index d9396e54..f5326202 100644
--- a/kern/queue.c
+++ b/kern/queue.c
@@ -119,13 +119,3 @@ void insque(
        (pred->next)->prev = entry;
        pred->next = entry;
 }
-
-struct queue_entry
-*remque(
-       struct queue_entry *elt)
-{
-       (elt->next)->prev = elt->prev;
-       (elt->prev)->next = elt->next;
-       return(elt);
-}
-
diff --git a/kern/sched_prim.c b/kern/sched_prim.c
index 63a0437c..9e7a9c55 100644
--- a/kern/sched_prim.c
+++ b/kern/sched_prim.c
@@ -134,7 +134,7 @@ decl_simple_lock_data(,     wait_lock[NUMQUEUES])
 #define wait_hash(event) \
        ((((long)(event) < 0) ? ~(long)(event) : (long)(event)) % NUMQUEUES)
 
-void wait_queue_init(void)
+static void wait_queue_init(void)
 {
        int i;
 
@@ -162,7 +162,7 @@ void sched_init(void)
  *     Thread timeout routine, called when timer expires.
  *     Called at splsoftclock.
  */
-void thread_timeout(
+static void thread_timeout(
        void *_thread)
 {
        thread_t thread = _thread;
@@ -490,7 +490,7 @@ void thread_bind(
  *     Assumes splsched.
  */
 
-thread_t thread_select(
+static thread_t thread_select(
        processor_t myprocessor)
 {
        thread_t thread;
@@ -1604,7 +1604,7 @@ int       no_dispatch_count = 0;
  *     to execute.
  */
 
-void __attribute__((noreturn)) idle_thread_continue(void)
+static void __attribute__((noreturn)) idle_thread_continue(void)
 {
        processor_t myprocessor;
        volatile thread_t *threadp;
@@ -1795,7 +1795,7 @@ void idle_thread(void)
  *     we don't want to do at interrupt level.  This allows us to
  *     avoid blocking.
  */
-void sched_thread_continue(void)
+static void sched_thread_continue(void)
 {
     while (TRUE) {
        (void) compute_mach_factor();
@@ -1860,7 +1860,7 @@ int                       stuck_count = 0;
  *     it ran out of space.
  */
 
-boolean_t
+static boolean_t
 do_runq_scan(
        run_queue_t     runq)
 {
diff --git a/kern/syscall_emulation.c b/kern/syscall_emulation.c
index 95e91d55..5a477006 100644
--- a/kern/syscall_emulation.c
+++ b/kern/syscall_emulation.c
@@ -116,7 +116,7 @@ void eml_task_deallocate(task)
  *   task_set_emulation_vector:  [Server Entry]
  *   set a list of emulated system calls for this task.
  */
-kern_return_t
+static kern_return_t
 task_set_emulation_vector_internal(
        task_t                  task,
        int                     vector_start,
diff --git a/kern/syscall_subr.c b/kern/syscall_subr.c
index 1aa4bc27..0030e027 100644
--- a/kern/syscall_subr.c
+++ b/kern/syscall_subr.c
@@ -61,7 +61,7 @@
  *     returned, the thread should make one more check on the
  *     lock and then be a good citizen and really suspend.
  */
-void swtch_continue(void)
+static void swtch_continue(void)
 {
        processor_t     myprocessor;
 
@@ -89,7 +89,7 @@ boolean_t swtch(void)
               myprocessor->processor_set->runq.count > 0);
 }
 
-void swtch_pri_continue(void)
+static void swtch_pri_continue(void)
 {
        thread_t        thread = current_thread();
        processor_t     myprocessor;
@@ -130,7 +130,7 @@ boolean_t  swtch_pri(int pri)
               myprocessor->processor_set->runq.count > 0);
 }
 
-void thread_switch_continue(void)
+static void thread_switch_continue(void)
 {
        thread_t        cur_thread = current_thread();
 
diff --git a/kern/syscall_sw.c b/kern/syscall_sw.c
index 3cdefde1..f2163132 100644
--- a/kern/syscall_sw.c
+++ b/kern/syscall_sw.c
@@ -60,13 +60,13 @@
 
 boolean_t kern_invalid_debug = FALSE;
 
-mach_port_name_t       null_port(void)
+static mach_port_name_t        null_port(void)
 {
        if (kern_invalid_debug) SoftDebugger("null_port mach trap");
        return(MACH_PORT_NULL);
 }
 
-kern_return_t  kern_invalid(void)
+static kern_return_t   kern_invalid(void)
 {
        if (kern_invalid_debug) SoftDebugger("kern_invalid mach trap");
        return(KERN_INVALID_ARGUMENT);
diff --git a/kern/task.c b/kern/task.c
index e9158c73..d5bd14c2 100644
--- a/kern/task.c
+++ b/kern/task.c
@@ -1178,7 +1178,7 @@ task_set_essential(
  *     Attempt to free resources owned by tasks.
  */
 
-void task_collect_scan(void)
+static void task_collect_scan(void)
 {
        task_t                  task, prev_task;
        processor_set_t         pset, prev_pset;
diff --git a/kern/thread.c b/kern/thread.c
index 82863b38..c420869f 100644
--- a/kern/thread.c
+++ b/kern/thread.c
@@ -1136,7 +1136,7 @@ kern_return_t thread_halt(
        }
 }
 
-void __attribute__((noreturn)) walking_zombie(void)
+static void __attribute__((noreturn)) walking_zombie(void)
 {
        panic("the zombie walks!");
 }
@@ -1722,7 +1722,7 @@ thread_t kernel_thread(
  *     This kernel thread runs forever looking for threads to destroy
  *     (when they request that they be destroyed, of course).
  */
-void __attribute__((noreturn)) reaper_thread_continue(void)
+static void __attribute__((noreturn)) reaper_thread_continue(void)
 {
        for (;;) {
                thread_t thread;
@@ -2261,7 +2261,7 @@ thread_wire(
  *     pcb_collect doesn't do anything yet.
  */
 
-void thread_collect_scan(void)
+static void thread_collect_scan(void)
 {
        thread_t        thread, prev_thread;
        processor_set_t         pset, prev_pset;
@@ -2348,8 +2348,7 @@ void consider_thread_collect(void)
 
 #if    MACH_DEBUG
 
-vm_size_t stack_usage(
-       vm_offset_t stack)
+static vm_size_t stack_usage(vm_offset_t stack)
 {
        unsigned i;
 
diff --git a/kern/timer.c b/kern/timer.c
index 79ada27e..0cf94cd4 100644
--- a/kern/timer.c
+++ b/kern/timer.c
@@ -374,24 +374,6 @@ static void timer_grab(
        } while ( (save)->high != (timer)->high_bits_check);
 }
 
-/*
- *
- *     Db_timer_grab(): used by db_thread_read_times. An nonblocking
- *      version of db_thread_get_times. Keep coherent with timer_grab
- *      above.
- *
- */
-void db_timer_grab(
-       timer_t         timer,
-       timer_save_t    save)
-{
-  /* Don't worry about coherency */
-
-  (save)->high = (timer)->high_bits;
-  (save)->low = (timer)->low_bits;
-}
-
-
 /*
  *     timer_read reads the value of a timer into a time_value_t.  If the
  *     timer was modified during the read, retry.  The value returned
diff --git a/util/putchar.c b/util/putchar.c
index 6f8e18ea..76c013ed 100644
--- a/util/putchar.c
+++ b/util/putchar.c
@@ -22,6 +22,7 @@
  */
 
 #include <device/cons.h>
+#include <util/putchar.h>
 
 int putchar(int c)
 {
diff --git a/vm/vm_debug.c b/vm/vm_debug.c
index 3339d0c8..c76e63b7 100644
--- a/vm/vm_debug.c
+++ b/vm/vm_debug.c
@@ -65,7 +65,7 @@
  *             or IP_NULL if the object or its name port is null.
  */
 
-ipc_port_t
+static ipc_port_t
 vm_object_real_name(vm_object_t object)
 {
        ipc_port_t port = IP_NULL;
diff --git a/vm/vm_fault.c b/vm/vm_fault.c
index 44801911..c6e28004 100644
--- a/vm/vm_fault.c
+++ b/vm/vm_fault.c
@@ -1129,7 +1129,7 @@ vm_fault_return_t vm_fault_page(
  *             and deallocated when leaving vm_fault.
  */
 
-void
+static void
 vm_fault_continue(void)
 {
        vm_fault_state_t *state =
@@ -1767,7 +1767,7 @@ kern_return_t vm_fault_wire_fast(
  *             Release a page used by vm_fault_copy.
  */
 
-void   vm_fault_copy_cleanup(
+static void vm_fault_copy_cleanup(
        vm_page_t       page,
        vm_page_t       top_page)
 {
diff --git a/vm/vm_init.c b/vm/vm_init.c
index 23d5d46e..593af11b 100644
--- a/vm/vm_init.c
+++ b/vm/vm_init.c
@@ -38,6 +38,7 @@
 #include <kern/slab.h>
 #include <kern/kalloc.h>
 #include <vm/vm_fault.h>
+#include <vm/vm_init.h>
 #include <vm/vm_object.h>
 #include <vm/vm_map.h>
 #include <vm/vm_page.h>
diff --git a/vm/vm_map.c b/vm/vm_map.c
index 963aa507..b142ab9d 100644
--- a/vm/vm_map.c
+++ b/vm/vm_map.c
@@ -280,7 +280,8 @@ void vm_map_unlock(struct vm_map *map)
 #define        vm_map_copy_entry_create(copy) \
            _vm_map_entry_create(&(copy)->cpy_hdr)
 
-vm_map_entry_t _vm_map_entry_create(const struct vm_map_header *map_header)
+static vm_map_entry_t
+_vm_map_entry_create(const struct vm_map_header *map_header)
 {
        vm_map_entry_t  entry;
 
@@ -302,7 +303,8 @@ vm_map_entry_t _vm_map_entry_create(const struct 
vm_map_header *map_header)
 #define        vm_map_copy_entry_dispose(map, entry) \
        _vm_map_entry_dispose(&(copy)->cpy_hdr, (entry))
 
-void _vm_map_entry_dispose(const struct vm_map_header *map_header,
+static void
+_vm_map_entry_dispose(const struct vm_map_header *map_header,
                vm_map_entry_t entry)
 {
        (void)map_header;
@@ -632,27 +634,6 @@ boolean_t vm_map_lookup_entry(
        }
 }
 
-/*
- *      Routine:     invalid_user_access
- *
- *     Verifies whether user access is valid.
- */
-
-boolean_t
-invalid_user_access(
-        vm_map_t       map,
-        vm_offset_t    start, 
-       vm_offset_t     end,
-        vm_prot_t      prot)
-{
-        vm_map_entry_t entry;
-
-        return (map == VM_MAP_NULL || map == kernel_map ||
-               !vm_map_lookup_entry(map, start, &entry) ||
-               entry->vme_end < end ||
-               (prot & ~(entry->protection)));
-}
-
 /*
  * Find a range of available space from the specified map.
  *
@@ -913,7 +894,7 @@ boolean_t vm_map_pmap_enter_enable = FALSE;
  *     In/out conditions:
  *             The source map should not be locked on entry.
  */
-void
+static void
 vm_map_pmap_enter(
        vm_map_t        map,
        vm_offset_t     addr,
@@ -2047,7 +2028,7 @@ kern_return_t vm_map_remove(
  *     Steal all the pages from a vm_map_copy page_list by copying ones
  *     that have not already been stolen.
  */
-void
+static void
 vm_map_copy_steal_pages(vm_map_copy_t copy)
 {
        vm_page_t       m, new_m;
@@ -3673,7 +3654,7 @@ kern_return_t vm_map_copyin_object(
  *     the scheduler.
  */
 
-kern_return_t  vm_map_copyin_page_list_cont(
+static kern_return_t   vm_map_copyin_page_list_cont(
        vm_map_copyin_args_t    cont_args,
        vm_map_copy_t           *copy_result)   /* OUT */
 {
@@ -4874,65 +4855,6 @@ vm_region_create_proxy (task_t task, vm_address_t 
address,
   return ret;
 }
 
-/*
- *     Routine:        vm_map_simplify
- *
- *     Description:
- *             Attempt to simplify the map representation in
- *             the vicinity of the given starting address.
- *     Note:
- *             This routine is intended primarily to keep the
- *             kernel maps more compact -- they generally don't
- *             benefit from the "expand a map entry" technology
- *             at allocation time because the adjacent entry
- *             is often wired down.
- */
-void vm_map_simplify(
-       vm_map_t        map,
-       vm_offset_t     start)
-{
-       vm_map_entry_t  this_entry;
-       vm_map_entry_t  prev_entry;
-
-       vm_map_lock(map);
-       if (
-               (vm_map_lookup_entry(map, start, &this_entry)) &&
-               ((prev_entry = this_entry->vme_prev) != vm_map_to_entry(map)) &&
-
-               (prev_entry->vme_end == start) &&
-
-               (prev_entry->is_shared == FALSE) &&
-               (prev_entry->is_sub_map == FALSE) &&
-
-               (this_entry->is_shared == FALSE) &&
-               (this_entry->is_sub_map == FALSE) &&
-
-               (prev_entry->inheritance == this_entry->inheritance) &&
-               (prev_entry->protection == this_entry->protection) &&
-               (prev_entry->max_protection == this_entry->max_protection) &&
-               (prev_entry->wired_count == this_entry->wired_count) &&
-
-               (prev_entry->needs_copy == this_entry->needs_copy) &&
-
-               (prev_entry->object.vm_object == this_entry->object.vm_object) 
&&
-               ((prev_entry->offset + (prev_entry->vme_end - 
prev_entry->vme_start))
-                    == this_entry->offset) &&
-               (prev_entry->projected_on == 0) &&
-               (this_entry->projected_on == 0)
-       ) {
-               if (map->first_free == this_entry)
-                       map->first_free = prev_entry;
-
-               SAVE_HINT(map, prev_entry);
-               prev_entry->vme_end = this_entry->vme_end;
-               vm_map_entry_unlink(map, this_entry);
-               vm_object_deallocate(this_entry->object.vm_object);
-               vm_map_entry_dispose(map, this_entry);
-       }
-       vm_map_unlock(map);
-}
-
-
 /*
  *     Routine:        vm_map_machine_attribute
  *     Purpose:
diff --git a/vm/vm_object.c b/vm/vm_object.c
index 0dc3d540..141bd094 100644
--- a/vm/vm_object.c
+++ b/vm/vm_object.c
@@ -226,7 +226,7 @@ static void _vm_object_setup(
        object->size = size;
 }
 
-vm_object_t _vm_object_allocate(
+static vm_object_t _vm_object_allocate(
        vm_size_t               size)
 {
        vm_object_t object;
@@ -725,7 +725,7 @@ void memory_object_release(
  *     In/out conditions:
  *             The object is locked on entry and exit.
  */
-void vm_object_abort_activity(
+static void vm_object_abort_activity(
        vm_object_t     object)
 {
        vm_page_t       p;
@@ -1288,7 +1288,7 @@ boolean_t vm_object_copy_temporary(
  *             If the return value indicates an error, this parameter
  *             is not valid.
  */
-kern_return_t vm_object_copy_call(
+static kern_return_t vm_object_copy_call(
        vm_object_t     src_object,
        vm_offset_t     src_offset,
        vm_size_t       size,
diff --git a/vm/vm_pageout.c b/vm/vm_pageout.c
index 575a9f5d..e2f4cf2b 100644
--- a/vm/vm_pageout.c
+++ b/vm/vm_pageout.c
@@ -412,7 +412,7 @@ vm_pageout_page(
  *     It returns with vm_page_queue_free_lock held.
  */
 
-boolean_t vm_pageout_scan(boolean_t *should_wait)
+static boolean_t vm_pageout_scan(boolean_t *should_wait)
 {
        boolean_t done;
 
diff --git a/vm/vm_resident.c b/vm/vm_resident.c
index 4af103d4..13709a90 100644
--- a/vm/vm_resident.c
+++ b/vm/vm_resident.c
@@ -52,6 +52,7 @@
 #include <vm/vm_page.h>
 #include <vm/vm_pageout.h>
 #include <vm/vm_kern.h>
+#include <vm/vm_resident.h>
 
 #if    MACH_VM_DEBUG
 #include <mach/kern_return.h>
-- 
2.37.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]