Cleanup with gcc. Removed unused variables.

Fixed some uninitialized problems.
This commit is contained in:
Jorrit Herder 2005-08-25 12:05:09 +00:00
parent a238c1ba48
commit 46c8884e36
6 changed files with 13 additions and 15 deletions

View file

@ -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);
}
/*===========================================================================*

View file

@ -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. */

View file

@ -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++)

View file

@ -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,

View file

@ -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) );

View file

@ -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);