Serj Kalichev 2 лет назад
Родитель
Сommit
f2e372b6e1
3 измененных файлов с 47 добавлено и 11 удалено
  1. 3 0
      klish/kexec.h
  2. 42 11
      klish/ksession/kexec.c
  3. 2 0
      klish/ktp/ktpd_session.c

+ 3 - 0
klish/kexec.h

@@ -35,6 +35,9 @@ bool_t kexec_contexts_is_empty(const kexec_t *exec);
 kexec_contexts_node_t *kexec_contexts_iter(const kexec_t *exec);
 kcontext_t *kexec_contexts_each(kexec_contexts_node_t **iter);
 
+bool_t kexec_exec(kexec_t *exec);
+
+
 C_DECL_END
 
 #endif // _klish_kexec_h

+ 42 - 11
klish/ksession/kexec.c

@@ -117,19 +117,9 @@ static bool_t exec_action(kcontext_t context,
 }
 
 
-static bool_t exec_action_sequence(kcontext_t *context)
-{
-	faux_list_node_t *iter = NULL;
-	faux_list_t *actions = NULL;
-
-	assert(context);
-	if (!context)
-		return BOOL_FALSE;
+*/
 
-	actions = 
 
-}
-*/
 
 
 static bool_t kexec_prepare(kexec_t *exec)
@@ -193,6 +183,43 @@ static bool_t kexec_prepare(kexec_t *exec)
 }
 
 
+static bool_t exec_action_sequence(kcontext_t *context, pid_t pid)
+{
+	faux_list_node_t *iter = NULL;
+	faux_list_t *actions = NULL;
+
+	assert(context);
+	if (!context)
+		return BOOL_FALSE;
+
+
+printf("CONTEXT\n");
+actions = actions;
+iter = iter;
+pid = pid;
+
+	return BOOL_TRUE;
+}
+
+
+static bool_t exec_command(kexec_t *exec, pid_t pid)
+{
+	faux_list_node_t *iter = NULL;
+	kcontext_t *context = NULL;
+
+	assert(exec);
+	if (!exec)
+		return BOOL_FALSE;
+
+	iter = kexec_contexts_iter(exec);
+	while ((context = kexec_contexts_each(&iter))) {
+		exec_action_sequence(context, pid);
+	}
+
+	return BOOL_TRUE;
+}
+
+
 bool_t kexec_exec(kexec_t *exec)
 {
 	faux_list_node_t *iter = NULL;
@@ -207,6 +234,10 @@ bool_t kexec_exec(kexec_t *exec)
 	if (!kexec_prepare(exec))
 		return BOOL_FALSE;
 
+	// Here no ACTIONs are executing, so pass -1 as pid of terminated
+	// ACTION's process.
+	exec_command(exec, -1);
+
 	iter = faux_list_tail(exec->contexts);
 	while ((context = faux_list_data(iter))) {
 	

+ 2 - 0
klish/ktp/ktpd_session.c

@@ -177,6 +177,8 @@ static bool_t ktpd_session_process_cmd(ktpd_session_t *session, faux_msg_t *msg)
 		return BOOL_FALSE;
 	}
 
+	kexec_exec(exec);
+
 
 //	ktpd_session_exec(session, exec);