sys_fs_cgroup.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 CGROUP_OPTIONS_DISABLED_DUPLICATE 0x00000001
  6. #define CGROUP_OPTIONS_SYSTEM_SLICE_SERVICE 0x00000002
  7. #define CGROUP_OPTIONS_IS_UNIFIED 0x00000004
  8. typedef struct netdata_ebpf_cgroup_shm_header {
  9. int cgroup_root_count;
  10. int cgroup_max;
  11. int systemd_enabled;
  12. int __pad;
  13. size_t body_length;
  14. } netdata_ebpf_cgroup_shm_header_t;
  15. #define CGROUP_EBPF_NAME_SHARED_LENGTH 256
  16. typedef struct netdata_ebpf_cgroup_shm_body {
  17. // Considering what is exposed in this link https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits
  18. // this length is enough to store what we want.
  19. char name[CGROUP_EBPF_NAME_SHARED_LENGTH];
  20. uint32_t hash;
  21. uint32_t options;
  22. int enabled;
  23. char path[FILENAME_MAX + 1];
  24. } netdata_ebpf_cgroup_shm_body_t;
  25. typedef struct netdata_ebpf_cgroup_shm {
  26. netdata_ebpf_cgroup_shm_header_t *header;
  27. netdata_ebpf_cgroup_shm_body_t *body;
  28. } netdata_ebpf_cgroup_shm_t;
  29. #define NETDATA_SHARED_MEMORY_EBPF_CGROUP_NAME "netdata_shm_cgroup_ebpf"
  30. #define NETDATA_NAMED_SEMAPHORE_EBPF_CGROUP_NAME "/netdata_sem_cgroup_ebpf"
  31. #include "../proc.plugin/plugin_proc.h"
  32. char *cgroup_parse_resolved_name_and_labels(RRDLABELS *labels, char *data);
  33. #endif //NETDATA_SYS_FS_CGROUP_H