mirror of
https://git.proxmox.com/git/systemd
synced 2026-01-10 11:13:51 +00:00
bus: also parse PID starttime out of kdbus message
This commit is contained in:
parent
f9be01f3b4
commit
8323bc1f90
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user