소스 검색

Filled main.rs

themultiplexer 8 년 전
부모
커밋
7d5881ad52
2개의 변경된 파일34개의 추가작업 그리고 0개의 파일을 삭제
  1. 7
    0
      hw5/task1/src/child/mod.rs
  2. 27
    0
      hw5/task1/src/main.rs

+ 7
- 0
hw5/task1/src/child/mod.rs 파일 보기

@@ -0,0 +1,7 @@
1
+
2
+
3
+
4
+pub fn run_childs(start_pid: i32, arg: &str) -> Result<(), String> {
5
+    let count = arg.parse::<u32>();
6
+    match count { }
7
+}

+ 27
- 0
hw5/task1/src/main.rs 파일 보기

@@ -0,0 +1,27 @@
1
+extern crate procinfo;
2
+
3
+use std::env::args;
4
+
5
+mod zombie;
6
+mod child;
7
+
8
+
9
+fn main() {
10
+    let arguments:Vec<String> = args().collect();
11
+
12
+    if arguments.len() == 2 {
13
+
14
+
15
+        match procinfo::pid::stat_self(){
16
+            Ok(stat) => {
17
+                child::run_childs(stat.pid, &arguments[2]);
18
+            },
19
+            Err(_) => {},
20
+        }
21
+
22
+
23
+    } else {
24
+        zombie::run_zombie();
25
+    }
26
+
27
+}

Loading…
취소
저장