sd-journal.c revision 39887731d4a36292674f92effa30e5941419c201
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering This file is part of systemd.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Copyright 2011 Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is free software; you can redistribute it and/or modify it
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering under the terms of the GNU Lesser General Public License as published by
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering (at your option) any later version.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is distributed in the hope that it will be useful, but
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Lesser General Public License for more details.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering You should have received a copy of the GNU Lesser General Public License
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
3c0cf502796be355431d4a64d738e75f543aa51dLennart Poettering#define JOURNAL_FILES_RECHECK_USEC (2 * USEC_PER_SEC)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/* We return an error here only if we didn't manage to
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering memorize the real error. */
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poetteringstatic int set_put_error(sd_journal *j, int r) {
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering k = set_ensure_allocated(&j->errors, trivial_hash_func, trivial_compare_func);
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering return set_put(j->errors, INT_TO_PTR(r));
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic void detach_location(sd_journal *j) {
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poetteringstatic void reset_location(sd_journal *j) {
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poetteringstatic void init_location(Location *l, LocationType type, JournalFile *f, Object *o) {
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering assert(type == LOCATION_DISCRETE || type == LOCATION_SEEK);
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering l->realtime = le64toh(o->entry.realtime);
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering l->monotonic = le64toh(o->entry.monotonic);
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering l->xor_hash = le64toh(o->entry.xor_hash);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering l->seqnum_set = l->realtime_set = l->monotonic_set = l->xor_hash_set = true;
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poetteringstatic void set_location(sd_journal *j, LocationType type, JournalFile *f, Object *o, uint64_t offset) {
4e945a6f7971fd7d1f6b2c62ee3afdaff3c95ce4Lennart Poettering assert(type == LOCATION_DISCRETE || type == LOCATION_SEEK);
3e684349c2cead2e6fd2f816c34eb17daba23a49Lennart Poettering init_location(&j->current_location, type, f, o);
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringstatic int match_is_valid(const void *data, size_t size) {
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen const char *b, *p;
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen return false;
91b14d6ff362b938a72db17b095ee9903d07381bTom Gundersen return false;
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering for (p = b; p < b + size; p++) {
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering if (*p == '=')
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering if (*p == '_')
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poetteringstatic bool same_field(const void *_a, size_t s, const void *_b, size_t t) {
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering for (j = 0; j < s && j < t; j++) {
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering if (a[j] != b[j])
eed857b71702f8551b46b66b31fa0d08583cf23cLennart Poettering if (a[j] == '=')
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poetteringstatic Match *match_new(Match *p, MatchType t) {
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering LIST_PREPEND(Match, matches, p->matches, m);
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering LIST_REMOVE(Match, matches, m->parent->matches, m);
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poetteringstatic void match_free_if_empty(Match *m) {
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering_public_ int sd_journal_add_match(sd_journal *j, const void *data, size_t size) {
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering /* level 0: AND term
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering * level 1: OR terms
0b58db658b5c3f586ac3a837427f1f7fec2abb2eLennart Poettering * level 2: AND terms
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering * level 3: OR terms
9df3ba6c6cb65eecec06f39dfe85a3596cedac4eTom Gundersen * level 4: concrete matches */
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering j->level0 = match_new(NULL, MATCH_AND_TERM);
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen j->level1 = match_new(j->level0, MATCH_OR_TERM);
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering j->level2 = match_new(j->level1, MATCH_AND_TERM);
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering assert(j->level0->type == MATCH_AND_TERM);
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering assert(j->level1->type == MATCH_OR_TERM);
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering assert(j->level2->type == MATCH_AND_TERM);
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering LIST_FOREACH(matches, l3, j->level2->matches) {
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering /* Exactly the same match already? Then ignore
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering * this addition */
d74fb368b18f0fbd9a4fe6f15691bbea7f3c4a01Tom Gundersen /* Same field? Then let's add this to this OR term */
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering if (same_field(data, size, l4->data, l4->size)) {
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen add_here = match_new(j->level2, MATCH_OR_TERM);
571370c1555d2aa697733479a50957aff024bbcbLennart Poettering_public_ int sd_journal_add_conjunction(sd_journal *j) {
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen_public_ int sd_journal_add_disjunction(sd_journal *j) {
f4461e5641d53f27d6e76e0607bdaa9c0c58c1f6Lennart Poetteringstatic char *match_make_string(Match *m) {
be808ea083fa07271116b4519c3c27fd20c5f077Tom Gundersen bool enclose = false;
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering k = strjoin(p, m->type == MATCH_OR_TERM ? " OR " : " AND ", t, NULL);
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poetteringchar *journal_make_match_string(sd_journal *j) {
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering_public_ void sd_journal_flush_matches(sd_journal *j) {
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poettering j->level0 = j->level1 = j->level2 = NULL;
6bb2c08597c999c429e889cd2403b2fef5f3e1a0Lennart Poetteringstatic int compare_entry_order(JournalFile *af, Object *_ao,
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering /* The mmap cache might invalidate the object from the first
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering * file if we look at the one from the second file. Hence
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering * temporarily copy the header of the first one, and look at
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering * that only. */
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering ao = alloca(offsetof(EntryObject, items));
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering memcpy(ao, _ao, offsetof(EntryObject, items));
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering r = journal_file_move_to_object(bf, OBJECT_ENTRY, bp, &bo);
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering /* We operate on two different files here, hence we can access
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering * two objects at the same time, which we normally can't.
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering * If contents and timestamps match, these entries are
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering * identical, even if the seqnum does not match */
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering if (sd_id128_equal(ao->entry.boot_id, bo->entry.boot_id) &&
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering ao->entry.monotonic == bo->entry.monotonic &&
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering ao->entry.realtime == bo->entry.realtime &&
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering ao->entry.xor_hash == bo->entry.xor_hash)
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering if (sd_id128_equal(af->header->seqnum_id, bf->header->seqnum_id)) {
519ef04651b07a547f010d6462603669d7fde4e5Lennart Poettering /* If this is from the same seqnum source, compare
d5099efc47d4e6ac60816b5381a5f607ab03f06eMichal Schmidt /* Wow! This is weird, different data but the same
87f5a19343acf8ba697acc5a62bdb1a2b8c9eda3Lennart Poettering * seqnums? Something is borked, but let's make the
87f5a19343acf8ba697acc5a62bdb1a2b8c9eda3Lennart Poettering * best of it and compare by time. */
87f5a19343acf8ba697acc5a62bdb1a2b8c9eda3Lennart Poettering if (sd_id128_equal(ao->entry.boot_id, bo->entry.boot_id)) {
87f5a19343acf8ba697acc5a62bdb1a2b8c9eda3Lennart Poettering /* If the boot id matches compare monotonic time */
4b95f1798f22c1bb75295f448188560cb6ec9eceLennart Poettering /* Otherwise compare UTC time */
0eac462399c8e87bcce252cf058eba9f2678f2bdLennart Poettering /* Finally, compare by contents */
636e813dc98ea40c58c6c85bc5e7e3c9f0904ea2Lennart Poettering_pure_ static int compare_with_location(JournalFile *af, Object *ao, Location *l) {
4b95f1798f22c1bb75295f448188560cb6ec9eceLennart Poettering assert(l->type == LOCATION_DISCRETE || l->type == LOCATION_SEEK);
4b95f1798f22c1bb75295f448188560cb6ec9eceLennart Poettering sd_id128_equal(ao->entry.boot_id, l->boot_id) &&
636e813dc98ea40c58c6c85bc5e7e3c9f0904ea2Lennart Poettering le64toh(ao->entry.realtime) == l->realtime &&
4b95f1798f22c1bb75295f448188560cb6ec9eceLennart Poettering le64toh(ao->entry.xor_hash) == l->xor_hash)
4b95f1798f22c1bb75295f448188560cb6ec9eceLennart Poettering sd_id128_equal(af->header->seqnum_id, l->seqnum_id)) {
4b95f1798f22c1bb75295f448188560cb6ec9eceLennart Poettering sd_id128_equal(ao->entry.boot_id, l->boot_id)) {
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering r = journal_file_find_data_object_with_hash(f, m->data, m->size, le64toh(m->le_hash), NULL, &dp);
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering return journal_file_move_to_entry_by_offset_for_data(f, dp, after_offset, direction, ret, offset);
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering /* Find the earliest match beyond after_offset */
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering r = next_for_match(j, i, f, after_offset, direction, NULL, &cp);
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering else if (r > 0) {
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering if (np == 0 || (direction == DIRECTION_DOWN ? np > cp : np < cp))
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering /* Always jump to the next matching entry and repeat
f2f1dbe50fea13abadc9c1e845a29031b90b40f3Lennart Poettering * this until we fine and offset that matches for all
continue_looking = true;
} while (continue_looking);
if (np == 0)
if (ret)
*ret = n;
if (offset)
static int find_location_for_match(
sd_journal *j,
Match *m,
JournalFile *f,
assert(j);
assert(m);
assert(f);
if (j->current_location.seqnum_set && sd_id128_equal(j->current_location.seqnum_id, f->header->seqnum_id))
return journal_file_move_to_entry_by_seqnum_for_data(f, dp, j->current_location.seqnum, direction, ret, offset);
r = journal_file_move_to_entry_by_monotonic_for_data(f, dp, j->current_location.boot_id, j->current_location.monotonic, direction, ret, offset);
if (r != -ENOENT)
return journal_file_move_to_entry_by_realtime_for_data(f, dp, j->current_location.realtime, direction, ret, offset);
Object *n;
Match *i;
if (np == 0)
if (ret)
*ret = n;
if (offset)
Match *i;
if (!m->matches)
static int find_location_with_matches(
sd_journal *j,
JournalFile *f,
assert(j);
assert(f);
if (!j->level0) {
if (j->current_location.seqnum_set && sd_id128_equal(j->current_location.seqnum_id, f->header->seqnum_id))
r = journal_file_move_to_entry_by_monotonic(f, j->current_location.boot_id, j->current_location.monotonic, direction, ret, offset);
if (r != -ENOENT)
return journal_file_move_to_entry_by_realtime(f, j->current_location.realtime, direction, ret, offset);
static int next_with_matches(
sd_journal *j,
JournalFile *f,
Object *c;
assert(j);
assert(f);
c = *ret;
if (!j->level0)
return next_for_match(j, j->level0, f, direction == DIRECTION_DOWN ? cp+1 : cp-1, direction, ret, offset);
static int next_beyond_location(sd_journal *j, JournalFile *f, direction_t direction, Object **ret, uint64_t *offset) {
Object *c;
assert(j);
assert(f);
if (f->current_offset > 0) {
bool found;
found = k > 0;
found = k < 0;
found = true;
if (found) {
if (ret)
*ret = c;
if (offset)
Object *o;
uint64_t p;
Iterator i;
return -EINVAL;
bool found;
if (!new_file)
found = true;
found = k < 0;
found = k > 0;
if (found) {
new_file = f;
new_offset = p;
if (!new_file)
return -EINVAL;
if (skip == 0) {
skip--;
} while (skip > 0);
Object *o;
return -EINVAL;
if (!cursor)
return -EINVAL;
return -EADDRNOTAVAIL;
r = journal_file_move_to_object(j->current_file, OBJECT_ENTRY, j->current_file->current_offset, &o);
return -ENOMEM;
char *w, *state;
size_t l;
seqnum_id_set = false,
seqnum_set = false,
boot_id_set = false,
monotonic_set = false,
realtime_set = false,
xor_hash_set = false;
return -EINVAL;
return -EINVAL;
char *item;
return -EINVAL;
if (!item)
return -ENOMEM;
seqnum_id_set = true;
seqnum_set = true;
k = -EINVAL;
boot_id_set = true;
monotonic_set = true;
k = -EINVAL;
realtime_set = true;
k = -EINVAL;
xor_hash_set = true;
k = -EINVAL;
return -EINVAL;
reset_location(j);
if (realtime_set) {
if (xor_hash_set) {
char *w, *state;
size_t l;
Object *o;
return -EINVAL;
return -EINVAL;
return -EADDRNOTAVAIL;
r = journal_file_move_to_object(j->current_file, OBJECT_ENTRY, j->current_file->current_offset, &o);
unsigned long long ll;
return -EINVAL;
if (!item)
return -ENOMEM;
return -EINVAL;
return -EINVAL;
return -EINVAL;
return -EINVAL;
return -EINVAL;
reset_location(j);
return -EINVAL;
reset_location(j);
return -EINVAL;
reset_location(j);
return -EINVAL;
reset_location(j);
assert(j);
if (j->on_network)
j->on_network =
JournalFile *f;
assert(j);
if (!path)
return -ENOMEM;
j->current_invalidate_counter ++;
char *path;
JournalFile *f;
assert(j);
if (!path)
return -ENOMEM;
if (j->current_file == f) {
j->current_field = 0;
if (j->unique_file == f) {
j->unique_offset = 0;
j->current_invalidate_counter ++;
Directory *m;
assert(j);
if (!path)
return -ENOMEM;
return -errno;
return -ENOMEM;
m->is_root = false;
free(m);
return -ENOMEM;
j->current_invalidate_counter ++;
} else if (m->is_root)
if (r != 0 || !de)
r = set_put_error(j, r);
Directory *m;
assert(j);
assert(p);
return -EINVAL;
d = opendir(p);
return -errno;
return -ENOMEM;
m->is_root = true;
if (!m->path) {
free(m);
return -ENOMEM;
free(m);
return -ENOMEM;
j->current_invalidate_counter ++;
} else if (!m->is_root)
if (r != 0 || !de)
r = set_put_error(j, r);
assert(j);
if (d->wd > 0) {
if (j->inotify_fd >= 0)
if (d->is_root)
free(d);
const char search_paths[] =
assert(j);
r = add_root_directory(j, p);
if (r < 0 && r != -ENOENT) {
r = set_put_error(j, r);
assert(j);
if (j->inotify_fd < 0) {
if (j->inotify_fd < 0)
return -errno;
if (!j->directories_by_wd) {
if (!j->directories_by_wd)
return -ENOMEM;
sd_journal *j;
return NULL;
if (path) {
if (!j->path)
goto fail;
goto fail;
fail:
sd_journal_close(j);
return NULL;
sd_journal *j;
if (!ret)
return -EINVAL;
return -EINVAL;
return -ENOMEM;
r = add_search_paths(j);
goto fail;
*ret = j;
fail:
sd_journal_close(j);
sd_journal *j;
if (!ret)
return -EINVAL;
if (!path)
return -EINVAL;
if (flags != 0)
return -EINVAL;
return -ENOMEM;
set_put_error(j, r);
goto fail;
*ret = j;
fail:
sd_journal_close(j);
Directory *d;
JournalFile *f;
remove_directory(j, d);
remove_directory(j, d);
if (j->inotify_fd >= 0)
if (j->mmap)
free(j);
Object *o;
JournalFile *f;
return -EINVAL;
if (!ret)
return -EINVAL;
f = j->current_file;
return -EADDRNOTAVAIL;
if (f->current_offset <= 0)
return -EADDRNOTAVAIL;
Object *o;
JournalFile *f;
return -EINVAL;
f = j->current_file;
return -EADDRNOTAVAIL;
if (f->current_offset <= 0)
return -EADDRNOTAVAIL;
if (ret_boot_id)
return -ESTALE;
if (ret)
for (p = field; *p; p++) {
_public_ int sd_journal_get_data(sd_journal *j, const char *field, const void **data, size_t *size) {
JournalFile *f;
uint64_t i, n;
Object *o;
return -EINVAL;
if (!field)
return -EINVAL;
if (!data)
return -EINVAL;
if (!size)
return -EINVAL;
return -EINVAL;
f = j->current_file;
return -EADDRNOTAVAIL;
if (f->current_offset <= 0)
return -EADDRNOTAVAIL;
n = journal_file_entry_n_items(o);
uint64_t p, l;
size_t t;
return -EBADMSG;
#ifdef HAVE_XZ
j->data_threshold))
return -EBADMSG;
return -EPROTONOSUPPORT;
t = (size_t) l;
if ((uint64_t) t != l)
return -E2BIG;
*size = t;
return -ENOENT;
size_t t;
uint64_t l;
t = (size_t) l;
if ((uint64_t) t != l)
return -E2BIG;
#ifdef HAVE_XZ
if (!uncompress_blob(o->data.payload, l, &f->compress_buffer, &f->compress_buffer_size, &rsize, j->data_threshold))
return -EBADMSG;
return -EPROTONOSUPPORT;
*size = t;
JournalFile *f;
uint64_t p, n;
Object *o;
return -EINVAL;
if (!data)
return -EINVAL;
if (!size)
return -EINVAL;
f = j->current_file;
return -EADDRNOTAVAIL;
if (f->current_offset <= 0)
return -EADDRNOTAVAIL;
n = journal_file_entry_n_items(o);
if (j->current_field >= n)
return -EBADMSG;
j->current_field ++;
j->current_field = 0;
return -EINVAL;
if (j->inotify_fd >= 0)
return j->inotify_fd;
r = allocate_inotify(j);
if (j->path)
r = add_search_paths(j);
return j->inotify_fd;
int fd;
return -EINVAL;
if (fd < 0)
return fd;
return POLLIN;
int fd;
return -EINVAL;
if (!timeout_usec)
return -EINVAL;
if (fd < 0)
return fd;
if (!j->on_network) {
Directory *d;
assert(j);
assert(e);
set_put_error(j, r);
r = remove_directory(j, d);
} else if (d->is_root && (e->mask & IN_ISDIR) && e->len > 0 && sd_id128_from_string(e->name, &id) >= 0) {
assert(j);
bool got_something = false;
return -EINVAL;
struct inotify_event *e;
ssize_t l;
return -errno;
got_something = true;
process_inotify_event(j, e);
l -= step;
return determine_change(j);
uint64_t t;
assert(j);
if (j->inotify_fd < 0) {
r = sd_journal_get_fd(j);
return determine_change(j);
r = sd_journal_get_timeout(j, &t);
usec_t n;
timeout_usec = t;
} while (r == -EINTR);
return sd_journal_process(j);
Iterator i;
JournalFile *f;
bool first = true;
return -EINVAL;
return -EINVAL;
return -EINVAL;
if (r == -ENOENT)
if (first) {
if (from)
if (to)
*to = t;
first = false;
if (from)
if (to)
_public_ int sd_journal_get_cutoff_monotonic_usec(sd_journal *j, sd_id128_t boot_id, uint64_t *from, uint64_t *to) {
Iterator i;
JournalFile *f;
bool first = true;
return -EINVAL;
return -EINVAL;
return -EINVAL;
if (r == -ENOENT)
if (first) {
if (from)
if (to)
*to = t;
first = false;
if (from)
if (to)
Iterator i;
JournalFile *f;
bool newline = false;
assert(j);
if (newline)
newline = true;
Iterator i;
JournalFile *f;
return -EINVAL;
if (!bytes)
return -EINVAL;
return -errno;
return -EINVAL;
return -EINVAL;
return -EINVAL;
return -ENOMEM;
j->unique_field = f;
j->unique_offset = 0;
Object *o;
size_t k;
return -EINVAL;
if (!data)
return -EINVAL;
return -EINVAL;
if (!j->unique_field)
return -EINVAL;
if (!j->unique_file) {
if (!j->unique_file)
j->unique_offset = 0;
Iterator i;
const void *odata;
bool found;
if (j->unique_offset == 0) {
if (j->unique_offset == 0) {
JournalFile *n;
j->unique_file = n;
return -EBADMSG;
found = false;
found = true;
if (found)
j->unique_offset = 0;
return -EINVAL;
return !j->on_network;
const void *data;
assert(j);
const void *data;
return -EINVAL;
if (!ret)
return -EINVAL;
if (!cid)
return -ENOMEM;
return -ENOMEM;
*ret = t;
if (!ret)
return -EINVAL;
return -EINVAL;
return -EINVAL;
if (!sz)
return -EINVAL;