Browse Source

Final clean-up. Final Comments.

themultiplexer 8 years ago
parent
commit
e41417cdba
3 changed files with 4 additions and 9 deletions
  1. 1
    1
      hw4/task1/Cargo.toml
  2. 1
    5
      hw4/task1/src/main.rs
  3. 2
    3
      hw4/task1/src/pstree.rs

+ 1
- 1
hw4/task1/Cargo.toml View File

5
 
5
 
6
 [dependencies]
6
 [dependencies]
7
 procinfo = "^0.4.2"
7
 procinfo = "^0.4.2"
8
-libc = "^0.2"
8
+libc = "^0.2"

+ 1
- 5
hw4/task1/src/main.rs View File

9
 mod unit_test_pstree;
9
 mod unit_test_pstree;
10
 mod unit_test_readproc;
10
 mod unit_test_readproc;
11
 
11
 
12
+/// Mainfunction
12
 fn main() {
13
 fn main() {
13
 
14
 
14
     let args:Vec<String> = env::args().collect();
15
     let args:Vec<String> = env::args().collect();
76
             process::exit(1);
77
             process::exit(1);
77
         }
78
         }
78
     }
79
     }
79
-
80
-
81
-
82
-
83
-
84
 }
80
 }

+ 2
- 3
hw4/task1/src/pstree.rs View File

21
         }
21
         }
22
     }
22
     }
23
 
23
 
24
+    /// Erstellt eine Prozess-Datenstruktur aus procinfo::Stat.
24
     pub fn me() -> Self {
25
     pub fn me() -> Self {
25
         if let Ok(my_pid) = pid::stat_self() {
26
         if let Ok(my_pid) = pid::stat_self() {
26
             Process::new(my_pid.pid)
27
             Process::new(my_pid.pid)
67
     }
68
     }
68
 }
69
 }
69
 
70
 
70
-/// Erstellt einen 'Process' aus der übergebenen PID und gibt die Prozesskette
71
+/// Geht von eigenem Prozess aus und gibt die Prozesskette bis zum übergebenem PID aus
71
 /// und fängt mögliche Fehler ab.
72
 /// und fängt mögliche Fehler ab.
72
-///
73
 pub fn print(pid:pid_t) -> bool {
73
 pub fn print(pid:pid_t) -> bool {
74
 
74
 
75
     if let Err(_) = pid::stat(pid) {
75
     if let Err(_) = pid::stat(pid) {
77
         return false
77
         return false
78
     }
78
     }
79
 
79
 
80
-
81
     let my_proc = Process::me();
80
     let my_proc = Process::me();
82
 
81
 
83
     if !my_proc.has_parent_with_pid(pid) {
82
     if !my_proc.has_parent_with_pid(pid) {

Loading…
Cancel
Save