Remove unecessary error report for proc and sys files (#12385)
thiagoftsm committed
Mar 14, 2022 at 14:29 UTC
3e20d9f9217a153affd0450c72543c19ba67bf18
3 files changed
+5
-2
collectors/ebpf.plugin/ebpf_apps.c
+1
-1
@@ -275,7 +275,7 @@ int ebpf_read_apps_groups_conf(struct target **agdt, struct target **agrt, const
275
276
// ----------------------------------------
277
278
- procfile *ff = procfile_open(filename, " :\t", PROCFILE_FLAG_DEFAULT);
278
+ procfile *ff = procfile_open_no_log(filename, " :\t", PROCFILE_FLAG_DEFAULT);
279
if (!ff)
280
return -1;
281
collectors/ebpf.plugin/ebpf_cgroup.c
+1
-1
@@ -242,7 +242,7 @@ static ebpf_cgroup_target_t * ebpf_cgroup_find_or_create(netdata_ebpf_cgroup_shm
242
*/
243
static void ebpf_update_pid_link_list(ebpf_cgroup_target_t *ect, char *path)
244
{
245
- procfile *ff = procfile_open(path, " \t:", PROCFILE_FLAG_DEFAULT);
245
+ procfile *ff = procfile_open_no_log(path, " \t:", PROCFILE_FLAG_DEFAULT);
246
if (!ff)
247
return;
248
libnetdata/procfile/procfile.h
+3
@@ -103,4 +103,7 @@ extern int procfile_adaptive_initial_allocation;
103
// return the Nth word of the current line
104
#define procfile_lineword(ff, line, word) (((line) < procfile_lines(ff) && (word) < procfile_linewords((ff), (line))) ? procfile_word((ff), (ff)->lines->lines[(line)].first + (word)) : "")
105
106
+// Open file without logging file IO error if any
107
+#define procfile_open_no_log(filename, separators, flags) procfile_open(filename, separators, flags | PROCFILE_FLAG_NO_ERROR_ON_FILE_IO)
108
+
109
#endif /* NETDATA_PROCFILE_H */