Lines Matching refs:pid
272 int pid = strtol(ptr, &ptr, 10); in cg_killall() local
274 if (pid == 0) in cg_killall()
280 if (kill(pid, SIGKILL)) in cg_killall()
307 int cg_enter(const char *cgroup, int pid) in cg_enter() argument
311 snprintf(pidbuf, sizeof(pidbuf), "%d", pid); in cg_enter()
329 int pid, retcode; in cg_run() local
331 pid = fork(); in cg_run()
332 if (pid < 0) { in cg_run()
333 return pid; in cg_run()
334 } else if (pid == 0) { in cg_run()
342 waitpid(pid, &retcode, 0); in cg_run()
353 pid_t pid; in clone_into_cgroup() local
361 pid = sys_clone3(&args, sizeof(struct __clone_args)); in clone_into_cgroup()
367 if (pid < 0 && (errno == ENOSYS || errno == E2BIG)) in clone_into_cgroup()
370 return pid; in clone_into_cgroup()
378 int clone_reap(pid_t pid, int options) in clone_reap() argument
386 ret = waitid(P_PID, pid, &info, options | __WALL | __WNOTHREAD); in clone_reap()
428 pid_t pid; in clone_into_cgroup_run_nowait() local
434 pid = clone_into_cgroup(cgroup_fd); in clone_into_cgroup_run_nowait()
436 if (pid == 0) in clone_into_cgroup_run_nowait()
439 return pid; in clone_into_cgroup_run_nowait()
446 int pid; in cg_run_nowait() local
448 pid = clone_into_cgroup_run_nowait(cgroup, fn, arg); in cg_run_nowait()
449 if (pid > 0) in cg_run_nowait()
450 return pid; in cg_run_nowait()
453 if (pid < 0 && errno != ENOSYS) in cg_run_nowait()
456 pid = fork(); in cg_run_nowait()
457 if (pid == 0) { in cg_run_nowait()
466 return pid; in cg_run_nowait()
526 int set_oom_adj_score(int pid, int score) in set_oom_adj_score() argument
531 sprintf(path, "/proc/%d/oom_score_adj", pid); in set_oom_adj_score()
559 ssize_t proc_read_text(int pid, bool thread, const char *item, char *buf, size_t size) in proc_read_text() argument
564 if (!pid) in proc_read_text()
568 snprintf(path, sizeof(path), "/proc/%d/%s", pid, item); in proc_read_text()
574 int proc_read_strstr(int pid, bool thread, const char *item, const char *needle) in proc_read_strstr() argument
578 if (proc_read_text(pid, thread, item, buf, sizeof(buf)) < 0) in proc_read_strstr()
587 pid_t pid; in clone_into_cgroup_run_wait() local
593 pid = clone_into_cgroup(cgroup_fd); in clone_into_cgroup_run_wait()
595 if (pid < 0) in clone_into_cgroup_run_wait()
598 if (pid == 0) in clone_into_cgroup_run_wait()
605 (void)clone_reap(pid, WEXITED); in clone_into_cgroup_run_wait()