chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
udev: path_id - set supported_parent for well-known SCSI setups
[elogind.git]
/
src
/
journal
/
journald-server.c
diff --git
a/src/journal/journald-server.c
b/src/journal/journald-server.c
index bf9cfcccc9bcf451dff53f7da665d6ce6d2561a9..12735c4b81d3e34e3311c0ab4d5e377ba43d9ccd 100644
(file)
--- a/
src/journal/journald-server.c
+++ b/
src/journal/journald-server.c
@@
-266,7
+266,7
@@
static JournalFile* find_journal(Server *s, uid_t uid) {
if (r < 0)
return s->system_journal;
if (r < 0)
return s->system_journal;
- f = hashmap_get(s->user_journals, UINT32_TO_PTR(uid));
+ f =
ordered_
hashmap_get(s->user_journals, UINT32_TO_PTR(uid));
if (f)
return f;
if (f)
return f;
@@
-274,9
+274,9
@@
static JournalFile* find_journal(Server *s, uid_t uid) {
SD_ID128_FORMAT_VAL(machine), uid) < 0)
return s->system_journal;
SD_ID128_FORMAT_VAL(machine), uid) < 0)
return s->system_journal;
- while (hashmap_size(s->user_journals) >= USER_JOURNALS_MAX) {
+ while (
ordered_
hashmap_size(s->user_journals) >= USER_JOURNALS_MAX) {
/* Too many open? Then let's close one */
/* Too many open? Then let's close one */
- f = hashmap_steal_first(s->user_journals);
+ f =
ordered_
hashmap_steal_first(s->user_journals);
assert(f);
journal_file_close(f);
}
assert(f);
journal_file_close(f);
}
@@
-287,7
+287,7
@@
static JournalFile* find_journal(Server *s, uid_t uid) {
server_fix_perms(s, f, uid);
server_fix_perms(s, f, uid);
- r = hashmap_put(s->user_journals, UINT32_TO_PTR(uid), f);
+ r =
ordered_
hashmap_put(s->user_journals, UINT32_TO_PTR(uid), f);
if (r < 0) {
journal_file_close(f);
return s->system_journal;
if (r < 0) {
journal_file_close(f);
return s->system_journal;
@@
-328,13
+328,13
@@
void server_rotate(Server *s) {
do_rotate(s, &s->runtime_journal, "runtime", false, 0);
do_rotate(s, &s->system_journal, "system", s->seal, 0);
do_rotate(s, &s->runtime_journal, "runtime", false, 0);
do_rotate(s, &s->system_journal, "system", s->seal, 0);
- HASHMAP_FOREACH_KEY(f, k, s->user_journals, i) {
+
ORDERED_
HASHMAP_FOREACH_KEY(f, k, s->user_journals, i) {
r = do_rotate(s, &f, "user", s->seal, PTR_TO_UINT32(k));
if (r >= 0)
r = do_rotate(s, &f, "user", s->seal, PTR_TO_UINT32(k));
if (r >= 0)
- hashmap_replace(s->user_journals, k, f);
+
ordered_
hashmap_replace(s->user_journals, k, f);
else if (!f)
/* Old file has been closed and deallocated */
else if (!f)
/* Old file has been closed and deallocated */
- hashmap_remove(s->user_journals, k);
+
ordered_
hashmap_remove(s->user_journals, k);
}
}
}
}
@@
-350,7
+350,7
@@
void server_sync(Server *s) {
log_error("Failed to sync system journal: %s", strerror(-r));
}
log_error("Failed to sync system journal: %s", strerror(-r));
}
- HASHMAP_FOREACH_KEY(f, k, s->user_journals, i) {
+
ORDERED_
HASHMAP_FOREACH_KEY(f, k, s->user_journals, i) {
r = journal_file_set_offline(f);
if (r < 0)
log_error("Failed to sync user journal: %s", strerror(-r));
r = journal_file_set_offline(f);
if (r < 0)
log_error("Failed to sync user journal: %s", strerror(-r));
@@
-680,7
+680,7
@@
static void dispatch_message_real(
}
#ifdef HAVE_SELINUX
}
#ifdef HAVE_SELINUX
- if (
use_selinux
()) {
+ if (
mac_selinux_use
()) {
if (label) {
x = alloca(strlen("_SELINUX_CONTEXT=") + label_len + 1);
if (label) {
x = alloca(strlen("_SELINUX_CONTEXT=") + label_len + 1);
@@
-919,7
+919,7
@@
finish:
}
}
-static int system_journal_open(Server *s) {
+static int system_journal_open(Server *s
, bool flush_requested
) {
int r;
char *fn;
sd_id128_t machine;
int r;
char *fn;
sd_id128_t machine;
@@
-935,7
+935,8
@@
static int system_journal_open(Server *s) {
if (!s->system_journal &&
(s->storage == STORAGE_PERSISTENT || s->storage == STORAGE_AUTO) &&
if (!s->system_journal &&
(s->storage == STORAGE_PERSISTENT || s->storage == STORAGE_AUTO) &&
- access("/run/systemd/journal/flushed", F_OK) >= 0) {
+ (flush_requested
+ || access("/run/systemd/journal/flushed", F_OK) >= 0)) {
/* If in auto mode: first try to create the machine
* path, but not the prefix.
/* If in auto mode: first try to create the machine
* path, but not the prefix.
@@
-1029,7
+1030,7
@@
int server_flush_to_var(Server *s) {
if (!s->runtime_journal)
return 0;
if (!s->runtime_journal)
return 0;
- system_journal_open(s);
+ system_journal_open(s
, true
);
if (!s->system_journal)
return 0;
if (!s->system_journal)
return 0;
@@
-1221,11
+1222,12
@@
static int dispatch_sigusr1(sd_event_source *es, const struct signalfd_siginfo *
log_info("Received request to flush runtime journal from PID %"PRIu32, si->ssi_pid);
log_info("Received request to flush runtime journal from PID %"PRIu32, si->ssi_pid);
- touch("/run/systemd/journal/flushed");
server_flush_to_var(s);
server_sync(s);
server_vacuum(s);
server_flush_to_var(s);
server_sync(s);
server_vacuum(s);
+ touch("/run/systemd/journal/flushed");
+
return 0;
}
return 0;
}
@@
-1483,7
+1485,7
@@
int server_init(Server *s) {
mkdir_p("/run/systemd/journal", 0755);
mkdir_p("/run/systemd/journal", 0755);
- s->user_journals = hashmap_new(NULL);
+ s->user_journals =
ordered_
hashmap_new(NULL);
if (!s->user_journals)
return log_oom();
if (!s->user_journals)
return log_oom();
@@
-1585,7
+1587,7
@@
int server_init(Server *s) {
server_cache_boot_id(s);
server_cache_machine_id(s);
server_cache_boot_id(s);
server_cache_machine_id(s);
- r = system_journal_open(s);
+ r = system_journal_open(s
, false
);
if (r < 0)
return r;
if (r < 0)
return r;
@@
-1603,7
+1605,7
@@
void server_maybe_append_tags(Server *s) {
if (s->system_journal)
journal_file_maybe_append_tag(s->system_journal, n);
if (s->system_journal)
journal_file_maybe_append_tag(s->system_journal, n);
- HASHMAP_FOREACH(f, s->user_journals, i)
+
ORDERED_
HASHMAP_FOREACH(f, s->user_journals, i)
journal_file_maybe_append_tag(f, n);
#endif
}
journal_file_maybe_append_tag(f, n);
#endif
}
@@
-1621,10
+1623,10
@@
void server_done(Server *s) {
if (s->runtime_journal)
journal_file_close(s->runtime_journal);
if (s->runtime_journal)
journal_file_close(s->runtime_journal);
- while ((f = hashmap_steal_first(s->user_journals)))
+ while ((f =
ordered_
hashmap_steal_first(s->user_journals)))
journal_file_close(f);
journal_file_close(f);
- hashmap_free(s->user_journals);
+
ordered_
hashmap_free(s->user_journals);
sd_event_source_unref(s->syslog_event_source);
sd_event_source_unref(s->native_event_source);
sd_event_source_unref(s->syslog_event_source);
sd_event_source_unref(s->native_event_source);