summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-06-05 19:15:43 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-06-10 10:10:07 -0400
commited375bebf46c1251f4baa170b39ee93761dbdb19 (patch)
tree3e0a00692caff19285cca38764ea84c8b0a9ba35 /src
parent2765b7bb6924e2c26c7bf60bd692a4bc121d9582 (diff)
journalctl: print monotonic timestamp in --header
Diffstat (limited to 'src')
-rw-r--r--src/journal/journal-file.c7
-rw-r--r--src/journal/journald-server.c19
2 files changed, 7 insertions, 19 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 7f855743b8..ca217f93fe 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -2272,7 +2272,7 @@ fail:
void journal_file_print_header(JournalFile *f) {
char a[33], b[33], c[33], d[33];
- char x[FORMAT_TIMESTAMP_MAX], y[FORMAT_TIMESTAMP_MAX];
+ char x[FORMAT_TIMESTAMP_MAX], y[FORMAT_TIMESTAMP_MAX], z[FORMAT_TIMESTAMP_MAX];
struct stat st;
char bytes[FORMAT_BYTES_MAX];
@@ -2295,6 +2295,7 @@ void journal_file_print_header(JournalFile *f) {
"Tail Sequential Number: %"PRIu64"\n"
"Head Realtime Timestamp: %s\n"
"Tail Realtime Timestamp: %s\n"
+ "Tail Monotonic Timestamp: %s\n"
"Objects: %"PRIu64"\n"
"Entry Objects: %"PRIu64"\n",
f->path,
@@ -2318,6 +2319,7 @@ void journal_file_print_header(JournalFile *f) {
le64toh(f->header->tail_entry_seqnum),
format_timestamp(x, sizeof(x), le64toh(f->header->head_entry_realtime)),
format_timestamp(y, sizeof(y), le64toh(f->header->tail_entry_realtime)),
+ format_timespan(z, sizeof(z), le64toh(f->header->tail_entry_monotonic), USEC_PER_MSEC),
le64toh(f->header->n_objects),
le64toh(f->header->n_entries));
@@ -2596,7 +2598,7 @@ int journal_file_open_reliably(
int r;
size_t l;
- char *p;
+ _cleanup_free_ char *p = NULL;
r = journal_file_open(fname, flags, mode, compress, seal,
metrics, mmap_cache, template, ret);
@@ -2627,7 +2629,6 @@ int journal_file_open_reliably(
return -ENOMEM;
r = rename(fname, p);
- free(p);
if (r < 0)
return -errno;
diff --git a/src/journal/journald-server.c b/src/journal/journald-server.c
index 0bf557c809..6c99f4b690 100644
--- a/src/journal/journald-server.c
+++ b/src/journal/journald-server.c
@@ -245,7 +245,7 @@ finish:
}
static JournalFile* find_journal(Server *s, uid_t uid) {
- char *p;
+ _cleanup_free_ char *p = NULL;
int r;
JournalFile *f;
sd_id128_t machine;
@@ -283,8 +283,6 @@ static JournalFile* find_journal(Server *s, uid_t uid) {
}
r = journal_file_open_reliably(p, O_RDWR|O_CREAT, 0640, s->compress, s->seal, &s->system_metrics, s->mmap, s->system_journal, &f);
- free(p);
-
if (r < 0)
return s->system_journal;
@@ -372,7 +370,6 @@ void server_sync(Server *s) {
}
void server_vacuum(Server *s) {
- char *p;
char ids[33];
sd_id128_t machine;
int r;
@@ -390,29 +387,19 @@ void server_vacuum(Server *s) {
sd_id128_to_string(machine, ids);
if (s->system_journal) {
- p = strappend("/var/log/journal/", ids);
- if (!p) {
- log_oom();
- return;
- }
+ char *p = strappenda("/var/log/journal/", ids);
r = journal_directory_vacuum(p, s->system_metrics.max_use, s->system_metrics.keep_free, s->max_retention_usec, &s->oldest_file_usec);
if (r < 0 && r != -ENOENT)
log_error("Failed to vacuum %s: %s", p, strerror(-r));
- free(p);
}
if (s->runtime_journal) {
- p = strappend("/run/log/journal/", ids);
- if (!p) {
- log_oom();
- return;
- }
+ char *p = strappenda("/run/log/journal/", ids);
r = journal_directory_vacuum(p, s->runtime_metrics.max_use, s->runtime_metrics.keep_free, s->max_retention_usec, &s->oldest_file_usec);
if (r < 0 && r != -ENOENT)
log_error("Failed to vacuum %s: %s", p, strerror(-r));
- free(p);
}
s->cached_available_space_timestamp = 0;