]> Devi Nivas Git - cs3210-lab0.git/commitdiff
nitpicks
authorrsc <rsc>
Mon, 17 Jul 2006 01:25:22 +0000 (01:25 +0000)
committerrsc <rsc>
Mon, 17 Jul 2006 01:25:22 +0000 (01:25 +0000)
console.c
defs.h
fd.c
kalloc.c
lapic.c
mp.c
proc.c
trap.c
user1.c
userfs.c
usertests.c

index 28ef587d73713d3b44a7fc2c2d861f8caaab6c60..9c15494b0e1384cdbdebebc18f5dc3881907f1dd 100644 (file)
--- a/console.c
+++ b/console.c
@@ -4,7 +4,7 @@
 #include "spinlock.h"
 
 struct spinlock console_lock;
-int paniced = 0;
+int panicked = 0;
 int use_console_lock = 0;
 
 /*
@@ -31,9 +31,9 @@ real_cons_putc(int c)
   unsigned short *crt = (unsigned short *) 0xB8000; // base of CGA memory
   int ind;
 
-  if(paniced){
+  if(panicked){
     cli();
-    while(1)
+    for(;;)
       ;
   }
 
@@ -161,7 +161,7 @@ panic(char *s)
   cprintf("panic: ");
   cprintf(s, 0);
   cprintf("\n", 0);
-  paniced = 1; // freeze other CPU
-  while(1)
+  panicked = 1; // freeze other CPU
+  for(;;)
     ;
 }
diff --git a/defs.h b/defs.h
index 0288a6264bd8b5999380acbe811d3e945f6585ba..00b7f0582abf3ddc4c14f66b9070c3037dc69ef6 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -79,8 +79,8 @@ int pipe_write(struct pipe *p, char *addr, int n);
 int pipe_read(struct pipe *p, char *addr, int n);
 
 // fd.c
-int fd_ualloc();
-struct fd * fd_alloc();
+int fd_ualloc(void);
+struct fd * fd_alloc(void);
 void fd_close(struct fd *);
 int fd_read(struct fd *fd, char *addr, int n);
 int fd_write(struct fd *fd, char *addr, int n);
diff --git a/fd.c b/fd.c
index ce2931b895ba769e9d38dcb2a59044bc8ef6f268..6ce4aec00d68cdb9cb99ace7ffb18f56e68b95c7 100644 (file)
--- a/fd.c
+++ b/fd.c
@@ -15,7 +15,7 @@ struct fd fds[NFD];
  * allocate a file descriptor number for curproc.
  */
 int
-fd_ualloc()
+fd_ualloc(void)
 {
   int fd;
   struct proc *p = curproc[cpu()];
@@ -29,7 +29,7 @@ fd_ualloc()
  * allocate a file descriptor structure
  */
 struct fd *
-fd_alloc()
+fd_alloc(void)
 {
   int i;
 
index 068fd436d0c5ad070cf3239654bf340ef7053483..d016090707cf281c0e0528dedd58e707c3f83fc6 100644 (file)
--- a/kalloc.c
+++ b/kalloc.c
@@ -23,7 +23,7 @@ struct run {
 };
 struct run *freelist;
 
-void ktest();
+void ktest(void);
 
 /*
  * initialize free list of physical pages. this code
diff --git a/lapic.c b/lapic.c
index 3553d6df206192f8f18c57e700488e2320d0776e..5e164be8267feaa8beeee743df04b1335fd1c96d 100644 (file)
--- a/lapic.c
+++ b/lapic.c
@@ -108,7 +108,7 @@ lapic_write(int r, int data)
 
 
 void
-lapic_timerinit()
+lapic_timerinit(void)
 {
   cprintf("%d: init timer\n", cpu());
   lapic_write(LAPIC_TDCR, LAPIC_X1);
@@ -118,7 +118,7 @@ lapic_timerinit()
 }
 
 void
-lapic_timerintr()
+lapic_timerintr(void)
 {
   cprintf("%d: timer interrupt!\n", cpu());
   lapic_write (LAPIC_EOI, 0);
diff --git a/mp.c b/mp.c
index 875bf3fc8e9f6bf229178c5926b7a579725c1c42..8e9eda8618814ca9959f18a6a42daf55acd19a3d 100644 (file)
--- a/mp.c
+++ b/mp.c
@@ -117,7 +117,7 @@ mp_detect(void)
 }
 
 void
-mp_init()
+mp_init(void)
 { 
   int r;
   uint8_t *p, *e;
@@ -193,7 +193,7 @@ mp_bcpu(void)
 extern void mpmain(void);
 
 void
-mp_startthem()
+mp_startthem(void)
 {
   extern uint8_t _binary_bootother_start[], _binary_bootother_size[];
   extern int main();
diff --git a/proc.c b/proc.c
index 4bcd4ab2ccaad6ab9aa41d0fc642f9f6fafa46ff..f0013f1eaa76275b416315bad608861cb0867bc0 100644 (file)
--- a/proc.c
+++ b/proc.c
@@ -311,7 +311,7 @@ proc_kill(int pid)
 // Exited processes remain in the zombie state 
 // until their parent calls wait() to find out they exited.
 void
-proc_exit()
+proc_exit(void)
 {
   struct proc *p;
   struct proc *cp = curproc[cpu()];
diff --git a/trap.c b/trap.c
index 85d8eef0c8aaf064de8208d3cc81343f4231b1a9..c00a830f400700d399b0149cc999ab5346759004 100644 (file)
--- a/trap.c
+++ b/trap.c
 struct Gatedesc idt[256];
 extern unsigned vectors[]; /* vectors.S, array of 256 entry point addresses */
 
-extern void trapenter();
-extern void trapenter1();
+extern void trapenter(void);
+extern void trapenter1(void);
 
 void
-tvinit()
+tvinit(void)
 {
   int i;
 
@@ -25,7 +25,7 @@ tvinit()
 }
 
 void
-idtinit()
+idtinit(void)
 {
   lidt(idt, sizeof idt);
 }
diff --git a/user1.c b/user1.c
index bbe6f5b673abbcea3220db7679b5494258b76478..267320e6f0f684daefff57bbd5b0073d65c85bb5 100644 (file)
--- a/user1.c
+++ b/user1.c
@@ -3,7 +3,7 @@
 char buf[32];
 
 int
-main()
+main(void)
 {
   int pid, fds[2], n;
 
index f7da24b33b11c2851c3075aaf614a65082b1d2b0..5772e1d4f73edc760249f35dfbcf4ef53cb80c4a 100644 (file)
--- a/userfs.c
+++ b/userfs.c
@@ -5,7 +5,7 @@
 char buf[1024];
 
 int
-main()
+main(void)
 {
   puts("userfs running\n");
   block();
index 78b9477751854e5990e7705b9db9c0263bc927cf..370054b8f96faaea23ae9a7954eba7c0c7106286 100644 (file)
@@ -5,7 +5,7 @@ char buf[2048];
 // simple fork and pipe read/write
 
 void
-pipe1()
+pipe1(void)
 {
   int fds[2], pid;
   int seq = 0, i, n, cc, total;
@@ -27,10 +27,7 @@ pipe1()
     close(fds[1]);
     total = 0;
     cc = 1;
-    while(1){
-      n = read(fds[0], buf, cc);
-      if(n < 1)
-        break;
+    while((n = read(fds[0], buf, cc)) > 0){
       for(i = 0; i < n; i++){
         if((buf[i] & 0xff) != (seq++ & 0xff)){
           panic("pipe1 oops 2\n");
@@ -52,19 +49,19 @@ pipe1()
 
 // meant to be run w/ at most two CPUs
 void
-preempt()
+preempt(void)
 {
   int pid1, pid2, pid3;
   int pfds[2];
 
   pid1 = fork();
   if(pid1 == 0)
-    while(1)
+    for(;;)
       ;
     
   pid2 = fork();
   if(pid2 == 0)
-    while(1)
+    for(;;)
       ;
 
   pipe(pfds);
@@ -74,7 +71,7 @@ preempt()
     if(write(pfds[1], "x", 1) != 1)
       panic("preempt write error");
     close(pfds[1]);
-    while(1)
+    for(;;)
       ;
   }
 
@@ -95,7 +92,7 @@ preempt()
 
 // try to find any races between exit and wait
 void
-exitwait()
+exitwait(void)
 {
   int i, pid;
 
@@ -118,7 +115,7 @@ exitwait()
 }
 
 int
-main()
+main(void)
 {
   puts("usertests starting\n");