mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-03-12 08:58:20 +03:00
tree-wide: getpid() → getpid_cached()
This doesn't really matter, but let's be systematic and prefer getpid_cached() in our codebase.
This commit is contained in:
parent
742aebc5a7
commit
19b761a097
@ -26,6 +26,7 @@
|
||||
#include "missing_syscall.h"
|
||||
#include "missing_threads.h"
|
||||
#include "parse-util.h"
|
||||
#include "process-util.h"
|
||||
#include "random-util.h"
|
||||
#include "sha256.h"
|
||||
#include "time-util.h"
|
||||
@ -48,7 +49,7 @@ static void fallback_random_bytes(void *p, size_t n) {
|
||||
.call_id = fallback_counter++,
|
||||
.stamp_mono = now(CLOCK_MONOTONIC),
|
||||
.stamp_real = now(CLOCK_REALTIME),
|
||||
.pid = getpid(),
|
||||
.pid = getpid_cached(),
|
||||
.tid = gettid(),
|
||||
};
|
||||
|
||||
|
@ -122,7 +122,7 @@ static int signal_handler(sd_event_source *s, const struct signalfd_siginfo *si,
|
||||
zero(plain_si);
|
||||
plain_si.si_signo = SIGUSR2;
|
||||
plain_si.si_code = SI_QUEUE;
|
||||
plain_si.si_pid = getpid();
|
||||
plain_si.si_pid = getpid_cached();
|
||||
plain_si.si_uid = getuid();
|
||||
plain_si.si_value.sival_int = 4711;
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "journal-send.h"
|
||||
#include "memfd-util.h"
|
||||
#include "missing_syscall.h"
|
||||
#include "process-util.h"
|
||||
#include "socket-util.h"
|
||||
#include "stdio-util.h"
|
||||
#include "string-util.h"
|
||||
@ -85,7 +86,7 @@ void close_journal_fd(void) {
|
||||
if (!RUNNING_ON_VALGRIND)
|
||||
return;
|
||||
|
||||
if (getpid() != gettid())
|
||||
if (getpid_cached() != gettid())
|
||||
return;
|
||||
|
||||
if (fd_plus_one <= 0)
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "main-func.h"
|
||||
#include "parse-util.h"
|
||||
#include "pretty-print.h"
|
||||
#include "process-util.h"
|
||||
#include "string-util.h"
|
||||
#include "strv.h"
|
||||
#include "terminal-util.h"
|
||||
@ -170,11 +171,11 @@ static int parse_argv(int argc, char *argv[]) {
|
||||
* manager's PID (which might be distinct from
|
||||
* 1, if we are a --user instance), that'd just
|
||||
* be confusing for the service manager */
|
||||
arg_pid = getpid();
|
||||
arg_pid = getpid_cached();
|
||||
} else if (streq(optarg, "parent"))
|
||||
arg_pid = getppid();
|
||||
else if (streq(optarg, "self"))
|
||||
arg_pid = getpid();
|
||||
arg_pid = getpid_cached();
|
||||
else {
|
||||
r = parse_pid(optarg, &arg_pid);
|
||||
if (r < 0)
|
||||
|
@ -5257,7 +5257,7 @@ static int run_container(
|
||||
if (r == 0) {
|
||||
_cleanup_close_ int parent_netns_fd = -EBADF;
|
||||
|
||||
r = namespace_open(getpid(), NULL, NULL, &parent_netns_fd, NULL, NULL);
|
||||
r = namespace_open(getpid_cached(), NULL, NULL, &parent_netns_fd, NULL, NULL);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to open parent network namespace: %m");
|
||||
_exit(EXIT_FAILURE);
|
||||
|
@ -818,7 +818,7 @@ static int worker_spawn(Manager *manager, Event *event) {
|
||||
return log_error_errno(r, "Failed to fork() worker: %m");
|
||||
}
|
||||
if (r == 0) {
|
||||
DEVICE_TRACE_POINT(worker_spawned, event->dev, getpid());
|
||||
DEVICE_TRACE_POINT(worker_spawned, event->dev, getpid_cached());
|
||||
|
||||
/* Worker process */
|
||||
r = worker_main(manager, worker_monitor, sd_device_ref(event->dev));
|
||||
|
Loading…
x
Reference in New Issue
Block a user