From 46c8884e363c2a3fd9b014125e1929af2cac4d74 Mon Sep 17 00:00:00 2001 From: Jorrit Herder Date: Thu, 25 Aug 2005 12:05:09 +0000 Subject: [PATCH] Cleanup with gcc. Removed unused variables. Fixed some uninitialized problems. --- servers/pm/alloc.c | 6 +++--- servers/pm/exec.c | 4 ++-- servers/pm/forkexit.c | 6 +++--- servers/pm/main.c | 5 +++-- servers/pm/proto.h | 2 +- servers/pm/signal.c | 5 +---- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/servers/pm/alloc.c b/servers/pm/alloc.c index 4e09a4af4..ed3b6bffb 100644 --- a/servers/pm/alloc.c +++ b/servers/pm/alloc.c @@ -71,6 +71,7 @@ phys_clicks clicks; /* amount of memory requested */ phys_clicks old_base; do { + prev_ptr = NIL_HOLE; hp = hole_head; while (hp != NIL_HOLE && hp->h_base < swap_base) { if (hp->h_len >= clicks) { @@ -128,6 +129,7 @@ phys_clicks clicks; /* number of clicks to free */ } /* Block to be returned does not go on front of hole list. */ + prev_ptr = NIL_HOLE; while (hp != NIL_HOLE && base > hp->h_base) { prev_ptr = hp; hp = hp->h_next; @@ -212,9 +214,6 @@ phys_clicks *free; /* memory size summaries */ */ int i; register struct hole *hp; - phys_clicks base; /* base address of chunk */ - phys_clicks size; /* size of chunk */ - message mess; /* Put all holes on the free list. */ for (hp = &hole[0]; hp < &hole[NR_HOLES]; hp++) hp->h_next = hp + 1; @@ -262,6 +261,7 @@ u32_t offset, size; /* area on swap file to use */ size >>= CLICK_SHIFT; if (size > swap_maxsize) size = swap_maxsize; if (size > 0) free_mem(swap_base, (phys_clicks) size); + return(OK); } /*===========================================================================* diff --git a/servers/pm/exec.c b/servers/pm/exec.c index 1aa97aff7..d8ba35e3f 100644 --- a/servers/pm/exec.c +++ b/servers/pm/exec.c @@ -299,10 +299,10 @@ phys_bytes tot_bytes; /* total memory to allocate, including gap */ * the new map to the kernel. Zero the new core image's bss, gap and stack. */ - register struct mproc *rmp; + register struct mproc *rmp = mp; vir_clicks text_clicks, data_clicks, gap_clicks, stack_clicks, tot_clicks; phys_clicks new_base; - phys_bytes bytes, base, count, bss_offset; + phys_bytes bytes, base, bss_offset; int s; /* No need to allocate text if it can be shared. */ diff --git a/servers/pm/forkexit.c b/servers/pm/forkexit.c index 72bc9bdcd..d12c2bfc5 100644 --- a/servers/pm/forkexit.c +++ b/servers/pm/forkexit.c @@ -33,7 +33,7 @@ PUBLIC int do_fork() /* The process pointed to by 'mp' has forked. Create a child process. */ register struct mproc *rmp; /* pointer to parent */ register struct mproc *rmc; /* pointer to child */ - int i, child_nr, t; + int child_nr, s; phys_clicks prog_clicks, child_base; phys_bytes prog_bytes, parent_abs, child_abs; /* Intel only */ pid_t new_pid; @@ -60,8 +60,8 @@ PUBLIC int do_fork() /* Create a copy of the parent's core image for the child. */ child_abs = (phys_bytes) child_base << CLICK_SHIFT; parent_abs = (phys_bytes) rmp->mp_seg[D].mem_phys << CLICK_SHIFT; - i = sys_abscopy(parent_abs, child_abs, prog_bytes); - if (i < 0) panic(__FILE__,"do_fork can't copy", i); + s = sys_abscopy(parent_abs, child_abs, prog_bytes); + if (s < 0) panic(__FILE__,"do_fork can't copy", s); /* Find a slot in 'mproc' for the child process. A slot must exist. */ for (rmc = &mproc[0]; rmc < &mproc[NR_PROCS]; rmc++) diff --git a/servers/pm/main.c b/servers/pm/main.c index 163238f80..195684a76 100644 --- a/servers/pm/main.c +++ b/servers/pm/main.c @@ -39,7 +39,7 @@ FORWARD _PROTOTYPE( void patch_mem_chunks, (struct memory *mem_chunks, /*===========================================================================* * main * *===========================================================================*/ -PUBLIC void main() +PUBLIC int main() { /* Main routine of the process manager. */ int result, s, proc_nr; @@ -91,6 +91,7 @@ PUBLIC void main() } } } + return(OK); } /*===========================================================================* @@ -147,7 +148,7 @@ PRIVATE void pm_init() * array are struct hole, which, in addition to storage for a base and size in * click units also contain space for a link, a pointer to another element. */ - int key, i, s; + int s; static struct boot_image image[NR_BOOT_PROCS]; register struct boot_image *ip; static char core_sigs[] = { SIGQUIT, SIGILL, SIGTRAP, SIGABRT, diff --git a/servers/pm/proto.h b/servers/pm/proto.h index e9987de6b..49a1e4dd2 100644 --- a/servers/pm/proto.h +++ b/servers/pm/proto.h @@ -52,7 +52,7 @@ _PROTOTYPE( void pm_exit, (struct mproc *rmp, int exit_status) ); _PROTOTYPE( int do_getset, (void) ); /* main.c */ -_PROTOTYPE( void main, (void) ); +_PROTOTYPE( int main, (void) ); /* misc.c */ _PROTOTYPE( int do_reboot, (void) ); diff --git a/servers/pm/signal.c b/servers/pm/signal.c index 7168ae93f..d8da1e7d9 100644 --- a/servers/pm/signal.c +++ b/servers/pm/signal.c @@ -619,11 +619,8 @@ register struct mproc *rmp; /* whose core is to be dumped */ { /* Make a core dump on the file "core", if possible. */ - int s, fd, fake_fd, nr_written, seg, slot; - char *buf; + int s, fd, seg, slot; vir_bytes current_sp; - phys_bytes left; /* careful; 64K might overflow vir_bytes */ - unsigned nr_to_write; /* unsigned for arg to write() but < INT_MAX */ long trace_data, trace_off; slot = (int) (rmp - mproc);