forked from yhzhang0128/egos-2000
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sys_proc.c
31 lines (24 loc) · 691 Bytes
/
sys_proc.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
* (C) 2022, Cornell University
* All rights reserved.
*/
/* Author: Yunhao Zhang
* Description: spawn and kill processes
*/
#include "app.h"
#include <string.h>
/* same as the struct pcb_intf in grass/process.h */
struct pcb_intf {
int (*proc_alloc)();
void (*proc_free)(int);
void (*proc_set_ready)(int);
} pcb;
int main(struct pcb_intf* _pcb) {
SUCCESS("Enter kernel process GPID_PROCESS");
memcpy(&pcb, _pcb, sizeof(struct pcb_intf));
int file_pid = pcb.proc_alloc();
if (file_pid != GPID_FILE)
FATAL("Process ID mismatch: %d != %d", file_pid, GPID_FILE);
INFO("Load kernel process #%d: file server", file_pid);
while (1);
}