MCPcopy Create free account
hub / github.com/chyyuu/os_kernel_lab / main

Function main

user/src/bin/forktest_simple.rs:10–28  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8
9#[no_mangle]
10pub fn main() -> i32 {
11 assert_eq!(wait(&mut 0i32), -1);
12 println!("sys_wait without child process test passed!");
13 println!("parent start, pid = {}!", getpid());
14 let pid = fork();
15 if pid == 0 {
16 // child process
17 println!("hello child process!");
18 100
19 } else {
20 // parent process
21 let mut exit_code: i32 = 0;
22 println!("ready waiting on parent process!");
23 assert_eq!(pid, wait(&mut exit_code));
24 assert_eq!(exit_code, 100);
25 println!("child process pid = {}, exit code = {}", pid, exit_code);
26 0
27 }
28}

Callers

nothing calls this directly

Calls 1

forkFunction · 0.85

Tested by

no test coverage detected