Compare commits
3 Commits
c2cffd1e80
...
e890662305
Author | SHA1 | Date |
---|---|---|
Florian Schmaus | e890662305 | |
Daan De Meyer | dbbe895807 | |
Florian Schmaus | d7e58758a6 |
|
@ -411,6 +411,10 @@ int manager_get_idle_hint(Manager *m, dual_timestamp *t) {
|
||||||
|
|
||||||
assert(m);
|
assert(m);
|
||||||
|
|
||||||
|
/* Initialize the baseline timestamp with the time the manager got initialized to avoid reporting
|
||||||
|
* unreasonable large idle periods starting with the Unix epoch. */
|
||||||
|
ts = m->init_ts;
|
||||||
|
|
||||||
idle_hint = !manager_is_inhibited(m, INHIBIT_IDLE, /* block= */ true, t, false, false, 0, NULL);
|
idle_hint = !manager_is_inhibited(m, INHIBIT_IDLE, /* block= */ true, t, false, false, 0, NULL);
|
||||||
|
|
||||||
HASHMAP_FOREACH(s, m->sessions) {
|
HASHMAP_FOREACH(s, m->sessions) {
|
||||||
|
|
|
@ -100,6 +100,8 @@ static int manager_new(Manager **ret) {
|
||||||
|
|
||||||
(void) sd_event_set_watchdog(m->event, true);
|
(void) sd_event_set_watchdog(m->event, true);
|
||||||
|
|
||||||
|
dual_timestamp_now(&m->init_ts);
|
||||||
|
|
||||||
manager_reset_config(m);
|
manager_reset_config(m);
|
||||||
|
|
||||||
*ret = TAKE_PTR(m);
|
*ret = TAKE_PTR(m);
|
||||||
|
|
|
@ -145,6 +145,8 @@ struct Manager {
|
||||||
struct stat efi_loader_entry_one_shot_stat;
|
struct stat efi_loader_entry_one_shot_stat;
|
||||||
|
|
||||||
CalendarSpec *maintenance_time;
|
CalendarSpec *maintenance_time;
|
||||||
|
|
||||||
|
dual_timestamp init_ts;
|
||||||
};
|
};
|
||||||
|
|
||||||
void manager_reset_config(Manager *m);
|
void manager_reset_config(Manager *m);
|
||||||
|
|
|
@ -7,24 +7,26 @@ TEST(audit_loginuid_from_pid) {
|
||||||
_cleanup_(pidref_done) PidRef self = PIDREF_NULL, pid1 = PIDREF_NULL;
|
_cleanup_(pidref_done) PidRef self = PIDREF_NULL, pid1 = PIDREF_NULL;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
assert_se(pidref_set_self(&self) >= 0);
|
ASSERT_OK(pidref_set_self(&self));
|
||||||
assert_se(pidref_set_pid(&pid1, 1) >= 0);
|
ASSERT_OK(pidref_set_pid(&pid1, 1));
|
||||||
|
|
||||||
uid_t uid;
|
uid_t uid;
|
||||||
r = audit_loginuid_from_pid(&self, &uid);
|
r = audit_loginuid_from_pid(&self, &uid);
|
||||||
assert_se(r >= 0 || r == -ENODATA);
|
if (r != -ENODATA)
|
||||||
|
ASSERT_OK(r);
|
||||||
if (r >= 0)
|
if (r >= 0)
|
||||||
log_info("self audit login uid: " UID_FMT, uid);
|
log_info("self audit login uid: " UID_FMT, uid);
|
||||||
|
|
||||||
assert_se(audit_loginuid_from_pid(&pid1, &uid) == -ENODATA);
|
ASSERT_ERROR(audit_loginuid_from_pid(&pid1, &uid), ENODATA);
|
||||||
|
|
||||||
uint32_t sessionid;
|
uint32_t sessionid;
|
||||||
r = audit_session_from_pid(&self, &sessionid);
|
r = audit_session_from_pid(&self, &sessionid);
|
||||||
assert_se(r >= 0 || r == -ENODATA);
|
if (r != -ENODATA)
|
||||||
|
ASSERT_OK(r);
|
||||||
if (r >= 0)
|
if (r >= 0)
|
||||||
log_info("self audit session id: %" PRIu32, sessionid);
|
log_info("self audit session id: %" PRIu32, sessionid);
|
||||||
|
|
||||||
assert_se(audit_session_from_pid(&pid1, &sessionid) == -ENODATA);
|
ASSERT_ERROR(audit_session_from_pid(&pid1, &sessionid), ENODATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int intro(void) {
|
static int intro(void) {
|
||||||
|
|
Loading…
Reference in New Issue