浏览代码

spacing/indentation changes for my preference

tsdedhar 6 年之前
父节点
当前提交
f18d7fd9f1
共有 2 个文件被更改,包括 20 次插入19 次删除
  1. 9 6
      kern/arch/mips/syscall/syscall.c
  2. 11 13
      kern/syscall/proc_syscalls.c

+ 9 - 6
kern/arch/mips/syscall/syscall.c

@@ -1,4 +1,4 @@
-/*
+http://git.tareef.tech/tarfeef101/cs350/src/master/kern/include/syscall.h/*
  * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
  * Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2008, 2009
  *	The President and Fellows of Harvard College.
  *	The President and Fellows of Harvard College.
  *
  *
@@ -76,7 +76,7 @@
  * registerized values, with copyin().
  * registerized values, with copyin().
  */
  */
 void
 void
-syscall(struct trapframe *tf)
+syscall(struct trapframe * tf)
 {
 {
 	int callno;
 	int callno;
 	int32_t retval;
 	int32_t retval;
@@ -93,13 +93,14 @@ syscall(struct trapframe *tf)
 	 * really return a value, just 0 for success and -1 on
 	 * really return a value, just 0 for success and -1 on
 	 * error. Since retval is the value returned on success,
 	 * error. Since retval is the value returned on success,
 	 * initialize it to 0 by default; thus it's not necessary to
 	 * initialize it to 0 by default; thus it's not necessary to
-	 * deal with it except for calls that return other values, 
+	 * deal with it except for calls that return other values,
 	 * like write.
 	 * like write.
 	 */
 	 */
 
 
 	retval = 0;
 	retval = 0;
 
 
-	switch (callno) {
+	switch (callno)
+	{
 	    case SYS_reboot:
 	    case SYS_reboot:
 		err = sys_reboot(tf->tf_a0);
 		err = sys_reboot(tf->tf_a0);
 		break;
 		break;
@@ -140,7 +141,8 @@ syscall(struct trapframe *tf)
 	}
 	}
 
 
 
 
-	if (err) {
+	if (err)
+	{
 		/*
 		/*
 		 * Return the error code. This gets converted at
 		 * Return the error code. This gets converted at
 		 * userlevel to a return value of -1 and the error
 		 * userlevel to a return value of -1 and the error
@@ -149,7 +151,8 @@ syscall(struct trapframe *tf)
 		tf->tf_v0 = err;
 		tf->tf_v0 = err;
 		tf->tf_a3 = 1;      /* signal an error */
 		tf->tf_a3 = 1;      /* signal an error */
 	}
 	}
-	else {
+	else
+	{
 		/* Success. */
 		/* Success. */
 		tf->tf_v0 = retval;
 		tf->tf_v0 = retval;
 		tf->tf_a3 = 0;      /* signal no error */
 		tf->tf_a3 = 0;      /* signal no error */

+ 11 - 13
kern/syscall/proc_syscalls.c

@@ -13,10 +13,11 @@
   /* this implementation of sys__exit does not do anything with the exit code */
   /* this implementation of sys__exit does not do anything with the exit code */
   /* this needs to be fixed to get exit() and waitpid() working properly */
   /* this needs to be fixed to get exit() and waitpid() working properly */
 
 
-void sys__exit(int exitcode) {
+void sys__exit(int exitcode)
+{
 
 
-  struct addrspace *as;
-  struct proc *p = curproc;
+  struct addrspace * as;
+  struct proc * p = curproc;
   /* for now, just include this to keep the compiler from complaining about
   /* for now, just include this to keep the compiler from complaining about
      an unused variable */
      an unused variable */
   (void)exitcode;
   (void)exitcode;
@@ -50,8 +51,7 @@ void sys__exit(int exitcode) {
 
 
 
 
 /* stub handler for getpid() system call                */
 /* stub handler for getpid() system call                */
-int
-sys_getpid(pid_t *retval)
+int sys_getpid(pid_t * retval)
 {
 {
   /* for now, this is just a stub that always returns a PID of 1 */
   /* for now, this is just a stub that always returns a PID of 1 */
   /* you need to fix this to make it work properly */
   /* you need to fix this to make it work properly */
@@ -61,31 +61,29 @@ sys_getpid(pid_t *retval)
 
 
 /* stub handler for waitpid() system call                */
 /* stub handler for waitpid() system call                */
 
 
-int
-sys_waitpid(pid_t pid,
-	    userptr_t status,
-	    int options,
-	    pid_t *retval)
+int sys_waitpid(pid_t pid, userptr_t status, int options, pid_t *retval)
 {
 {
   int exitstatus;
   int exitstatus;
   int result;
   int result;
 
 
   /* this is just a stub implementation that always reports an
   /* this is just a stub implementation that always reports an
      exit status of 0, regardless of the actual exit status of
      exit status of 0, regardless of the actual exit status of
-     the specified process.   
+     the specified process.
      In fact, this will return 0 even if the specified process
      In fact, this will return 0 even if the specified process
      is still running, and even if it never existed in the first place.
      is still running, and even if it never existed in the first place.
 
 
      Fix this!
      Fix this!
   */
   */
 
 
-  if (options != 0) {
+  if (options != 0)
+  {
     return(EINVAL);
     return(EINVAL);
   }
   }
   /* for now, just pretend the exitstatus is 0 */
   /* for now, just pretend the exitstatus is 0 */
   exitstatus = 0;
   exitstatus = 0;
   result = copyout((void *)&exitstatus,status,sizeof(int));
   result = copyout((void *)&exitstatus,status,sizeof(int));
-  if (result) {
+  if (result)
+  {
     return(result);
     return(result);
   }
   }
   *retval = pid;
   *retval = pid;