From: Richard Sailer Date: Mon, 3 Oct 2016 22:18:35 +0000 (+0200) Subject: is: Convert K&R C -> ANSI C X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=4aa48abab95b2c3bef55ef84ec4b7c49368fb6f8;p=minix.git is: Convert K&R C -> ANSI C Aditionally this removes all trailing whitespaces using: sed -i 's/[[:space:]]*$//' *.c Change-Id: I274fccee9ec320e474ac26fbe19f3bd50bec271a --- diff --git a/minix/servers/is/dmp.c b/minix/servers/is/dmp.c index 64e08b99e..487f97e6e 100644 --- a/minix/servers/is/dmp.c +++ b/minix/servers/is/dmp.c @@ -1,7 +1,7 @@ -/* This file contains information dump procedures. During the initialization +/* This file contains information dump procedures. During the initialization * of the Information Service 'known' function keys are registered at the TTY - * server in order to receive a notification if one is pressed. Here, the - * corresponding dump procedure is called. + * server in order to receive a notification if one is pressed. Here, the + * corresponding dump procedure is called. * * The entry points into this file are * map_unmap_fkeys: register or unregister function key maps with TTY @@ -42,8 +42,8 @@ struct hook_entry { /*===========================================================================* * map_unmap_keys * *===========================================================================*/ -void map_unmap_fkeys(map) -int map; +void +map_unmap_fkeys(int map) { int fkeys, sfkeys; int h, s; @@ -51,7 +51,7 @@ int map; fkeys = sfkeys = 0; for (h = 0; h < NHOOKS; h++) { - if (hooks[h].key >= F1 && hooks[h].key <= F12) + if (hooks[h].key >= F1 && hooks[h].key <= F12) bit_set(fkeys, hooks[h].key - F1 + 1); else if (hooks[h].key >= SF1 && hooks[h].key <= SF12) bit_set(sfkeys, hooks[h].key - SF1 + 1); diff --git a/minix/servers/is/dmp_ds.c b/minix/servers/is/dmp_ds.c index 795c52317..9f7b0e6db 100644 --- a/minix/servers/is/dmp_ds.c +++ b/minix/servers/is/dmp_ds.c @@ -5,7 +5,8 @@ static struct data_store noxfer_ds_store[NR_DS_KEYS]; -void data_store_dmp() +void +data_store_dmp(void) { struct data_store *p; static int prev_i = 0; diff --git a/minix/servers/is/dmp_fs.c b/minix/servers/is/dmp_fs.c index 5a9ad8fb3..0ed191736 100644 --- a/minix/servers/is/dmp_fs.c +++ b/minix/servers/is/dmp_fs.c @@ -1,8 +1,8 @@ /* This file contains procedures to dump to FS' data structures. * * The entry points into this file are - * dtab_dump: display device <-> driver mappings - * fproc_dump: display FS process table + * dtab_dump: display device <-> driver mappings + * fproc_dump: display FS process table * * Created: * Oct 01, 2004: by Jorrit N. Herder @@ -21,7 +21,8 @@ struct dmap dmap[NR_DEVICES]; /*===========================================================================* * fproc_dmp * *===========================================================================*/ -void fproc_dmp() +void +fproc_dmp(void) { struct fproc *fp; int i, j, nfds, n=0; @@ -61,7 +62,8 @@ void fproc_dmp() /*===========================================================================* * dtab_dmp * *===========================================================================*/ -void dtab_dmp() +void +dtab_dmp(void) { int i; @@ -69,7 +71,7 @@ void dtab_dmp() printf("Error obtaining table from VFS. Perhaps recompile IS?\n"); return; } - + printf("File System (FS) device <-> driver mappings\n"); printf(" Label Major Driver ept\n"); printf("------------- ----- ----------\n"); diff --git a/minix/servers/is/dmp_kernel.c b/minix/servers/is/dmp_kernel.c index ac35aea6d..3b0002de4 100644 --- a/minix/servers/is/dmp_kernel.c +++ b/minix/servers/is/dmp_kernel.c @@ -48,7 +48,7 @@ static char *s_traps_str(int flags); static char *s_flags_str(int flags); static char *p_rts_flags_str(int flags); -/* Some global data that is shared among several dumping procedures. +/* Some global data that is shared among several dumping procedures. * Note that the process table copy has the same name as in the kernel * so that most macros and definitions from proc.h also apply here. */ @@ -59,7 +59,8 @@ struct boot_image image[NR_BOOT_PROCS]; /*===========================================================================* * kmessages_dmp * *===========================================================================*/ -void kmessages_dmp() +void +kmessages_dmp(void) { struct kmessages *kmess; /* get copy of kernel messages */ static char print_buf[_KMESS_BUF_SIZE+1]; /* this one is used to print */ @@ -82,14 +83,15 @@ void kmessages_dmp() size--; } print_buf[r] = 0; /* make sure it terminates */ - printf("Dump of all messages generated by the kernel.\n\n"); + printf("Dump of all messages generated by the kernel.\n\n"); printf("%s", print_buf); /* print the messages */ } /*===========================================================================* * monparams_dmp * *===========================================================================*/ -void monparams_dmp() +void +monparams_dmp(void) { char val[MULTIBOOT_PARAM_BUF_SIZE]; char *e; @@ -106,7 +108,7 @@ void monparams_dmp() do { e += strlen(e); *e++ = '\n'; - } while (*e != 0); + } while (*e != 0); /* Finally, print the result. */ printf("Dump of kernel environment strings set by boot monitor.\n"); @@ -116,7 +118,8 @@ void monparams_dmp() /*===========================================================================* * irqtab_dmp * *===========================================================================*/ -void irqtab_dmp() +void +irqtab_dmp(void) { int i,r; struct irq_hook irq_hooks[NR_IRQ_HOOKS]; @@ -148,8 +151,8 @@ void irqtab_dmp() printf(" \n"); continue; } - printf("%10d ", e->proc_nr_e); - printf(" (%02d) ", e->irq); + printf("%10d ", e->proc_nr_e); + printf(" (%02d) ", e->irq); printf(" %s", (e->policy & IRQ_REENABLE) ? "reenable" : " - "); printf(" %4lu", e->notify_id); if (irq_actids[e->irq] & e->id) @@ -162,18 +165,19 @@ void irqtab_dmp() /*===========================================================================* * image_dmp * *===========================================================================*/ -void image_dmp() +void +image_dmp(void) { int m, r; struct boot_image *ip; - + if ((r = sys_getimage(image)) != OK) { printf("IS: warning: couldn't get copy of image table: %d\n", r); return; } printf("Image table dump showing all processes included in system image.\n"); printf("---name- -nr- flags -stack-\n"); - for (m=0; mproc_name, ip->proc_nr); } @@ -184,7 +188,8 @@ void image_dmp() /*===========================================================================* * kenv_dmp * *===========================================================================*/ -void kenv_dmp() +void +kenv_dmp(void) { struct kinfo kinfo; struct machine machine; @@ -200,10 +205,10 @@ void kenv_dmp() printf("Dump of kinfo structure.\n\n"); printf("Kernel info structure:\n"); - printf("- nr_procs: %3u\n", kinfo.nr_procs); - printf("- nr_tasks: %3u\n", kinfo.nr_tasks); - printf("- release: %.6s\n", kinfo.release); - printf("- version: %.6s\n", kinfo.version); + printf("- nr_procs: %3u\n", kinfo.nr_procs); + printf("- nr_tasks: %3u\n", kinfo.nr_tasks); + printf("- release: %.6s\n", kinfo.release); + printf("- version: %.6s\n", kinfo.version); printf("\n"); } @@ -244,7 +249,8 @@ static char *s_traps_str(int flags) /*===========================================================================* * privileges_dmp * *===========================================================================*/ -void privileges_dmp() +void +privileges_dmp(void) { register struct proc *rp; static struct proc *oldrp = BEG_PROC_ADDR; @@ -266,7 +272,7 @@ void privileges_dmp() PROCLOOP(rp, oldrp) r = -1; - for (sp = &priv[0]; sp < &priv[NR_SYS_PROCS]; sp++) + for (sp = &priv[0]; sp < &priv[NR_SYS_PROCS]; sp++) if (sp->s_proc_nr == rp->p_nr) { r ++; break; } if (r == -1 && !isemptyp(rp)) { sp = &priv[USER_PRIV_ID]; @@ -349,7 +355,8 @@ void proctab_dmp(void) /*===========================================================================* * procstack_dmp * *===========================================================================*/ -void procstack_dmp() +void +procstack_dmp(void) { /* Proc table dump, with stack */ @@ -375,8 +382,8 @@ void procstack_dmp() /*===========================================================================* * proc_name * *===========================================================================*/ -static char *proc_name(proc_nr) -int proc_nr; +static char * +proc_name(int proc_nr) { struct proc *p; if (proc_nr == ANY) return "ANY"; diff --git a/minix/servers/is/dmp_pm.c b/minix/servers/is/dmp_pm.c index a2c9d15fb..ae852b5e1 100644 --- a/minix/servers/is/dmp_pm.c +++ b/minix/servers/is/dmp_pm.c @@ -1,7 +1,7 @@ /* This file contains procedures to dump to PM' data structures. * * The entry points into this file are - * mproc_dmp: display PM process table + * mproc_dmp: display PM process table * * Created: * May 11, 2005: by Jorrit N. Herder @@ -10,8 +10,8 @@ #include "inc.h" #include "../pm/mproc.h" #include -#include -#include +#include +#include struct mproc mproc[NR_PROCS]; @@ -37,7 +37,8 @@ static char *flags_str(int flags) return str; } -void mproc_dmp() +void +mproc_dmp(void) { struct mproc *mp; int i, n=0; @@ -54,12 +55,12 @@ void mproc_dmp() mp = &mproc[i]; if (mp->mp_pid == 0 && i != PM_PROC_NR) continue; if (++n > 22) break; - printf("%8.8s %4d%4d%4d %5d %5d %5d ", + printf("%8.8s %4d%4d%4d %5d %5d %5d ", mp->mp_name, i, mp->mp_parent, mp->mp_tracer, mp->mp_pid, mproc[mp->mp_parent].mp_pid, mp->mp_procgrp); printf("%2d(%2d) %2d(%2d) ", mp->mp_realuid, mp->mp_effuid, mp->mp_realgid, mp->mp_effgid); - printf(" %3d %s ", - mp->mp_nice, flags_str(mp->mp_flags)); + printf(" %3d %s ", + mp->mp_nice, flags_str(mp->mp_flags)); printf("\n"); } if (i >= NR_PROCS) i = 0; @@ -70,7 +71,8 @@ void mproc_dmp() /*===========================================================================* * sigaction_dmp * *===========================================================================*/ -void sigaction_dmp() +void +sigaction_dmp(void) { struct mproc *mp; int i, n=0; diff --git a/minix/servers/is/dmp_rs.c b/minix/servers/is/dmp_rs.c index 1562590d7..091cccdbd 100644 --- a/minix/servers/is/dmp_rs.c +++ b/minix/servers/is/dmp_rs.c @@ -1,7 +1,7 @@ /* This file contains procedures to dump RS data structures. * * The entry points into this file are - * rproc_dump: display RS system process table + * rproc_dump: display RS system process table * * Created: * Oct 03, 2005: by Jorrit N. Herder @@ -22,7 +22,8 @@ static char *s_flags_str(int flags, int sys_flags); /*===========================================================================* * rproc_dmp * *===========================================================================*/ -void rproc_dmp() +void +rproc_dmp(void) { struct rproc *rp; struct rprocpub *rpub; diff --git a/minix/servers/is/dmp_vm.c b/minix/servers/is/dmp_vm.c index c94459935..bbfbbc8a7 100644 --- a/minix/servers/is/dmp_vm.c +++ b/minix/servers/is/dmp_vm.c @@ -17,7 +17,7 @@ static void print_region(struct vm_region_info *vri, int *n) /* part of a contiguous identical run? */ is_repeat = vri && - vri_prev_set && + vri_prev_set && vri->vri_prot == vri_prev.vri_prot && vri->vri_flags == vri_prev.vri_flags && vri->vri_length == vri_prev.vri_length && @@ -51,7 +51,8 @@ static void print_region(struct vm_region_info *vri, int *n) (*n)++; } -void vm_dmp() +void +vm_dmp(void) { static struct proc proc[NR_TASKS + NR_PROCS]; static struct vm_region_info vri[LINES]; diff --git a/minix/servers/is/main.c b/minix/servers/is/main.c index 759a4822d..d917b1fc5 100644 --- a/minix/servers/is/main.c +++ b/minix/servers/is/main.c @@ -1,8 +1,8 @@ -/* System Information Service. +/* System Information Service. * This service handles the various debugging dumps, such as the process - * table, so that these no longer directly touch kernel memory. Instead, the - * system task is asked to copy some table in local memory. - * + * table, so that these no longer directly touch kernel memory. Instead, the + * system task is asked to copy some table in local memory. + * * Created: * Apr 29, 2004 by Jorrit N. Herder */ @@ -30,18 +30,18 @@ static void sef_cb_signal_handler(int signo); *===========================================================================*/ int main(int argc, char **argv) { -/* This is the main routine of this service. The main loop consists of +/* This is the main routine of this service. The main loop consists of * three major activities: getting new work, processing the work, and * sending the reply. The loop never terminates, unless a panic occurs. */ - int result; + int result; /* SEF local startup. */ env_setargs(argc, argv); sef_local_startup(); - /* Main loop - get work and do it, forever. */ - while (TRUE) { + /* Main loop - get work and do it, forever. */ + while (TRUE) { /* Wait for incoming message, sets 'callnr' and 'who'. */ get_work(); @@ -73,7 +73,8 @@ int main(int argc, char **argv) /*===========================================================================* * sef_local_startup * *===========================================================================*/ -static void sef_local_startup() +static void +sef_local_startup(void) { /* Register init callbacks. */ sef_setcb_init_fresh(sef_cb_init_fresh); @@ -117,7 +118,8 @@ static void sef_cb_signal_handler(int signo) /*===========================================================================* * get_work * *===========================================================================*/ -static void get_work() +static void +get_work(void) { int status = 0; status = sef_receive(ANY, &m_in); /* this blocks until message arrives */ @@ -130,9 +132,11 @@ static void get_work() /*===========================================================================* * reply * *===========================================================================*/ -static void reply(who, result) -int who; /* destination */ -int result; /* report result to replyee */ +static void +reply( + int who, /* destination */ + int result /* report result to replyee */ +) { int send_status; m_out.m_type = result; /* build reply message */