diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-09-03 13:22:51 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-09-04 09:07:30 +0200 |
commit | fea72cc0336f4d90875cdddc1aa9739dcbb174f5 (patch) | |
tree | 2df6cafa6b27564f452a8a2f2b9bfbc01d4b88b7 /src/core/manager.c | |
parent | a8ba86ce6a78f2bd80529e535af3494bf8297cfd (diff) |
macro: introduce new PID_TO_PTR macros and make use of them
This adds a new PID_TO_PTR() macro, plus PTR_TO_PID() and makes use of
it wherever we maintain processes in a hash table. Previously we
sometimes used LONG_TO_PTR() and other times ULONG_TO_PTR() for that,
hence let's make this more explicit and clean up things.
Diffstat (limited to 'src/core/manager.c')
-rw-r--r-- | src/core/manager.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/core/manager.c b/src/core/manager.c index c3327e37f5..c2d262a5d3 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -1591,13 +1591,13 @@ static int manager_dispatch_notify_fd(sd_event_source *source, int fd, uint32_t found = true; } - u2 = hashmap_get(m->watch_pids1, LONG_TO_PTR(ucred->pid)); + u2 = hashmap_get(m->watch_pids1, PID_TO_PTR(ucred->pid)); if (u2 && u2 != u1) { manager_invoke_notify_message(m, u2, ucred->pid, buf, n, fds); found = true; } - u3 = hashmap_get(m->watch_pids2, LONG_TO_PTR(ucred->pid)); + u3 = hashmap_get(m->watch_pids2, PID_TO_PTR(ucred->pid)); if (u3 && u3 != u2 && u3 != u1) { manager_invoke_notify_message(m, u3, ucred->pid, buf, n, fds); found = true; @@ -1666,10 +1666,10 @@ static int manager_dispatch_sigchld(Manager *m) { u1 = manager_get_unit_by_pid(m, si.si_pid); if (u1) invoke_sigchld_event(m, u1, &si); - u2 = hashmap_get(m->watch_pids1, LONG_TO_PTR(si.si_pid)); + u2 = hashmap_get(m->watch_pids1, PID_TO_PTR(si.si_pid)); if (u2 && u2 != u1) invoke_sigchld_event(m, u2, &si); - u3 = hashmap_get(m->watch_pids2, LONG_TO_PTR(si.si_pid)); + u3 = hashmap_get(m->watch_pids2, PID_TO_PTR(si.si_pid)); if (u3 && u3 != u2 && u3 != u1) invoke_sigchld_event(m, u3, &si); } |