struct stat sb;
if (lstat(path, &sb) == -1) {
- WARNING("Failed stat check for file: %s", path);
+ WARNING("ras plugin: Failed stat check for file: %s", path);
return false;
}
if (S_ISREG(sb.st_mode) == 0) {
- WARNING("Not a regular file: %s", path);
+ WARNING("ras plugin: Not a regular file: %s", path);
return false;
}
// checking unsigned long long int overflow
static void safe_incremented_counter(unsigned long long *value) {
if (*value == ULLONG_MAX) {
- WARNING("The counter can't be incremented");
+ WARNING("ras plugin: The counter can't be incremented");
return;
}
*value += 1;
// checking and validating a string when trying to convert it to an long int
static bool convert_to_number(char *text, long int *number) {
if (text == NULL) {
- WARNING("Error when trying to read a numeric value. NULL value");
+ WARNING(
+ "ras plugin: Error when trying to read a numeric value. NULL value");
return false;
}
*number = strtol(text, NULL, 10);
if (sizeof(text) == sizeof(char *) && text[0] == '0') {
return true;
} else {
- WARNING("Number is not an integer. Data read: %s", text);
+ WARNING("ras plugin: Number is not an integer. Data read: %s", text);
return false;
}
}
if (*number < 0) {
- WARNING("Number can't be negative. Data read: %s", text);
+ WARNING("ras plugin: Number can't be negative. Data read: %s", text);
return false;
}
if (errno == ERANGE) {
- WARNING("Number can't be greater than LONG_MAX. Data read: %s", text);
+ WARNING("ras plugin: Number can't be greater than LONG_MAX. Data read: %s",
+ text);
return false;
}
return true;
if (strcasecmp("DB_Path", key) == 0) {
sstrncpy(path_database, value, sizeof(path_database));
} else {
- DEBUG("DB_Path not provided in config. Using default: %s", DEFAULT_DB_PATH);
+ DEBUG("ras plugin: DB_Path not provided in config. Using default: %s",
+ DEFAULT_DB_PATH);
}
return 0;
} /* int ras_config */
if (cpu <= nprocs) {
classify_entries(cpu, argv[2], argv[3]);
} else {
- WARNING("CPU number can't be greater than the total number of CPU. CPU: "
+ WARNING("ras plugin: CPU number can't be greater than the total number "
+ "of CPU. CPU: "
"%ld",
cpu);
- WARNING("Can't read data id %s, cpu %s, error_msg %s, mcistatus_msg %s",
+ WARNING("ras plugin: Can't read data id %s, cpu %s, error_msg %s, "
+ "mcistatus_msg %s",
argv[0], argv[1], argv[2], argv[3]);
}
} else {
- WARNING("Can't read data id %s, cpu %s, error_msg %s, mcistatus_msg %s",
+ WARNING("ras plugin: Can't read data id %s, cpu %s, error_msg %s, "
+ "mcistatus_msg %s",
argv[0], argv[1], argv[2], argv[3]);
}
for (int i = 0; i < nprocs; i++) {
cx = snprintf(plugin_inst, PLUGIN_INST_SIZE * sizeof(char), "CPU_%d", i);
if (cx < 0 || cx >= PLUGIN_INST_SIZE * sizeof(char)) {
- ERROR("Error encountered during plugin's instance name creation");
+ ERROR("ras plugin: Error encountered during plugin's instance name "
+ "creation");
return;
}
max_id);
if (cx < 0 || cx >= SQL_QUERY_BUFFER_SIZE * sizeof(char)) {
- ERROR("Error encountered during SQL query creation");
+ ERROR("ras plugin: Error encountered during SQL query creation");
return -1;
}
rc = sqlite3_exec(db, sql_query, callback, 0, &err_msg);
if (rc != 0) {
- DEBUG("SQL error: %s\n", err_msg);
+ DEBUG("ras plugin: SQL error: %s\n", err_msg);
sqlite3_free(err_msg);
return -1;
}
static int ras_init(void) {
int rc;
if (!check_path_correct(path_database)) {
- ERROR("Incorrect path to Database: %s", path_database);
+ ERROR("ras plugin: Incorrect path to Database: %s", path_database);
return -1;
}
rc = sqlite3_open_v2(path_database, &db, SQLITE_OPEN_READONLY, NULL);
if (rc) {
- ERROR("Can't open database: %s", sqlite3_errmsg(db));
+ ERROR("ras plugin: Can't open database: %s", sqlite3_errmsg(db));
return -1;
} else {
- INFO("Database opened successfully");
+ INFO("ras plugin: Database opened successfully");
}
long n = sysconf(_SC_NPROCESSORS_CONF);
ras_metrics_server.per_CPU = (struct ras_metrics_per_CPU *)calloc(
nprocs, sizeof(struct ras_metrics_per_CPU));
if (ras_metrics_server.per_CPU == NULL) {
- ERROR("Fail allocated memory");
+ ERROR("ras plugin: Fail allocated memory");
return ENOMEM;
}
return 0;