fork-journal: some follow-ups (#37423)
This commit is contained in:
@@ -35,8 +35,8 @@ typedef struct Context {
|
||||
static void context_done(Context *c) {
|
||||
assert(c);
|
||||
|
||||
c->synchronize_varlink = sd_varlink_flush_close_unref(c->synchronize_varlink);
|
||||
c->event = sd_event_unref(c->event);
|
||||
sd_varlink_flush_close_unref(c->synchronize_varlink);
|
||||
sd_event_unref(c->event);
|
||||
sd_journal_close(c->journal);
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ static int on_first_event(sd_event_source *s, void *userdata) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (arg_follow && !arg_reverse && !arg_cursor && !arg_after_cursor && !arg_cursor_file && !arg_since_set) {
|
||||
if (arg_follow && !arg_reverse && !c->has_cursor && !arg_since_set) {
|
||||
r = sd_journal_get_cursor(c->journal, /* ret_cursor= */ NULL);
|
||||
if (r == -EADDRNOTAVAIL) {
|
||||
/* If we shall operate in --follow mode, and we are unable to get a cursor after
|
||||
@@ -350,8 +350,10 @@ static int on_synchronize_reply(
|
||||
|
||||
assert(vl);
|
||||
|
||||
if (error_id)
|
||||
if (error_id) {
|
||||
log_warning("Failed to synchronize on Journal, ignoring: %s", error_id);
|
||||
(void) sd_notifyf(/* unset_environment= */ false, "VARLINKERROR=%s", error_id);
|
||||
}
|
||||
|
||||
r = show_and_fflush(c);
|
||||
if (r < 0)
|
||||
@@ -377,7 +379,7 @@ static int on_signal(sd_event_source *s, const struct signalfd_siginfo *si, void
|
||||
|
||||
r = varlink_connect_journal(&vl);
|
||||
if (r < 0) {
|
||||
log_error_errno(r, "Failed to connect to Journal Varlink IPC interface, ignoring: %m");
|
||||
log_error_errno(r, "Failed to connect to Journal Varlink IPC interface, skipping synchronization: %m");
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ SyncReq* sync_req_free(SyncReq *req) {
|
||||
LIST_REMOVE(pending_rqlen, req->manager->sync_req_pending_rqlen, req);
|
||||
}
|
||||
|
||||
req->idle_event_source = sd_event_source_disable_unref(req->idle_event_source);
|
||||
sd_event_source_disable_unref(req->idle_event_source);
|
||||
|
||||
sd_varlink_unref(req->link);
|
||||
|
||||
|
||||
+1
-1
@@ -2438,7 +2438,7 @@ static int start_transient_service(sd_bus *bus) {
|
||||
|
||||
_cleanup_(journal_terminate) PidRef journal_pid = PIDREF_NULL;
|
||||
if (arg_verbose)
|
||||
(void) journal_fork(arg_runtime_scope, (const char**) STRV_MAKE(c.unit), &journal_pid);
|
||||
(void) journal_fork(arg_runtime_scope, STRV_MAKE(c.unit), &journal_pid);
|
||||
|
||||
r = bus_call_with_hint(bus, m, "service", &reply);
|
||||
if (r < 0)
|
||||
|
||||
@@ -87,7 +87,7 @@ static int on_child_notify(sd_event_source *s, int fd, uint32_t revents, void *u
|
||||
return 0;
|
||||
}
|
||||
|
||||
int journal_fork(RuntimeScope scope, const char * const *units, PidRef *ret_pidref) {
|
||||
int journal_fork(RuntimeScope scope, char * const *units, PidRef *ret_pidref) {
|
||||
int r;
|
||||
|
||||
assert(scope >= 0);
|
||||
@@ -97,7 +97,7 @@ int journal_fork(RuntimeScope scope, const char * const *units, PidRef *ret_pidr
|
||||
if (!is_main_thread())
|
||||
return -EPERM;
|
||||
|
||||
if (strv_isempty((char**) units))
|
||||
if (strv_isempty(units))
|
||||
return 0;
|
||||
|
||||
_cleanup_(sd_event_unrefp) sd_event *event = NULL;
|
||||
@@ -162,7 +162,7 @@ int journal_fork(RuntimeScope scope, const char * const *units, PidRef *ret_pidr
|
||||
_exit(EXIT_MEMORY);
|
||||
}
|
||||
|
||||
r = invoke_callout_binary(argv[0], (char**) argv);
|
||||
r = invoke_callout_binary(argv[0], argv);
|
||||
log_debug_errno(r, "Failed to invoke journalctl: %m");
|
||||
_exit(EXIT_EXEC);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@
|
||||
#include "runtime-scope.h"
|
||||
#include "set.h"
|
||||
|
||||
int journal_fork(RuntimeScope scope, const char * const *units, PidRef *ret_pidref);
|
||||
int journal_fork(RuntimeScope scope, char * const *units, PidRef *ret_pidref);
|
||||
|
||||
void journal_terminate(PidRef *pidref);
|
||||
|
||||
@@ -394,7 +394,7 @@ int verb_start(int argc, char *argv[], void *userdata) {
|
||||
ret = enqueue_marked_jobs(bus, w);
|
||||
else {
|
||||
if (arg_verbose)
|
||||
(void) journal_fork(arg_runtime_scope, (const char**) names, &journal_pid);
|
||||
(void) journal_fork(arg_runtime_scope, names, &journal_pid);
|
||||
|
||||
STRV_FOREACH(name, names) {
|
||||
_cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
|
||||
|
||||
Reference in New Issue
Block a user