"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/process/ProcessTree.c" between
monit-5.27.2.tar.gz and monit-5.28.0.tar.gz

About: Monit is a utility for managing and monitoring processes, files, directories and filesystems (with automatic error recovery).

ProcessTree.c  (monit-5.27.2):ProcessTree.c  (monit-5.28.0)
skipping to change at line 71 skipping to change at line 71
#endif #endif
#ifdef HAVE_COREFOUNDATION_COREFOUNDATION_H #ifdef HAVE_COREFOUNDATION_COREFOUNDATION_H
#include <CoreFoundation/CoreFoundation.h> #include <CoreFoundation/CoreFoundation.h>
#endif #endif
#include "monit.h" #include "monit.h"
#include "event.h" #include "event.h"
#include "ProcessTree.h" #include "ProcessTree.h"
#include "process_sysdep.h" #include "process_sysdep.h"
#include "Box.h" #include "TextBox.h"
#include "Color.h" #include "TextColor.h"
// libmonit // libmonit
#include "system/Time.h" #include "system/Time.h"
/** /**
* General purpose /proc methods. * General purpose /proc methods.
* *
* @file * @file
*/ */
skipping to change at line 396 skipping to change at line 396
regfree(regex_comp); regfree(regex_comp);
FREE(regex_comp); FREE(regex_comp);
printf("Regex %s parsing error: %s\n", pattern, errbuf); printf("Regex %s parsing error: %s\n", pattern, errbuf);
exit(1); exit(1);
} }
ProcessTree_init(ProcessEngine_CollectCommandLine); ProcessTree_init(ProcessEngine_CollectCommandLine);
if (Run.flags & Run_ProcessEngineEnabled) { if (Run.flags & Run_ProcessEngineEnabled) {
int count = 0; int count = 0;
printf("List of processes matching pattern \"%s\":\n", pattern); printf("List of processes matching pattern \"%s\":\n", pattern);
StringBuffer_T output = StringBuffer_create(256); StringBuffer_T output = StringBuffer_create(256);
Box_T t = Box_new(output, 4, (BoxColumn_T []){ TextBox_T t = TextBox_new(output, 4, (TextBoxColumn_T []){
{.name = "", .width = 1, .wrap = false, {.name = "", .width = 1, .wrap = false,
.align = BoxAlign_Left}, .align = TextBoxAlign_Left},
{.name = "PID", .width = 8, .wrap = false, {.name = "PID", .width = 8, .wrap = false,
.align = BoxAlign_Right}, .align = TextBoxAlign_Right},
{.name = "PPID", .width = 8, .wrap = false, {.name = "PPID", .width = 8, .wrap = false,
.align = BoxAlign_Right}, .align = TextBoxAlign_Right},
{.name = "Command", .width = 50, .wrap = true, {.name = "Command", .width = 50, .wrap = true,
.align = BoxAlign_Left} .align = TextBoxAlign_Left}
}, true); }, true);
// Select the process matching the pattern // Select the process matching the pattern
int pid = _match(regex_comp); int pid = _match(regex_comp);
// Print all matching processes and highlight the one which is s elected // Print all matching processes and highlight the one which is s elected
for (int i = 0; i < ptreesize; i++) { for (int i = 0; i < ptreesize; i++) {
if (ptree[i].cmdline && ! strstr(ptree[i].cmdline, "proc match")) { if (ptree[i].cmdline && ! strstr(ptree[i].cmdline, "proc match")) {
if (! regexec(regex_comp, ptree[i].cmdline, 0, N ULL, 0)) { if (! regexec(regex_comp, ptree[i].cmdline, 0, N ULL, 0)) {
if (pid == ptree[i].pid) { if (pid == ptree[i].pid) {
Box_setColumn(t, 1, COLOR_BOLD " TextBox_setColumn(t, 1, COLOR_BO
*" COLOR_RESET); LD "*" COLOR_RESET);
Box_setColumn(t, 2, COLOR_BOLD " TextBox_setColumn(t, 2, COLOR_BO
%d" COLOR_RESET, ptree[i].pid); LD "%d" COLOR_RESET, ptree[i].pid);
Box_setColumn(t, 3, COLOR_BOLD " TextBox_setColumn(t, 3, COLOR_BO
%d" COLOR_RESET, ptree[i].ppid); LD "%d" COLOR_RESET, ptree[i].ppid);
Box_setColumn(t, 4, COLOR_BOLD " TextBox_setColumn(t, 4, COLOR_BO
%s" COLOR_RESET, ptree[i].cmdline); LD "%s" COLOR_RESET, ptree[i].cmdline);
} else { } else {
Box_setColumn(t, 2, "%d", ptree[ TextBox_setColumn(t, 2, "%d", pt
i].pid); ree[i].pid);
Box_setColumn(t, 3, "%d", ptree[ TextBox_setColumn(t, 3, "%d", pt
i].ppid); ree[i].ppid);
Box_setColumn(t, 4, "%s", ptree[ TextBox_setColumn(t, 4, "%s", pt
i].cmdline); ree[i].cmdline);
} }
Box_printRow(t); TextBox_printRow(t);
count++; count++;
} }
} }
} }
Box_free(&t); TextBox_free(&t);
if (Run.flags & Run_Batch || ! Color_support()) if (Run.flags & Run_Batch || ! TextColor_support())
Color_strip(Box_strip((char *)StringBuffer_toString(outp TextColor_strip(TextBox_strip((char *)StringBuffer_toStr
ut))); ing(output)));
printf("%s", StringBuffer_toString(output)); printf("%s", StringBuffer_toString(output));
StringBuffer_free(&output); StringBuffer_free(&output);
printf("Total matches: %d\n", count); printf("Total matches: %d\n", count);
if (count > 1) if (count > 1)
printf("\n" printf("\n"
"WARNING:\n" "WARNING:\n"
"Multiple processes match the pattern. Monit will select the process with the\n" "Multiple processes match the pattern. Monit will select the process with the\n"
"highest uptime, the one highlighted.\n"); "highest uptime, the one highlighted.\n");
} }
regfree(regex_comp); regfree(regex_comp);
 End of changes. 6 change blocks. 
30 lines changed or deleted 30 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)