3 char *cmd
[]={"getpid", "ps", "chname", "kmode", "switch", "wait", "die",
4 "fork", "exec", "color", 0};
8 printf("************************* Menu *****************************\n");
9 printf("* ps chname kmode switch wait die fork exec color *\n");
10 /* 1 2 3 4 5 6 7 8 9 */
11 printf("************************************************************\n");
14 int find_cmd(name
) char *name
;
19 if (strcmp(p
, name
)==0)
29 return syscall(0,0,0);
40 printf("\ninput new name : ");
47 printf("kmode : enter Kmode via INT 80\n");
48 printf("proc %d going K mode ....\n", getpid());
50 printf("proc %d back from Kernel\n", getpid());
55 printf("proc %d enter Kernel to switch proc\n", getpid());
57 printf("proc %d back from Kernel\n", getpid());
63 printf("proc %d enter Kernel to wait for a child to die\n", getpid());
64 child
= syscall(5, &exitValue
, 0);
65 printf("proc %d back from wait, dead child=%d", getpid(), child
);
67 printf("exitValue=%d", exitValue
);
74 printf("\nenter an exitValue (0-9) : ");
75 exitValue
=getc() - '0';
76 printf("enter kernel to die with exitValue=%d\n");
77 syscall(6,exitValue
,0);
88 child
= syscall(7,0,0,0);
90 printf("parent % return form fork, child=%d\n", getpid(), child
);
92 printf("child %d return from fork, child=%d\n", getpid(), child
);
99 printf("\nenter exec filename : ");
101 r
= syscall(8,filename
,0,0);
102 printf("exec failed\n");
108 printf("\ninput color [r|g|c|y] ; ");
115 return syscall(10, c
, 0, 0);
118 int invalid(name
) char *name
;
120 printf("Invalid command : %s\n", name
);