chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bus-proxy: also consider ENOTCONN a clean termination condition
[elogind.git]
/
src
/
journal
/
sd-journal.c
diff --git
a/src/journal/sd-journal.c
b/src/journal/sd-journal.c
index 89cab3733128d351901690b2a9d8c45f71dabcbb..94891cdf35b16b6aad570e2150fa81fb2c7a4643 100644
(file)
--- a/
src/journal/sd-journal.c
+++ b/
src/journal/sd-journal.c
@@
-24,7
+24,7
@@
#include <stddef.h>
#include <unistd.h>
#include <sys/inotify.h>
#include <stddef.h>
#include <unistd.h>
#include <sys/inotify.h>
-#include <
sys/
poll.h>
+#include <poll.h>
#include <sys/vfs.h>
#include <linux/magic.h>
#include <sys/vfs.h>
#include <linux/magic.h>
@@
-43,7
+43,7
@@
#include "replace-var.h"
#include "fileio.h"
#include "replace-var.h"
#include "fileio.h"
-#define JOURNAL_FILES_MAX
1024
+#define JOURNAL_FILES_MAX
7168
#define JOURNAL_FILES_RECHECK_USEC (2 * USEC_PER_SEC)
#define JOURNAL_FILES_RECHECK_USEC (2 * USEC_PER_SEC)
@@
-723,13
+723,13
@@
static int next_beyond_location(sd_journal *j, JournalFile *f, direction_t direc
assert(j);
assert(f);
assert(j);
assert(f);
- /* If we hit EOF before, recheck if any new entries arrived. */
- n_entries = le64toh(f->header->n_entries);
- if (f->location_type == LOCATION_TAIL && n_entries == f->last_n_entries)
- return 0;
- f->last_n_entries = n_entries;
-
if (f->last_direction == direction && f->current_offset > 0) {
if (f->last_direction == direction && f->current_offset > 0) {
+ /* If we hit EOF before, recheck if any new entries arrived. */
+ n_entries = le64toh(f->header->n_entries);
+ if (f->location_type == LOCATION_TAIL && n_entries == f->last_n_entries)
+ return 0;
+ f->last_n_entries = n_entries;
+
/* LOCATION_SEEK here means we did the work in a previous
* iteration and the current location already points to a
* candidate entry. */
/* LOCATION_SEEK here means we did the work in a previous
* iteration and the current location already points to a
* candidate entry. */
@@
-1155,9
+1155,9
@@
static void check_network(sd_journal *j, int fd) {
static bool file_has_type_prefix(const char *prefix, const char *filename) {
const char *full, *tilded, *atted;
static bool file_has_type_prefix(const char *prefix, const char *filename) {
const char *full, *tilded, *atted;
- full = str
append
a(prefix, ".journal");
- tilded = str
append
a(full, "~");
- atted = str
append
a(prefix, "@");
+ full = str
join
a(prefix, ".journal");
+ tilded = str
join
a(full, "~");
+ atted = str
join
a(prefix, "@");
return streq(filename, full) ||
streq(filename, tilded) ||
return streq(filename, full) ||
streq(filename, tilded) ||
@@
-1178,8
+1178,7
@@
static bool file_type_wanted(int flags, const char *filename) {
if (flags & SD_JOURNAL_CURRENT_USER) {
char prefix[5 + DECIMAL_STR_MAX(uid_t) + 1];
if (flags & SD_JOURNAL_CURRENT_USER) {
char prefix[5 + DECIMAL_STR_MAX(uid_t) + 1];
- assert_se(snprintf(prefix, sizeof(prefix), "user-"UID_FMT, getuid())
- < (int) sizeof(prefix));
+ xsprintf(prefix, "user-"UID_FMT, getuid());
if (file_has_type_prefix(prefix, filename))
return true;
if (file_has_type_prefix(prefix, filename))
return true;
@@
-1400,7
+1399,7
@@
static int add_root_directory(sd_journal *j, const char *p) {
return -EINVAL;
if (j->prefix)
return -EINVAL;
if (j->prefix)
- p = str
append
a(j->prefix, p);
+ p = str
join
a(j->prefix, p);
d = opendir(p);
if (!d)
d = opendir(p);
if (!d)
@@
-1644,7
+1643,7
@@
_public_ int sd_journal_open_container(sd_journal **ret, const char *machine, in
assert_return((flags & ~(SD_JOURNAL_LOCAL_ONLY|SD_JOURNAL_SYSTEM)) == 0, -EINVAL);
assert_return(machine_name_is_valid(machine), -EINVAL);
assert_return((flags & ~(SD_JOURNAL_LOCAL_ONLY|SD_JOURNAL_SYSTEM)) == 0, -EINVAL);
assert_return(machine_name_is_valid(machine), -EINVAL);
- p = str
append
a("/run/systemd/machines/", machine);
+ p = str
join
a("/run/systemd/machines/", machine);
r = parse_env_file(p, NEWLINE, "ROOT", &root, "CLASS", &class, NULL);
if (r == -ENOENT)
return -EHOSTDOWN;
r = parse_env_file(p, NEWLINE, "ROOT", &root, "CLASS", &class, NULL);
if (r == -ENOENT)
return -EHOSTDOWN;
@@
-2188,11
+2187,11
@@
_public_ int sd_journal_process(sd_journal *j) {
j->last_process_usec = now(CLOCK_MONOTONIC);
for (;;) {
j->last_process_usec = now(CLOCK_MONOTONIC);
for (;;) {
- u
int8_t buffer[INOTIFY_EVENT_MAX] _alignas_(struct inotify_event)
;
+ u
nion inotify_event_buffer buffer
;
struct inotify_event *e;
ssize_t l;
struct inotify_event *e;
ssize_t l;
- l = read(j->inotify_fd, buffer, sizeof(buffer));
+ l = read(j->inotify_fd,
&
buffer, sizeof(buffer));
if (l < 0) {
if (errno == EAGAIN || errno == EINTR)
return got_something ? determine_change(j) : SD_JOURNAL_NOP;
if (l < 0) {
if (errno == EAGAIN || errno == EINTR)
return got_something ? determine_change(j) : SD_JOURNAL_NOP;