summaryrefslogtreecommitdiff
path: root/src/libsystemd-bus
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-04-12 01:49:52 +0200
committerLennart Poettering <lennart@poettering.net>2013-04-12 01:49:52 +0200
commit8323bc1f907ff558df5ccd6bdf1e14debed5cf2e (patch)
tree6aaf16b8b61a2c3771473b422b7ddb5b75cf9885 /src/libsystemd-bus
parentf9be01f3b4784affa269694a4f5cdcb87f06f2f7 (diff)
bus: also parse PID starttime out of kdbus message
Diffstat (limited to 'src/libsystemd-bus')
-rw-r--r--src/libsystemd-bus/bus-kernel.c1
-rw-r--r--src/libsystemd-bus/bus-message.c13
-rw-r--r--src/libsystemd-bus/bus-message.h1
3 files changed, 14 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;