sys_fs_cgroup.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // SPDX-License-Identifier: GPL-3.0-or-later
  2. #ifndef NETDATA_SYS_FS_CGROUP_H
  3. #define NETDATA_SYS_FS_CGROUP_H 1
  4. #include "daemon/common.h"
  5. #define PLUGIN_CGROUPS_NAME "cgroups.plugin"
  6. #define PLUGIN_CGROUPS_MODULE_SYSTEMD_NAME "systemd"
  7. #define PLUGIN_CGROUPS_MODULE_CGROUPS_NAME "/sys/fs/cgroup"
  8. #define CGROUP_OPTIONS_DISABLED_DUPLICATE 0x00000001
  9. #define CGROUP_OPTIONS_SYSTEM_SLICE_SERVICE 0x00000002
  10. #define CGROUP_OPTIONS_IS_UNIFIED 0x00000004
  11. typedef struct netdata_ebpf_cgroup_shm_header {
  12. int cgroup_root_count;
  13. int cgroup_max;
  14. int systemd_enabled;
  15. int __pad;
  16. size_t body_length;
  17. } netdata_ebpf_cgroup_shm_header_t;
  18. #define CGROUP_EBPF_NAME_SHARED_LENGTH 256
  19. typedef struct netdata_ebpf_cgroup_shm_body {
  20. // Considering what is exposed in this link https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits
  21. // this length is enough to store what we want.
  22. char name[CGROUP_EBPF_NAME_SHARED_LENGTH];
  23. uint32_t hash;
  24. uint32_t options;
  25. int enabled;
  26. char path[FILENAME_MAX + 1];
  27. } netdata_ebpf_cgroup_shm_body_t;
  28. typedef struct netdata_ebpf_cgroup_shm {
  29. netdata_ebpf_cgroup_shm_header_t *header;
  30. netdata_ebpf_cgroup_shm_body_t *body;
  31. } netdata_ebpf_cgroup_shm_t;
  32. #define NETDATA_SHARED_MEMORY_EBPF_CGROUP_NAME "netdata_shm_cgroup_ebpf"
  33. #define NETDATA_NAMED_SEMAPHORE_EBPF_CGROUP_NAME "/netdata_sem_cgroup_ebpf"
  34. #include "../proc.plugin/plugin_proc.h"
  35. char *cgroup_parse_resolved_name_and_labels(RRDLABELS *labels, char *data);
  36. #endif //NETDATA_SYS_FS_CGROUP_H