Lines Matching full:if
27 if (fd < 0) in touch_anon()
33 if (ret < 0) { in touch_anon()
34 if (errno != EINTR) { in touch_anon()
56 if (buf == MAP_FAILED) in alloc_and_touch_anon_noexit()
59 if (touch_anon((char *)buf, size)) { in alloc_and_touch_anon_noexit()
87 if (!cg_test) in test_cgcore_destroy()
91 if (cg_create(cg_test)) in test_cgcore_destroy()
97 if (child_pid < 0) in test_cgcore_destroy()
101 if (cg_wait_for_proc_count(cg_test, 1)) in test_cgcore_destroy()
104 if (cg_killall(cg_test)) in test_cgcore_destroy()
109 if (cg_read(cg_test, "cgroup.procs", buf, sizeof(buf))) in test_cgcore_destroy()
111 if (buf[0] == '\0') in test_cgcore_destroy()
116 if (rmdir(cg_test)) in test_cgcore_destroy()
119 if (waitpid(child_pid, NULL, 0) < 0) in test_cgcore_destroy()
124 if (cg_test) in test_cgcore_destroy()
154 if (!cg_test_a || !cg_test_b || !cg_test_c || !cg_test_d) in test_cgcore_populated()
157 if (cg_create(cg_test_a)) in test_cgcore_populated()
160 if (cg_create(cg_test_b)) in test_cgcore_populated()
163 if (cg_create(cg_test_c)) in test_cgcore_populated()
166 if (cg_create(cg_test_d)) in test_cgcore_populated()
169 if (cg_enter_current(cg_test_c)) in test_cgcore_populated()
172 if (cg_read_strcmp(cg_test_a, "cgroup.events", "populated 1\n")) in test_cgcore_populated()
175 if (cg_read_strcmp(cg_test_b, "cgroup.events", "populated 1\n")) in test_cgcore_populated()
178 if (cg_read_strcmp(cg_test_c, "cgroup.events", "populated 1\n")) in test_cgcore_populated()
181 if (cg_read_strcmp(cg_test_d, "cgroup.events", "populated 0\n")) in test_cgcore_populated()
184 if (cg_enter_current(root)) in test_cgcore_populated()
187 if (cg_read_strcmp(cg_test_a, "cgroup.events", "populated 0\n")) in test_cgcore_populated()
190 if (cg_read_strcmp(cg_test_b, "cgroup.events", "populated 0\n")) in test_cgcore_populated()
193 if (cg_read_strcmp(cg_test_c, "cgroup.events", "populated 0\n")) in test_cgcore_populated()
196 if (cg_read_strcmp(cg_test_d, "cgroup.events", "populated 0\n")) in test_cgcore_populated()
201 if (cgroup_fd < 0) in test_cgcore_populated()
205 if (pid < 0) { in test_cgcore_populated()
206 if (errno == ENOSYS) in test_cgcore_populated()
211 if (pid == 0) { in test_cgcore_populated()
212 if (raise(SIGSTOP)) in test_cgcore_populated()
223 if (err) in test_cgcore_populated()
226 if (cg_read_strcmp(cg_test_d, "cgroup.events", "populated 0\n")) in test_cgcore_populated()
230 if (cg_test_d) { in test_cgcore_populated()
237 if (pid < 0) in test_cgcore_populated()
239 if (pid == 0) in test_cgcore_populated()
248 if (cg_test_d) in test_cgcore_populated()
250 if (cg_test_c) in test_cgcore_populated()
252 if (cg_test_b) in test_cgcore_populated()
254 if (cg_test_a) in test_cgcore_populated()
260 if (cgroup_fd >= 0) in test_cgcore_populated()
281 if (!parent || !child || !grandparent) in test_cgcore_invalid_domain()
284 if (cg_create(grandparent)) in test_cgcore_invalid_domain()
287 if (cg_create(parent)) in test_cgcore_invalid_domain()
290 if (cg_create(child)) in test_cgcore_invalid_domain()
293 if (cg_write(parent, "cgroup.type", "threaded")) in test_cgcore_invalid_domain()
296 if (cg_read_strcmp(child, "cgroup.type", "domain invalid\n")) in test_cgcore_invalid_domain()
299 if (!cg_enter_current(child)) in test_cgcore_invalid_domain()
302 if (errno != EOPNOTSUPP) in test_cgcore_invalid_domain()
305 if (!clone_into_cgroup_run_wait(child)) in test_cgcore_invalid_domain()
308 if (errno == ENOSYS) in test_cgcore_invalid_domain()
311 if (errno != EOPNOTSUPP) in test_cgcore_invalid_domain()
319 if (child) in test_cgcore_invalid_domain()
321 if (parent) in test_cgcore_invalid_domain()
323 if (grandparent) in test_cgcore_invalid_domain()
342 if (!parent || !child) in test_cgcore_parent_becomes_threaded()
345 if (cg_create(parent)) in test_cgcore_parent_becomes_threaded()
348 if (cg_create(child)) in test_cgcore_parent_becomes_threaded()
351 if (cg_write(child, "cgroup.type", "threaded")) in test_cgcore_parent_becomes_threaded()
354 if (cg_read_strcmp(parent, "cgroup.type", "domain threaded\n")) in test_cgcore_parent_becomes_threaded()
360 if (child) in test_cgcore_parent_becomes_threaded()
362 if (parent) in test_cgcore_parent_becomes_threaded()
379 if (cg_read_strstr(root, "cgroup.controllers", "cpu") || in test_cgcore_no_internal_process_constraint_on_threads()
387 if (!parent || !child) in test_cgcore_no_internal_process_constraint_on_threads()
390 if (cg_create(parent)) in test_cgcore_no_internal_process_constraint_on_threads()
393 if (cg_create(child)) in test_cgcore_no_internal_process_constraint_on_threads()
396 if (cg_write(parent, "cgroup.type", "threaded")) in test_cgcore_no_internal_process_constraint_on_threads()
399 if (cg_write(child, "cgroup.type", "threaded")) in test_cgcore_no_internal_process_constraint_on_threads()
402 if (cg_write(parent, "cgroup.subtree_control", "+cpu")) in test_cgcore_no_internal_process_constraint_on_threads()
405 if (cg_enter_current(parent)) in test_cgcore_no_internal_process_constraint_on_threads()
413 if (child) in test_cgcore_no_internal_process_constraint_on_threads()
415 if (parent) in test_cgcore_no_internal_process_constraint_on_threads()
423 * Test that you can't enable a controller on a child if it's not enabled
433 if (!parent || !child) in test_cgcore_top_down_constraint_enable()
436 if (cg_create(parent)) in test_cgcore_top_down_constraint_enable()
439 if (cg_create(child)) in test_cgcore_top_down_constraint_enable()
442 if (!cg_write(child, "cgroup.subtree_control", "+memory")) in test_cgcore_top_down_constraint_enable()
448 if (child) in test_cgcore_top_down_constraint_enable()
450 if (parent) in test_cgcore_top_down_constraint_enable()
459 * if it's enabled in a child.
468 if (!parent || !child) in test_cgcore_top_down_constraint_disable()
471 if (cg_create(parent)) in test_cgcore_top_down_constraint_disable()
474 if (cg_create(child)) in test_cgcore_top_down_constraint_disable()
477 if (cg_write(parent, "cgroup.subtree_control", "+memory")) in test_cgcore_top_down_constraint_disable()
480 if (cg_write(child, "cgroup.subtree_control", "+memory")) in test_cgcore_top_down_constraint_disable()
483 if (!cg_write(parent, "cgroup.subtree_control", "-memory")) in test_cgcore_top_down_constraint_disable()
489 if (child) in test_cgcore_top_down_constraint_disable()
491 if (parent) in test_cgcore_top_down_constraint_disable()
500 * You can't add a pid to a domain parent if a controller is enabled.
509 if (!parent || !child) in test_cgcore_internal_process_constraint()
512 if (cg_create(parent)) in test_cgcore_internal_process_constraint()
515 if (cg_create(child)) in test_cgcore_internal_process_constraint()
518 if (cg_write(parent, "cgroup.subtree_control", "+memory")) in test_cgcore_internal_process_constraint()
521 if (!cg_enter_current(parent)) in test_cgcore_internal_process_constraint()
524 if (!clone_into_cgroup_run_wait(parent)) in test_cgcore_internal_process_constraint()
530 if (child) in test_cgcore_internal_process_constraint()
532 if (parent) in test_cgcore_internal_process_constraint()
557 if (!src || !dst) in test_cgcore_proc_migration()
560 if (cg_create(src)) in test_cgcore_proc_migration()
562 if (cg_create(dst)) in test_cgcore_proc_migration()
565 if (cg_enter_current(src)) in test_cgcore_proc_migration()
569 if (pthread_create(&threads[c_threads], NULL, dummy_thread_fn, NULL)) in test_cgcore_proc_migration()
574 if (cg_read_lc(dst, "cgroup.threads") != n_threads + 1) in test_cgcore_proc_migration()
590 if (dst) in test_cgcore_proc_migration()
592 if (src) in test_cgcore_proc_migration()
611 if (proc_read_strstr(0, 1, "cgroup", lines[(i % 2) + 1])) in migrating_thread_fn()
633 if (!grps[1] || !grps[2] || !dom) in test_cgcore_thread_migration()
636 if (cg_create(dom)) in test_cgcore_thread_migration()
638 if (cg_create(grps[1])) in test_cgcore_thread_migration()
640 if (cg_create(grps[2])) in test_cgcore_thread_migration()
643 if (cg_write(grps[1], "cgroup.type", "threaded")) in test_cgcore_thread_migration()
645 if (cg_write(grps[2], "cgroup.type", "threaded")) in test_cgcore_thread_migration()
648 if (cg_enter_current(grps[1])) in test_cgcore_thread_migration()
651 if (pthread_create(&thr, NULL, migrating_thread_fn, grps)) in test_cgcore_thread_migration()
654 if (pthread_join(thr, &retval)) in test_cgcore_thread_migration()
657 if (retval) in test_cgcore_thread_migration()
661 if (proc_read_strstr(0, 1, "cgroup", line)) in test_cgcore_thread_migration()
668 if (grps[2]) in test_cgcore_thread_migration()
670 if (grps[1]) in test_cgcore_thread_migration()
672 if (dom) in test_cgcore_thread_migration()
696 if (!cg_test_a || !cg_test_b) in test_cgcore_lesser_euid_open()
702 if (!cg_test_a_procs || !cg_test_b_procs) in test_cgcore_lesser_euid_open()
705 if (cg_create(cg_test_a) || cg_create(cg_test_b)) in test_cgcore_lesser_euid_open()
708 if (cg_enter_current(cg_test_a)) in test_cgcore_lesser_euid_open()
711 if (chown(cg_test_a_procs, test_euid, -1) || in test_cgcore_lesser_euid_open()
716 if (seteuid(test_euid)) in test_cgcore_lesser_euid_open()
721 if (seteuid(saved_uid)) in test_cgcore_lesser_euid_open()
724 if (cg_test_b_procs_fd < 0) in test_cgcore_lesser_euid_open()
727 if (write(cg_test_b_procs_fd, "0", 1) >= 0 || errno != EACCES) in test_cgcore_lesser_euid_open()
734 if (cg_test_b_procs_fd >= 0) in test_cgcore_lesser_euid_open()
736 if (cg_test_b) in test_cgcore_lesser_euid_open()
738 if (cg_test_a) in test_cgcore_lesser_euid_open()
781 if (!cg_test_a || !cg_test_b) in test_cgcore_lesser_ns_open()
787 if (!cg_test_a_procs || !cg_test_b_procs) in test_cgcore_lesser_ns_open()
790 if (cg_create(cg_test_a) || cg_create(cg_test_b)) in test_cgcore_lesser_ns_open()
793 if (cg_enter_current(cg_test_b)) in test_cgcore_lesser_ns_open()
796 if (chown(cg_test_a_procs, test_euid, -1) || in test_cgcore_lesser_ns_open()
804 if (pid < 0) in test_cgcore_lesser_ns_open()
807 if (waitpid(pid, &status, 0) < 0) in test_cgcore_lesser_ns_open()
810 if (!WIFEXITED(status)) in test_cgcore_lesser_ns_open()
814 if (cg_test_b_procs_fd < 0) in test_cgcore_lesser_ns_open()
817 if (cg_enter_current(cg_test_a)) in test_cgcore_lesser_ns_open()
820 if ((status = write(cg_test_b_procs_fd, "0", 1)) >= 0 || errno != ENOENT) in test_cgcore_lesser_ns_open()
827 if (cg_test_b_procs_fd >= 0) in test_cgcore_lesser_ns_open()
829 if (cg_test_b) in test_cgcore_lesser_ns_open()
831 if (cg_test_a) in test_cgcore_lesser_ns_open()
865 if (cg_find_unified_root(root, sizeof(root))) in main()
868 if (cg_read_strstr(root, "cgroup.subtree_control", "memory")) in main()
869 if (cg_write(root, "cgroup.subtree_control", "+memory")) in main()