diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd-bus/bus-kernel.c | 1 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-message.c | 13 | ||||
-rw-r--r-- | src/libsystemd-bus/bus-message.h | 1 | ||||
-rw-r--r-- | src/systemd/sd-bus.h | 1 |
4 files changed, 15 insertions, 1 deletions
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c index 83379d1430..3d26f16cda 100644 --- a/src/libsystemd-bus/bus-kernel.c +++ b/src/libsystemd-bus/bus-kernel.c @@ -305,6 +305,7 @@ static int bus_kernel_make_message(sd_bus *bus, struct kdbus_msg *k, sd_bus_mess } if (creds) { + m->pid_starttime = creds->starttime / NSEC_PER_USEC; m->uid = creds->uid; m->gid = creds->gid; m->pid = creds->pid; diff --git a/src/libsystemd-bus/bus-message.c b/src/libsystemd-bus/bus-message.c index 092654ff45..aac49f486e 100644 --- a/src/libsystemd-bus/bus-message.c +++ b/src/libsystemd-bus/bus-message.c @@ -692,6 +692,16 @@ int sd_bus_message_get_tid(sd_bus_message *m, pid_t *tid) { return 0; } +int sd_bus_message_get_pid_starttime(sd_bus_message *m, uint64_t *usec) { + if (!m) + return -EINVAL; + if (m->pid_starttime <= 0) + return -ENOENT; + + *usec = m->pid_starttime; + return 0; +} + const char *sd_bus_message_get_label(sd_bus_message *m) { if (!m) return NULL; @@ -2910,7 +2920,8 @@ int bus_message_dump(sd_bus_message *m) { printf("\tuid=%lu\n", (unsigned long) m->uid); if (m->gid_valid) printf("\tgid=%lu\n", (unsigned long) m->gid); - + if (m->pid_starttime != 0) + printf("\tpid_starttime=%llu\n", (unsigned long long) m->pid_starttime); r = sd_bus_message_rewind(m, true); if (r < 0) { diff --git a/src/libsystemd-bus/bus-message.h b/src/libsystemd-bus/bus-message.h index d1ab5484ba..079a188787 100644 --- a/src/libsystemd-bus/bus-message.h +++ b/src/libsystemd-bus/bus-message.h @@ -67,6 +67,7 @@ struct sd_bus_message { gid_t gid; pid_t pid; pid_t tid; + usec_t pid_starttime; bool sealed:1; bool dont_send:1; diff --git a/src/systemd/sd-bus.h b/src/systemd/sd-bus.h index 748d76b02b..4ab5924e7d 100644 --- a/src/systemd/sd-bus.h +++ b/src/systemd/sd-bus.h @@ -125,6 +125,7 @@ int sd_bus_message_get_uid(sd_bus_message *m, uid_t *uid); int sd_bus_message_get_gid(sd_bus_message *m, gid_t *gid); int sd_bus_message_get_pid(sd_bus_message *m, pid_t *pid); int sd_bus_message_get_tid(sd_bus_message *m, pid_t *tid); +int sd_bus_message_get_pid_starttime(sd_bus_message *m, uint64_t *usec); const char *sd_bus_message_get_label(sd_bus_message *m); int sd_bus_message_is_signal(sd_bus_message *m, const char *interface, const char *member); |