void fe_set_log_mask(const char* mod, uint32_t mask) { if (! cs_log_get_module_id(mod)) { snprintf(msgbuf, sizeof(msgbuf), "Requested setting FE LogMask for invalid subsystem: %s", mod); vs_log_output_message(msgbuf, FALSE); } else { snprintf(msgbuf, sizeof(msgbuf), "Setting FE %s_LogMask to 0x%x", mod, (unsigned)mask); vs_log_output_message(msgbuf, FALSE); cs_log_set_log_mask(mod, mask, fe_log_masks); fe_init_log_setting(); } }
void fe_set_log_mode(uint32_t log_mode) { snprintf(msgbuf, sizeof(msgbuf), "Setting FE LogMode to %u", (unsigned)log_mode); fe_config.syslog_mode = log_mode; vs_log_output_message(msgbuf, FALSE); cs_log_set_log_masks(fe_config.log_level, fe_config.syslog_mode, fe_log_masks); fe_init_log_setting(); }
/* * vs_init_coredump_settings - setup coredump config for this process * note this changes the current directory */ void vs_init_coredump_settings(const char* mgr, const char* limit, const char *dir) { struct rlimit rlimit; char buf[140]; struct stat statbuf; rlimit.rlim_max = RLIM_SAVED_MAX; if (0 != vs_getCoreDumpLimit(limit, &rlimit.rlim_cur)) { // parser should have already validated, but just to be safe sprintf(buf, "%s: Disabling CoreDumps: Invalid CoreDumpLimit: '%s'", mgr, limit); vs_log_output_message(buf, FALSE); rlimit.rlim_cur = 0; limit = "0"; } else if (rlimit.rlim_cur == 0) { sprintf(buf, "%s: Disabling CoreDumps: CoreDumpLimit: %s", mgr, limit); vs_log_output_message(buf, FALSE); } else if (strlen(dir) == 0 || 0 == strcmp(dir, "/dev/null")) { sprintf(buf, "%s: Disabling CoreDumps: No CoreDumpDir", mgr); vs_log_output_message(buf, FALSE); rlimit.rlim_cur = 0; limit = "0"; } else { if (-1 == stat(dir, &statbuf)) { if (mkdir(dir, 0644) != 0) { sprintf(buf, "%s: Disabling CoreDumps: Unable to create CoreDumpDir: '%s' %m", mgr, dir); vs_log_output_message(buf, FALSE); rlimit.rlim_cur = 0; limit = "0"; } } else if (! S_ISDIR(statbuf.st_mode)) { sprintf(buf, "%s: Disabling CoreDumps: CoreDumpDir is not a directory: '%s'", mgr, dir); vs_log_output_message(buf, FALSE); rlimit.rlim_cur = 0; limit = "0"; } if (0 != chdir(dir)) { sprintf(buf, "%s: Disabling CoreDumps: Unable to cd CoreDumpDir: '%s' %m", mgr, dir); vs_log_output_message(buf, FALSE); rlimit.rlim_cur = 0; limit = "0"; } } if (setrlimit(RLIMIT_CORE, &rlimit) != 0) { sprintf(buf, "%s: Unable to change CoreDumpLimit to '%s' %m", mgr, limit); vs_log_output_message(buf, FALSE); } if (rlimit.rlim_cur) { sprintf(buf, "%s: Enabling CoreDumps to %s up to %s bytes", mgr, dir, limit); vs_log_output_message(buf, FALSE); } }