Lines Matching refs:pid
294 int pid = strtol(ptr, &ptr, 10); in cg_killall() local
296 if (pid == 0) in cg_killall()
302 if (kill(pid, SIGKILL)) in cg_killall()
329 int cg_enter(const char *cgroup, int pid) in cg_enter() argument
333 snprintf(pidbuf, sizeof(pidbuf), "%d", pid); in cg_enter()
351 int pid, retcode; in cg_run() local
353 pid = fork(); in cg_run()
354 if (pid < 0) { in cg_run()
355 return pid; in cg_run()
356 } else if (pid == 0) { in cg_run()
364 waitpid(pid, &retcode, 0); in cg_run()
375 pid_t pid; in clone_into_cgroup() local
383 pid = sys_clone3(&args, sizeof(struct __clone_args)); in clone_into_cgroup()
389 if (pid < 0 && (errno == ENOSYS || errno == E2BIG)) in clone_into_cgroup()
392 return pid; in clone_into_cgroup()
400 int clone_reap(pid_t pid, int options) in clone_reap() argument
408 ret = waitid(P_PID, pid, &info, options | __WALL | __WNOTHREAD); in clone_reap()
450 pid_t pid; in clone_into_cgroup_run_nowait() local
456 pid = clone_into_cgroup(cgroup_fd); in clone_into_cgroup_run_nowait()
458 if (pid == 0) in clone_into_cgroup_run_nowait()
461 return pid; in clone_into_cgroup_run_nowait()
468 int pid; in cg_run_nowait() local
470 pid = clone_into_cgroup_run_nowait(cgroup, fn, arg); in cg_run_nowait()
471 if (pid > 0) in cg_run_nowait()
472 return pid; in cg_run_nowait()
475 if (pid < 0 && errno != ENOSYS) in cg_run_nowait()
478 pid = fork(); in cg_run_nowait()
479 if (pid == 0) { in cg_run_nowait()
488 return pid; in cg_run_nowait()
548 int set_oom_adj_score(int pid, int score) in set_oom_adj_score() argument
553 sprintf(path, "/proc/%d/oom_score_adj", pid); in set_oom_adj_score()
581 ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t size) in proc_read_text() argument
586 if (!pid) in proc_read_text()
590 snprintf(path, sizeof(path), "/proc/%d/%s", pid, item); in proc_read_text()
596 int proc_read_strstr(int pid, bool thread, const char *item, const char *needle) in proc_read_strstr() argument
600 if (proc_read_text(pid, thread, item, buf, sizeof(buf)) < 0) in proc_read_strstr()
609 pid_t pid; in clone_into_cgroup_run_wait() local
615 pid = clone_into_cgroup(cgroup_fd); in clone_into_cgroup_run_wait()
617 if (pid < 0) in clone_into_cgroup_run_wait()
620 if (pid == 0) in clone_into_cgroup_run_wait()
627 (void)clone_reap(pid, WEXITED); in clone_into_cgroup_run_wait()