diff options
author | Ben Burwell <ben@benburwell.com> | 2015-04-01 20:09:02 -0400 |
---|---|---|
committer | Ben Burwell <ben@benburwell.com> | 2015-04-01 20:09:02 -0400 |
commit | e468dc911189e71509012fb0ed228cc765f641fa (patch) | |
tree | 9a6f82214d1d4614640bd8a6b68a5d766d9f4e08 | |
parent | c4ed6736d2e093ea7433328a552d53d3bcaff927 (diff) |
as of 2013-10-072013-10-07
-rw-r--r-- | comhan.c | 3 | ||||
-rw-r--r-- | main.c | 31 | ||||
-rw-r--r-- | pcb.c | 4 |
3 files changed, 19 insertions, 19 deletions
@@ -7,6 +7,7 @@ #include <stdio.h>
#include <string.h>
+#include <stdlib.h>
#include "mpx.h"
#define BUF_SIZE 80 /* Size of the command line buffer. */
@@ -79,7 +80,7 @@ void comhan() { int get_cmd(char cmd[]){
/* return the number associated with a command (use STOP, HELP etc) */
- int i =0 ; //loop control
+ int i = 0; //loop control
if (cmd == NULL) {
return -1;
@@ -12,24 +12,23 @@ pcb * pcb_list; pcb * ready_queue;
pcb * io_init_queue;
-int main(void) {
+pcb pcb0;
+pcb pcb1;
+pcb pcb2;
+pcb pcb3;
+pcb pcb4;
+pcb pcb5;
+pcb pcb6;
+pcb pcb7;
+pcb pcb8;
+pcb pcb9;
+pcb pcb10;
+pcb pcb11;
+int main(void) {
+ printf("Booting MPX... \n");
/* Put initialization code here */
- // allocate memory for PCBs
- pcb pcb0;
- pcb pcb1;
- pcb pcb2;
- pcb pcb3;
- pcb pcb4;
- pcb pcb5;
- pcb pcb6;
- pcb pcb7;
- pcb pcb8;
- pcb pcb9;
- pcb pcb10;
- pcb pcb11;
-
// create the chain
pcb0.chain = &pcb1;
pcb1.chain = &pcb2;
@@ -59,8 +58,6 @@ int main(void) { pcb_list = &pcb0;
- printf("... booting MPX\n\n");
-
comhan(); /* Execute the command handler */
return 0;
@@ -146,7 +146,9 @@ int insert_pcb(pcb **queue, pcb * addr, int method) { current->next = addr;
addr->next = one_after;
addr->prev = current;
- one_after->prev = addr;
+ if (one_after != NULL) {
+ one_after->prev = addr;
+ }
} else {
// otherwise, put it at the head
|