void check_cgroup_file(const char *fname) {
	assert(fname);
	invalid_filename(fname, 0); // no globbing

	if (!is_cgroup_path(fname))
		goto errout;

	const char *base = gnu_basename(fname);
	if (strcmp(base, "tasks") != 0 &&  // cgroup v1
	    strcmp(base, "cgroup.procs") != 0)
		goto errout;

	if (access(fname, W_OK) == 0)
		return;

errout:
	fprintf(stderr, "Error: invalid cgroup\n");
	exit(1);
}
void check_cgroup_file(const char *fname) {
	assert(fname);
	invalid_filename(fname, 0);  

	if (!is_cgroup_path(fname))
		goto errout;

	const char *base = gnu_basename(fname);
	if (strcmp(base, "tasks") != 0 &&   
	    strcmp(base, "cgroup.procs") != 0)
		goto errout;

	if (access(fname, W_OK) == 0)
		return;

errout:
	fprintf(stderr, "Error: invalid cgroup\n");
	exit(1);
}