diff options
author | John Estabrook <jestabro@vyos.io> | 2024-02-28 08:26:24 -0600 |
---|---|---|
committer | John Estabrook <jestabro@vyos.io> | 2024-04-26 09:51:56 -0500 |
commit | e3d388fffe8e0cfa37587032bd480592d2ff1905 (patch) | |
tree | 7add7df9eb78a8f0cfdafb90e688c4d83892b12c /src | |
parent | 23b79df8bf766e72b8eb697b4726d843664c46c3 (diff) | |
download | vyatta-cfg-e3d388fffe8e0cfa37587032bd480592d2ff1905.tar.gz vyatta-cfg-e3d388fffe8e0cfa37587032bd480592d2ff1905.zip |
configdep: T5660: add marker for last element of priority queues
(cherry picked from commit 2411564dead4a27d155a13973e8fd4b438546dce)
Diffstat (limited to 'src')
-rw-r--r-- | src/cli_cstore.h | 2 | ||||
-rw-r--r-- | src/cli_objects.c | 11 | ||||
-rw-r--r-- | src/commit/commit-algorithm.cpp | 4 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/cli_cstore.h b/src/cli_cstore.h index b77d69c..3ef7f72 100644 --- a/src/cli_cstore.h +++ b/src/cli_cstore.h @@ -142,6 +142,8 @@ int restore_output(void); /* functions from cli_objects */ char *get_at_string(void); void set_in_commit(boolean b); +void set_if_last(int); +void clear_last(void); void set_at_string(char* s); void set_in_delete_action(boolean b); diff --git a/src/cli_objects.c b/src/cli_objects.c index 190ff46..c09c368 100644 --- a/src/cli_objects.c +++ b/src/cli_objects.c @@ -34,6 +34,7 @@ static first_seg f_seg_m; static char *in_commit_file = "/var/tmp/in_commit"; static char *initial_file = "/var/tmp/initial_in_commit"; +static char *last_in_queue_file = "/var/tmp/last_in_queue"; static int mark_by_file(char *p) { int ret = mknod(p, S_IFREG|0664, 0); @@ -96,6 +97,16 @@ void set_in_commit(boolean b) { } } +void set_if_last(int n) { + if (n == 1) { + mark_by_file(last_in_queue_file); + } +} + +void clear_last(void) { + remove_mark(last_in_queue_file); +} + boolean is_in_exec(void) { return in_exec; } diff --git a/src/commit/commit-algorithm.cpp b/src/commit/commit-algorithm.cpp index f04b8c2..ab7eee6 100644 --- a/src/commit/commit-algorithm.cpp +++ b/src/commit/commit-algorithm.cpp @@ -1306,8 +1306,11 @@ commit::doCommit(Cstore& cs, CfgNode& cfg1, CfgNode& cfg2) debug_on = !!getenv("VYOS_DEBUG"); TRACE_INIT("Processing the Priority Queue"); + clear_last(); + int num = pq.size(); while (!dpq.empty()) { PrioNode *p = dpq.top(); + set_if_last(num+dpq.size()); if (!_commit_exec_prio_subtree(cs, p)) { // prio subtree failed OUTPUT_USER("delete [ %s ] failed\n", @@ -1321,6 +1324,7 @@ commit::doCommit(Cstore& cs, CfgNode& cfg1, CfgNode& cfg2) } while (!pq.empty()) { PrioNode *p = pq.top(); + set_if_last(pq.size()); if (!_commit_exec_prio_subtree(cs, p)) { // prio subtree failed OUTPUT_USER("[[%s]] failed\n", |