- Timestamp:
- Dec 11, 2008, 9:21:09 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sh_processcheck.c
r203 r204 95 95 static time_t sh_prochk_interval = SH_PROCHK_INTERVAL; 96 96 static int sh_prochk_severity = SH_ERR_SEVERE; 97 97 static int sh_prochk_openvz = S_FALSE; 98 98 99 99 static int sh_prochk_set_maxpid (const char * str); … … 105 105 static int sh_prochk_set_interval(const char *str); 106 106 static int sh_prochk_set_severity(const char *str); 107 static int sh_prochk_set_openvz (const char *str); 107 108 108 109 sh_rconf sh_prochk_table[] = { … … 138 139 N_("processcheckinterval"), 139 140 sh_prochk_set_interval, 141 }, 142 { 143 N_("processcheckisopenvz"), 144 sh_prochk_set_openvz, 140 145 }, 141 146 { … … 513 518 514 519 if (!str && ('/' != str[0])) 515 SL_RETURN((-1), _("sh_prochk_set_ps arg"));520 SL_RETURN((-1), _("sh_prochk_set_pspath")); 516 521 if (sh_prochk_pspath) 517 522 SH_FREE(sh_prochk_pspath); … … 548 553 549 554 SL_RETURN((value), _("sh_prochk_set_active")); 555 } 556 557 /* Are we on openvz. 558 */ 559 static int openvz_hidden = 0; 560 561 int sh_prochk_set_openvz(const char *str) 562 { 563 int value; 564 565 SL_ENTER(_("sh_prochk_set_openvz")); 566 567 value = sh_util_flagval(str, &sh_prochk_openvz); 568 569 if (sh_prochk_openvz != S_FALSE) { 570 openvz_hidden = 1; 571 } 572 573 SL_RETURN((value), _("sh_prochk_set_openvz")); 550 574 } 551 575 … … 1065 1089 } 1066 1090 1091 /* Check whether there is a visible process 1092 * with PID = i + 1024 1093 */ 1094 static int openvz_ok(short * res, size_t i) 1095 { 1096 if (sh_prochk_openvz == S_FALSE) { 1097 return 0; 1098 } 1099 1100 i += 1024; 1101 1102 if (i >= sh_prochk_size) { 1103 return 0; 1104 } 1105 1106 if ( ((res[i] & SH_PR_PS) || (res[i] & SH_PR_PS2)) && (res[i] & SH_PR_ANY)) 1107 { 1108 /* This is a system process corresponding to a 'virtual' 1109 * process that has a PID offset by 1024 1110 */ 1111 return 1; 1112 } 1113 1114 if (openvz_hidden) 1115 { 1116 --openvz_hidden; 1117 return 1; 1118 } 1119 1120 return 0; 1121 } 1122 1067 1123 static int sh_process_check_int (short * res) 1068 1124 { … … 1158 1214 * if still there, it is real and hidden 1159 1215 */ 1160 if ( res[j] & SH_PR_ANY)1216 if ((res[j] & SH_PR_ANY) && !openvz_ok(res, j)) 1161 1217 { 1162 1218 if (S_FALSE == is_in_list(&list_hidden, NULL, i)) … … 1352 1408 sh_prochk_minpid = 0x0001; 1353 1409 sh_prochk_interval = SH_PROCHK_INTERVAL; 1410 sh_prochk_openvz = S_FALSE; 1354 1411 1355 1412 sh_prochk_free_list(process_check);
Note:
See TracChangeset
for help on using the changeset viewer.