Home
last modified time | relevance | path

Searched refs:pid (Results 1 – 25 of 200) sorted by relevance

12345678

/systemd-251/src/basic/
Dprocess-util.c56 static int get_process_state(pid_t pid) { in get_process_state() argument
62 assert(pid >= 0); in get_process_state()
65 if (pid == 0 || pid == getpid_cached()) in get_process_state()
68 p = procfs_file_alloca(pid, "stat"); in get_process_state()
88 int get_process_comm(pid_t pid, char **ret) { in get_process_comm() argument
93 assert(pid >= 0); in get_process_comm()
95 if (pid == 0 || pid == getpid_cached()) { in get_process_comm()
105 p = procfs_file_alloca(pid, "comm"); in get_process_comm()
127 pid_t pid, in get_process_cmdline_nulstr() argument
149 p = procfs_file_alloca(pid, "cmdline"); in get_process_cmdline_nulstr()
[all …]
Dprocess-util.h19 #define procfs_file_alloca(pid, field) \ argument
21 pid_t _pid_ = (pid); \
41 int get_process_comm(pid_t pid, char **ret);
42 int get_process_cmdline(pid_t pid, size_t max_columns, ProcessCmdlineFlags flags, char **ret);
43 int get_process_exe(pid_t pid, char **ret);
44 int get_process_uid(pid_t pid, uid_t *ret);
45 int get_process_gid(pid_t pid, gid_t *ret);
46 int get_process_capeff(pid_t pid, char **ret);
47 int get_process_cwd(pid_t pid, char **ret);
48 int get_process_root(pid_t pid, char **ret);
[all …]
Dnamespace-util.c18 int namespace_open(pid_t pid, int *pidns_fd, int *mntns_fd, int *netns_fd, int *userns_fd, int *roo… in namespace_open() argument
22 assert(pid >= 0); in namespace_open()
27 mntns = procfs_file_alloca(pid, "ns/mnt"); in namespace_open()
36 pidns = procfs_file_alloca(pid, "ns/pid"); in namespace_open()
45 netns = procfs_file_alloca(pid, "ns/net"); in namespace_open()
54 userns = procfs_file_alloca(pid, "ns/user"); in namespace_open()
63 root = procfs_file_alloca(pid, "root"); in namespace_open()
186 _cleanup_(sigkill_waitp) pid_t pid = 0; in userns_acquire()
197 r = safe_fork("(sd-mkuserns)", FORK_CLOSE_ALL_FDS|FORK_DEATHSIG|FORK_NEW_USERNS, &pid); in userns_acquire()
204 xsprintf(path, "/proc/" PID_FMT "/uid_map", pid); in userns_acquire()
[all …]
Dcgroup-util.h192 typedef int (*cg_kill_log_func_t)(pid_t pid, int sig, void *userdata);
204 int cg_pid_get_path(const char *controller, pid_t pid, char **path);
269 int cg_pid_get_path_shifted(pid_t pid, const char *cached_root, char **cgroup);
271 int cg_pid_get_session(pid_t pid, char **session);
272 int cg_pid_get_owner_uid(pid_t pid, uid_t *uid);
273 int cg_pid_get_unit(pid_t pid, char **unit);
274 int cg_pid_get_user_unit(pid_t pid, char **unit);
275 int cg_pid_get_machine_name(pid_t pid, char **machine);
276 int cg_pid_get_slice(pid_t pid, char **slice);
277 int cg_pid_get_user_slice(pid_t pid, char **slice);
/systemd-251/src/rpm/
Dtriggers.systemd.in16 pid = posix.fork()
17 if pid == 0 then
19 elseif pid > 0 then
20 posix.wait(pid)
24 pid = posix.fork()
25 if pid == 0 then
27 elseif pid > 0 then
28 posix.wait(pid)
37 pid = posix.fork()
38 if pid == 0 then
[all …]
/systemd-251/src/test/
Dtest-process-util.c40 static void test_get_process_comm_one(pid_t pid) { in test_get_process_comm_one() argument
53 xsprintf(path, "/proc/"PID_FMT"/comm", pid); in test_get_process_comm_one()
56 assert_se(get_process_comm(pid, &a) >= 0); in test_get_process_comm_one()
57 log_info("PID"PID_FMT" comm: '%s'", pid, a); in test_get_process_comm_one()
61 assert_se(get_process_cmdline(pid, 0, PROCESS_CMDLINE_COMM_FALLBACK, &c) >= 0); in test_get_process_comm_one()
62 log_info("PID"PID_FMT" cmdline: '%s'", pid, c); in test_get_process_comm_one()
64 assert_se(get_process_cmdline(pid, 8, 0, &d) >= 0); in test_get_process_comm_one()
65 log_info("PID"PID_FMT" cmdline truncated to 8: '%s'", pid, d); in test_get_process_comm_one()
68 assert_se(get_process_cmdline(pid, 1, 0, &d) >= 0); in test_get_process_comm_one()
69 log_info("PID"PID_FMT" cmdline truncated to 1: '%s'", pid, d); in test_get_process_comm_one()
[all …]
Dtest-seccomp.c174 pid_t pid; in TEST() local
193 pid = fork(); in TEST()
194 assert_se(pid >= 0); in TEST()
196 if (pid == 0) { /* Child? */ in TEST()
221 …assert_se(wait_for_terminate_and_check(syscall_filter_sets[i].name, pid, WAIT_LOG) == EXIT_SUCCESS… in TEST()
261 pid_t pid; in TEST() local
304 pid = fork(); in TEST()
305 assert_se(pid >= 0); in TEST()
307 if (pid == 0) { in TEST()
335 pid = raw_clone(CLONE_NEWNS); in TEST()
[all …]
Dtest-mount-util.c143 pid_t pid; in TEST() local
145 pid = fork(); in TEST()
146 assert_se(pid >= 0); in TEST()
148 if (pid == 0) { in TEST()
178 … assert_se(wait_for_terminate_and_check("test-remount-rec", pid, WAIT_LOG) == EXIT_SUCCESS); in TEST()
183 pid_t pid; in TEST() local
190 pid = fork(); in TEST()
191 assert_se(pid >= 0); in TEST()
193 if (pid == 0) { in TEST()
211 assert_se(wait_for_terminate_and_check("test-remount-one", pid, WAIT_LOG) == EXIT_SUCCESS); in TEST()
Dtest-cgroup-util.c177 pid_t pid; in TEST() local
183 r = parse_pid(de->d_name, &pid); in TEST()
187 if (is_kernel_thread(pid)) in TEST()
190 cg_pid_get_path(SYSTEMD_CGROUP_CONTROLLER, pid, &path); in TEST()
191 cg_pid_get_path_shifted(pid, NULL, &path_shifted); in TEST()
192 cg_pid_get_owner_uid(pid, &uid); in TEST()
193 cg_pid_get_session(pid, &session); in TEST()
194 cg_pid_get_unit(pid, &unit); in TEST()
195 cg_pid_get_user_unit(pid, &user_unit); in TEST()
196 cg_pid_get_machine_name(pid, &machine); in TEST()
[all …]
/systemd-251/src/shared/
Dkillall.c25 static bool ignore_proc(pid_t pid, bool warn_rootfs) { in ignore_proc() argument
33 if (pid <= 1) in ignore_proc()
37 r = is_kernel_thread(pid); in ignore_proc()
41 r = get_process_uid(pid, &uid); in ignore_proc()
49 p = procfs_file_alloca(pid, "cmdline"); in ignore_proc()
66 pid_from_same_root_fs(pid) == 0) { in ignore_proc()
70 (void) get_process_comm(pid, &comm); in ignore_proc()
75 "system instead.", pid, strna(comm)); in ignore_proc()
130 pid_t pid; in wait_for_children() local
132 pid = waitpid(-1, NULL, WNOHANG); in wait_for_children()
[all …]
Dcgroup-setup.c313 int cg_create_and_attach(const char *controller, const char *path, pid_t pid) { in cg_create_and_attach() argument
316 assert(pid >= 0); in cg_create_and_attach()
322 q = cg_attach(controller, path, pid); in cg_create_and_attach()
330 int cg_attach(const char *controller, const char *path, pid_t pid) { in cg_attach() argument
336 assert(pid >= 0); in cg_attach()
342 if (pid == 0) in cg_attach()
343 pid = getpid_cached(); in cg_attach()
345 xsprintf(c, PID_FMT "\n", pid); in cg_attach()
359 r = cg_attach(SYSTEMD_CGROUP_CONTROLLER_LEGACY, path, pid); in cg_attach()
361 … log_warning_errno(r, "Failed to attach "PID_FMT" to compat systemd cgroup %s: %m", pid, path); in cg_attach()
[all …]
/systemd-251/src/core/
Dcrash-handler.c42 pid_t pid; in crash() local
64 pid = raw_clone(SIGCHLD); in crash()
65 if (pid < 0) in crash()
67 else if (pid == 0) { in crash()
82 pid = raw_getpid(); in crash()
83 (void) kill(pid, sig); /* raise() would kill the parent */ in crash()
101 r = wait_for_terminate(pid, &status); in crash()
111 pid, in crash()
116 signal_to_string(sig), pid); in crash()
135 pid = raw_clone(SIGCHLD); in crash()
[all …]
Dservice.c157 static int service_set_main_pid(Service *s, pid_t pid) { in service_set_main_pid() argument
160 if (pid <= 1) in service_set_main_pid()
163 if (pid == getpid_cached()) in service_set_main_pid()
166 if (s->main_pid == pid && s->main_pid_known) in service_set_main_pid()
169 if (s->main_pid != pid) { in service_set_main_pid()
171 exec_status_start(&s->main_exec_status, pid); in service_set_main_pid()
174 s->main_pid = pid; in service_set_main_pid()
176 s->main_pid_alien = pid_is_my_child(pid) == 0; in service_set_main_pid()
179 …ising process "PID_FMT" which is not our child. We'll most likely not notice when it exits.", pid); in service_set_main_pid()
933 static int service_is_suitable_main_pid(Service *s, pid_t pid, int prio) { in service_is_suitable_main_pid() argument
[all …]
/systemd-251/src/journal/
Djournald-context.c101 return CMP(x->pid, y->pid); in client_context_compare()
104 static int client_context_new(Server *s, pid_t pid, ClientContext **ret) { in client_context_new() argument
109 assert(pid_is_valid(pid)); in client_context_new()
121 .pid = pid, in client_context_new()
135 r = hashmap_ensure_put(&s->client_contexts, NULL, PID_TO_PTR(pid), c); in client_context_new()
190 assert_se(hashmap_remove(s->client_contexts, PID_TO_PTR(c->pid)) == c); in client_context_free()
202 assert(pid_is_valid(c->pid)); in client_context_read_uid_gid()
208 (void) get_process_uid(c->pid, &c->uid); in client_context_read_uid_gid()
213 (void) get_process_gid(c->pid, &c->gid); in client_context_read_uid_gid()
220 assert(pid_is_valid(c->pid)); in client_context_read_basic()
[all …]
Djournald-syslog.c94 u.pid = getpid_cached(); in forward_syslog_iovec()
155 (void) get_process_comm(ucred->pid, &ident_buf); in server_forward_syslog()
159 xsprintf(header_pid, "["PID_FMT"]: ", ucred->pid); in server_forward_syslog()
184 size_t syslog_parse_identifier(const char **buf, char **identifier, char **pid) { in syslog_parse_identifier() argument
191 assert(pid); in syslog_parse_identifier()
213 *pid = t; in syslog_parse_identifier()
319 _cleanup_free_ char *identifier = NULL, *pid = NULL, in server_process_syslog_message() local
335 if (ucred && pid_is_valid(ucred->pid)) { in server_process_syslog_message()
336 r = client_context_get(s, ucred->pid, ucred, label, label_len, NULL, &context); in server_process_syslog_message()
338 …g_warning_errno(r, "Failed to retrieve credentials for PID " PID_FMT ", ignoring: %m", ucred->pid); in server_process_syslog_message()
[all …]
/systemd-251/src/libsystemd/sd-login/
Dsd-login.c42 _public_ int sd_pid_get_session(pid_t pid, char **session) { in sd_pid_get_session() argument
45 assert_return(pid >= 0, -EINVAL); in sd_pid_get_session()
48 r = cg_pid_get_session(pid, session); in sd_pid_get_session()
52 _public_ int sd_pid_get_unit(pid_t pid, char **unit) { in sd_pid_get_unit() argument
55 assert_return(pid >= 0, -EINVAL); in sd_pid_get_unit()
58 r = cg_pid_get_unit(pid, unit); in sd_pid_get_unit()
62 _public_ int sd_pid_get_user_unit(pid_t pid, char **unit) { in sd_pid_get_user_unit() argument
65 assert_return(pid >= 0, -EINVAL); in sd_pid_get_user_unit()
68 r = cg_pid_get_user_unit(pid, unit); in sd_pid_get_user_unit()
72 _public_ int sd_pid_get_machine_name(pid_t pid, char **name) { in sd_pid_get_machine_name() argument
[all …]
/systemd-251/src/coredump/
Dcoredump.c126 pid_t pid; member
583 static int compose_open_fds(pid_t pid, char **open_fds) { in compose_open_fds() argument
592 assert(pid >= 0); in compose_open_fds()
595 path = procfs_file_alloca(pid, "fd"); in compose_open_fds()
654 static int get_process_ns(pid_t pid, const char *namespace, ino_t *ns) { in get_process_ns() argument
659 p = procfs_file_alloca(pid, "ns"); in get_process_ns()
672 static int get_mount_namespace_leader(pid_t pid, pid_t *ret) { in get_mount_namespace_leader() argument
676 r = get_process_ns(pid, "mnt", &proc_mntns); in get_mount_namespace_leader()
684 r = get_process_ppid(pid, &ppid); in get_mount_namespace_leader()
700 pid = ppid; in get_mount_namespace_leader()
[all …]
/systemd-251/test/units/
Dtestsuite-20.sh75 echo \$MAINPID >/run/mainpidsh/pid
79 …ty -p Type=forking -p RuntimeDirectory=mainpidsh -p PIDFile=/run/mainpidsh/pid /tmp/test20-mainpid…
99 echo \$MAINPID >/run/mainpidsh2/pid
100 chown 1001:1001 /run/mainpidsh2/pid
104 … -p Type=forking -p RuntimeDirectory=mainpidsh2 -p PIDFile=/run/mainpidsh2/pid /tmp/test20-mainpid…
123 ln -s ../mainpidsh/pid /run/mainpidsh3/pid
126 test -f /run/mainpidsh3/pid
137 -p PIDFile=/run/mainpidsh3/pid \
/systemd-251/src/systemd/
Dsd-login.h51 int sd_pid_get_session(pid_t pid, char **session);
58 int sd_pid_get_owner_uid(pid_t pid, uid_t *uid);
62 int sd_pid_get_unit(pid_t pid, char **unit);
67 int sd_pid_get_user_unit(pid_t pid, char **unit);
70 int sd_pid_get_slice(pid_t pid, char **slice);
73 int sd_pid_get_user_slice(pid_t pid, char **slice);
77 int sd_pid_get_machine_name(pid_t pid, char **machine);
81 int sd_pid_get_cgroup(pid_t pid, char **cgroup);
/systemd-251/src/nspawn/
Dnspawn-stub-pid1.c42 pid_t pid; in stub_pid1() local
56 pid = fork(); in stub_pid1()
57 if (pid < 0) in stub_pid1()
60 if (pid == 0) { in stub_pid1()
120 if (si.si_pid == pid || current_usec >= quit_usec) { in stub_pid1()
132 if (si.si_pid == pid && si.si_code == CLD_EXITED) in stub_pid1()
183 r = kill_and_sigcont(pid, SIGTERM); in stub_pid1()
191 (void) kill(pid, SIGHUP); in stub_pid1()
Dnspawn-setuid.c24 pid_t pid; in spawn_getent() local
33 r = safe_fork("(getent)", FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_LOG, &pid); in spawn_getent()
57 *rpid = pid; in spawn_getent()
101 pid_t pid; in change_uid_gid() local
118 fd = spawn_getent("passwd", user, &pid); in change_uid_gid()
133 (void) wait_for_terminate_and_check("getent passwd", pid, WAIT_LOG); in change_uid_gid()
190 fd = spawn_getent("initgroups", user, &pid); in change_uid_gid()
205 (void) wait_for_terminate_and_check("getent initgroups", pid, WAIT_LOG); in change_uid_gid()
/systemd-251/src/libsystemd/sd-bus/
Dbus-creds.c141 _public_ int sd_bus_creds_new_from_pid(sd_bus_creds **ret, pid_t pid, uint64_t mask) { in sd_bus_creds_new_from_pid() argument
145 assert_return(pid >= 0, -EINVAL); in sd_bus_creds_new_from_pid()
149 if (pid == 0) in sd_bus_creds_new_from_pid()
150 pid = getpid_cached(); in sd_bus_creds_new_from_pid()
156 r = bus_creds_add_more(c, mask | SD_BUS_CREDS_AUGMENT, pid, 0); in sd_bus_creds_new_from_pid()
164 if (!pid_is_alive(pid)) { in sd_bus_creds_new_from_pid()
272 _public_ int sd_bus_creds_get_pid(sd_bus_creds *c, pid_t *pid) { in sd_bus_creds_get_pid() argument
274 assert_return(pid, -EINVAL); in sd_bus_creds_get_pid()
279 assert(c->pid > 0); in sd_bus_creds_get_pid()
280 *pid = c->pid; in sd_bus_creds_get_pid()
[all …]
/systemd-251/src/remount-fs/
Dremount-fs.c26 static int track_pid(Hashmap **h, const char *path, pid_t pid) { in track_pid() argument
32 assert(pid_is_valid(pid)); in track_pid()
38 r = hashmap_ensure_put(h, NULL, PID_TO_PTR(pid), c); in track_pid()
42 return log_error_errno(r, "Failed to store pid " PID_FMT, pid); in track_pid()
49 pid_t pid; in do_remount() local
55 FORK_RESET_SIGNALS|FORK_DEATHSIG|FORK_RLIMIT_NOFILE_SAFE|FORK_LOG, &pid); in do_remount()
70 return track_pid(pids, path, pid); in do_remount()
/systemd-251/src/libsystemd/sd-daemon/
Dsd-daemon.c45 pid_t pid; in sd_listen_fds() local
53 r = parse_pid(e, &pid); in sd_listen_fds()
58 if (getpid_cached() != pid) { in sd_listen_fds()
438 pid_t pid, in sd_pid_notify_with_fds() argument
487 (pid != 0 && pid != getpid_cached()) || in sd_pid_notify_with_fds()
519 ucred->pid = pid != 0 ? pid : getpid_cached(); in sd_pid_notify_with_fds()
574 _public_ int sd_pid_notify(pid_t pid, int unset_environment, const char *state) { in sd_pid_notify() argument
575 return sd_pid_notify_with_fds(pid, unset_environment, state, NULL, 0); in sd_pid_notify()
582 _public_ int sd_pid_notifyf(pid_t pid, int unset_environment, const char *format, ...) { in sd_pid_notifyf() argument
597 return sd_pid_notify(pid, unset_environment, p); in sd_pid_notifyf()
[all …]
/systemd-251/src/login/
Dlogind-inhibit.c112 i->pid); in inhibitor_save()
181 i->pid, i->uid, in inhibitor_start()
199 i->pid, i->uid, in inhibitor_stop()
213 …_cleanup_free_ char *what = NULL, *uid = NULL, *pid = NULL, *who = NULL, *why = NULL, *mode = NULL; in inhibitor_load() local
223 "PID", &pid, in inhibitor_load()
245 if (pid) { in inhibitor_load()
246 r = parse_pid(pid, &i->pid); in inhibitor_load()
248 log_debug_errno(r, "Failed to parse PID of inhibitor: %s", pid); in inhibitor_load()
377 static int pid_is_active(Manager *m, pid_t pid) { in pid_is_active() argument
383 r = manager_get_session_by_pid(m, pid, &s); in pid_is_active()
[all …]

12345678