File tree 2 files changed +17
-0
lines changed
tools/testing/selftests/bpf
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -689,3 +689,19 @@ int get_cgroup1_hierarchy_id(const char *subsys_name)
689
689
fclose (file );
690
690
return found ? id : -1 ;
691
691
}
692
+
693
+ /**
694
+ * open_classid() - Open a cgroupv1 net_cls classid
695
+ *
696
+ * This function expects the cgroup work dir to be already created, as we
697
+ * open it here.
698
+ *
699
+ * On success, it returns the file descriptor. On failure it returns -1.
700
+ */
701
+ int open_classid (void )
702
+ {
703
+ char cgroup_workdir [PATH_MAX + 1 ];
704
+
705
+ format_classid_path (cgroup_workdir );
706
+ return open (cgroup_workdir , O_RDONLY );
707
+ }
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ void cleanup_cgroup_environment(void);
33
33
int set_classid (void );
34
34
int join_classid (void );
35
35
unsigned long long get_classid_cgroup_id (void );
36
+ int open_classid (void );
36
37
37
38
int setup_classid_environment (void );
38
39
void cleanup_classid_environment (void );
You can’t perform that action at this time.
0 commit comments