diff options
author | Lennart Poettering <lennart@poettering.net> | 2017-07-20 16:19:18 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-07-20 20:27:24 +0200 |
commit | df0ff127758809a45105893772de76082d12a26d (patch) | |
tree | 9deb3a960cf26b54beae6a0b60d376c6ba8efe9a /src/libsystemd/sd-netlink/sd-netlink.c | |
parent | 5c30a6d2b805ae9b5dd0ad003b9ee86b8965bc47 (diff) | |
download | systemd-df0ff127758809a45105893772de76082d12a26d.tar.gz |
tree-wide: make use of getpid_cached() wherever we can
This moves pretty much all uses of getpid() over to getpid_raw(). I
didn't specifically check whether the optimization is worth it for each
replacement, but in order to keep things simple and systematic I
switched over everything at once.
Diffstat (limited to 'src/libsystemd/sd-netlink/sd-netlink.c')
-rw-r--r-- | src/libsystemd/sd-netlink/sd-netlink.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsystemd/sd-netlink/sd-netlink.c b/src/libsystemd/sd-netlink/sd-netlink.c index 68435564de..d67244676c 100644 --- a/src/libsystemd/sd-netlink/sd-netlink.c +++ b/src/libsystemd/sd-netlink/sd-netlink.c @@ -44,7 +44,7 @@ static int sd_netlink_new(sd_netlink **ret) { rtnl->n_ref = REFCNT_INIT; rtnl->fd = -1; rtnl->sockaddr.nl.nl_family = AF_NETLINK; - rtnl->original_pid = getpid(); + rtnl->original_pid = getpid_cached(); LIST_HEAD_INIT(rtnl->match_callbacks); @@ -99,7 +99,7 @@ static bool rtnl_pid_changed(sd_netlink *rtnl) { /* We don't support people creating an rtnl connection and * keeping it around over a fork(). Let's complain. */ - return rtnl->original_pid != getpid(); + return rtnl->original_pid != getpid_cached(); } int sd_netlink_open_fd(sd_netlink **ret, int fd) { |