[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Lost] [Patch 1/3] kernel2: Vaterprozesse



+ kernel2: Vaterprozess eines Prozesses speichern
Index: trunk/src/kernel2/include/tasks.h
===================================================================
--- trunk.orig/src/kernel2/include/tasks.h
+++ trunk/src/kernel2/include/tasks.h
@@ -46,10 +46,13 @@
 #define PM_STATUS_BLOCKED 1
 #define PM_STATUS_RUNNING 2
 
-typedef struct {
+typedef struct pm_process {
     /// Die eindeutige Prozessnummer
     pid_t pid;
 
+    /// Elternprozess
+    struct pm_process* parent;
+
     /// Der Kontext fuer die Speicherverwaltung
     mmc_context_t context;
 
@@ -107,7 +110,7 @@ typedef struct {
 void pm_init();
 
 /// Prozess erstellen
-pm_process_t* pm_create(char* cmdline);
+pm_process_t* pm_create(pm_process_t* parent, const char* cmdline);
 
 /// Prozess zerstoeren
 void pm_destroy(pm_process_t* process);
Index: trunk/src/kernel2/src/tasks/modules.c
===================================================================
--- trunk.orig/src/kernel2/src/tasks/modules.c
+++ trunk/src/kernel2/src/tasks/modules.c
@@ -106,7 +106,7 @@ static void load_module(struct multiboot
         multiboot_module_mapped->start, image_size);
 
     //load_module_bin(multiboot_module_mapped, cmdline);
-    init_process = pm_create(cmdline);
+    init_process = pm_create(NULL, cmdline);
     if (loader_load_image(init_process->pid, (vaddr_t) image_start, image_size)
         == FALSE)
     {
Index: trunk/src/kernel2/src/tasks/pm.c
===================================================================
--- trunk.orig/src/kernel2/src/tasks/pm.c
+++ trunk/src/kernel2/src/tasks/pm.c
@@ -84,7 +84,7 @@ static pid_t generate_pid()
  *
  * @return Pointer auf die Prozssstruktur.
  */
-pm_process_t* pm_create(char* cmdline)
+pm_process_t* pm_create(pm_process_t* parent, const char* cmdline)
 {
     pm_process_t* process = malloc(sizeof(pm_process_t));
     if (process == NULL) {
@@ -94,6 +94,9 @@ pm_process_t* pm_create(char* cmdline)
     // Dem Prozess eine ID zuordnen
     process->pid = generate_pid();
 
+    // Elternprozess zuordnen
+    process->parent = parent;
+
     // Kontext fuer den Prozess erstellen
     process->context = mmc_create();