Commit 8323bc1f authored by Lennart Poettering's avatar Lennart Poettering

bus: also parse PID starttime out of kdbus message

parent f9be01f3
......@@ -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;
......
......@@ -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) {
......
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment