diff options
-rw-r--r-- | src/core/automount.c | 4 | ||||
-rw-r--r-- | src/core/busname.c | 12 | ||||
-rw-r--r-- | src/core/execute.c | 2 | ||||
-rw-r--r-- | src/core/service.c | 30 | ||||
-rw-r--r-- | src/core/socket.c | 28 | ||||
-rw-r--r-- | src/core/swap.c | 2 | ||||
-rw-r--r-- | src/core/timer.c | 2 | ||||
-rw-r--r-- | src/core/unit.c | 8 | ||||
-rw-r--r-- | src/sysv-generator/sysv-generator.c | 2 |
9 files changed, 45 insertions, 45 deletions
diff --git a/src/core/automount.c b/src/core/automount.c index f874951f4c..3f34a2895f 100644 --- a/src/core/automount.c +++ b/src/core/automount.c @@ -422,7 +422,7 @@ int automount_send_ready(Automount *a, int status) { return ioctl_fd; if (status) - log_unit_debug(UNIT(a)->id, "Sending failure: %s", strerror(-status)); + log_unit_debug_errno(UNIT(a)->id, status, "Sending failure: %m"); else log_unit_debug(UNIT(a)->id, "Sending success."); @@ -770,7 +770,7 @@ static int automount_dispatch_io(sd_event_source *s, int fd, uint32_t events, vo r = set_put(a->tokens, UINT_TO_PTR(packet.v5_packet.wait_queue_token)); if (r < 0) { - log_unit_error(UNIT(a)->id, "Failed to remember token: %s", strerror(-r)); + log_unit_error_errno(UNIT(a)->id, r, "Failed to remember token: %m"); goto fail; } diff --git a/src/core/busname.c b/src/core/busname.c index 8e9d1cfb7f..6a0aef8d1f 100644 --- a/src/core/busname.c +++ b/src/core/busname.c @@ -284,7 +284,7 @@ static int busname_watch_fd(BusName *n) { else r = sd_event_add_io(UNIT(n)->manager->event, &n->starter_event_source, n->starter_fd, EPOLLIN, busname_dispatch_io, n); if (r < 0) { - log_unit_warning(UNIT(n)->id, "Failed to watch starter fd: %s", strerror(-r)); + log_unit_warning_errno(UNIT(n)->id, r, "Failed to watch starter fd: %m"); busname_unwatch_fd(n); return r; } @@ -453,14 +453,14 @@ static void busname_enter_signal(BusName *n, BusNameState state, BusNameResult f n->control_pid, false); if (r < 0) { - log_unit_warning(UNIT(n)->id, "%s failed to kill control process: %s", UNIT(n)->id, strerror(-r)); + log_unit_warning_errno(UNIT(n)->id, r, "%s failed to kill control process: %m", UNIT(n)->id); goto fail; } if (r > 0) { r = busname_arm_timer(n); if (r < 0) { - log_unit_warning(UNIT(n)->id, "%s failed to arm timer: %s", UNIT(n)->id, strerror(-r)); + log_unit_warning_errno(UNIT(n)->id, r, "%s failed to arm timer: %m", UNIT(n)->id); goto fail; } @@ -484,7 +484,7 @@ static void busname_enter_listening(BusName *n) { if (n->activating) { r = busname_watch_fd(n); if (r < 0) { - log_unit_warning(UNIT(n)->id, "%s failed to watch names: %s", UNIT(n)->id, strerror(-r)); + log_unit_warning_errno(UNIT(n)->id, r, "%s failed to watch names: %m", UNIT(n)->id); goto fail; } @@ -515,7 +515,7 @@ static void busname_enter_making(BusName *n) { r = busname_make_starter(n, &n->control_pid); if (r < 0) { - log_unit_warning(UNIT(n)->id, "%s failed to fork 'making' task: %s", UNIT(n)->id, strerror(-r)); + log_unit_warning_errno(UNIT(n)->id, r, "%s failed to fork 'making' task: %m", UNIT(n)->id); goto fail; } @@ -526,7 +526,7 @@ static void busname_enter_making(BusName *n) { r = bus_kernel_make_starter(n->starter_fd, n->name, n->activating, n->accept_fd, NULL, n->policy_world); if (r < 0) { - log_unit_warning(UNIT(n)->id, "%s failed to make starter: %s", UNIT(n)->id, strerror(-r)); + log_unit_warning_errno(UNIT(n)->id, r, "%s failed to make starter: %m", UNIT(n)->id); goto fail; } diff --git a/src/core/execute.c b/src/core/execute.c index 0f5152fb81..f9011cfef5 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -1550,7 +1550,7 @@ static int exec_child(ExecCommand *command, context->mount_flags); if (err == -EPERM) - log_unit_warning(params->unit_id, "Failed to set up file system namespace due to lack of privileges. Execution sandbox will not be in effect: %s", strerror(-err)); + log_unit_warning_errno(params->unit_id, err, "Failed to set up file system namespace due to lack of privileges. Execution sandbox will not be in effect: %m"); else if (err < 0) { *error = EXIT_NAMESPACE; return err; diff --git a/src/core/service.c b/src/core/service.c index a55be8f3ac..9db773b399 100644 --- a/src/core/service.c +++ b/src/core/service.c @@ -209,7 +209,7 @@ static void service_start_watchdog(Service *s) { if (s->watchdog_event_source) { r = sd_event_source_set_time(s->watchdog_event_source, s->watchdog_timestamp.monotonic + s->watchdog_usec); if (r < 0) { - log_unit_warning(UNIT(s)->id, "%s failed to reset watchdog timer: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to reset watchdog timer: %m", UNIT(s)->id); return; } @@ -222,7 +222,7 @@ static void service_start_watchdog(Service *s) { s->watchdog_timestamp.monotonic + s->watchdog_usec, 0, service_dispatch_watchdog, s); if (r < 0) { - log_unit_warning(UNIT(s)->id, "%s failed to add watchdog timer: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to add watchdog timer: %m", UNIT(s)->id); return; } @@ -232,7 +232,7 @@ static void service_start_watchdog(Service *s) { } if (r < 0) - log_unit_warning(UNIT(s)->id, "%s failed to install watchdog timer: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to install watchdog timer: %m", UNIT(s)->id); } static void service_reset_watchdog(Service *s) { @@ -578,7 +578,7 @@ static int service_load_pid_file(Service *s, bool may_warn) { r = parse_pid(k, &pid); if (r < 0) { if (may_warn) - log_unit_info(UNIT(s)->id, "Failed to read PID from file %s: %s", s->pid_file, strerror(-r)); + log_unit_info_errno(UNIT(s)->id, r, "Failed to read PID from file %s: %m", s->pid_file); return r; } @@ -1130,7 +1130,7 @@ static void service_enter_dead(Service *s, ServiceResult f, bool allow_restart) return; fail: - log_unit_warning(UNIT(s)->id, "%s failed to run install restart timer: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to run install restart timer: %m", UNIT(s)->id); service_enter_dead(s, SERVICE_FAILURE_RESOURCES, false); } @@ -1167,7 +1167,7 @@ static void service_enter_stop_post(Service *s, ServiceResult f) { return; fail: - log_unit_warning(UNIT(s)->id, "%s failed to run 'stop-post' task: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to run 'stop-post' task: %m", UNIT(s)->id); service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES); } @@ -1213,7 +1213,7 @@ static void service_enter_signal(Service *s, ServiceState state, ServiceResult f return; fail: - log_unit_warning(UNIT(s)->id, "%s failed to kill processes: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to kill processes: %m", UNIT(s)->id); if (state == SERVICE_STOP_SIGTERM || state == SERVICE_STOP_SIGKILL || state == SERVICE_STOP_SIGABRT) @@ -1268,7 +1268,7 @@ static void service_enter_stop(Service *s, ServiceResult f) { return; fail: - log_unit_warning(UNIT(s)->id, "%s failed to run 'stop' task: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to run 'stop' task: %m", UNIT(s)->id); service_enter_signal(s, SERVICE_STOP_SIGTERM, SERVICE_FAILURE_RESOURCES); } @@ -1330,7 +1330,7 @@ static void service_enter_start_post(Service *s) { return; fail: - log_unit_warning(UNIT(s)->id, "%s failed to run 'start-post' task: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to run 'start-post' task: %m", UNIT(s)->id); service_enter_stop(s, SERVICE_FAILURE_RESOURCES); } @@ -1423,7 +1423,7 @@ static void service_enter_start(Service *s) { return; fail: - log_unit_warning(UNIT(s)->id, "%s failed to run 'start' task: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to run 'start' task: %m", UNIT(s)->id); service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES); } @@ -1461,7 +1461,7 @@ static void service_enter_start_pre(Service *s) { return; fail: - log_unit_warning(UNIT(s)->id, "%s failed to run 'start-pre' task: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to run 'start-pre' task: %m", UNIT(s)->id); service_enter_dead(s, SERVICE_FAILURE_RESOURCES, true); } @@ -1541,7 +1541,7 @@ static void service_enter_reload(Service *s) { return; fail: - log_unit_warning(UNIT(s)->id, "%s failed to run 'reload' task: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to run 'reload' task: %m", UNIT(s)->id); s->reload_result = SERVICE_FAILURE_RESOURCES; service_enter_running(s, SERVICE_SUCCESS); } @@ -1574,7 +1574,7 @@ static void service_run_next_control(Service *s) { return; fail: - log_unit_warning(UNIT(s)->id, "%s failed to run next control task: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to run next control task: %m", UNIT(s)->id); if (s->state == SERVICE_START_PRE) service_enter_signal(s, SERVICE_FINAL_SIGTERM, SERVICE_FAILURE_RESOURCES); @@ -1618,7 +1618,7 @@ static void service_run_next_main(Service *s) { return; fail: - log_unit_warning(UNIT(s)->id, "%s failed to run next main task: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to run next main task: %m", UNIT(s)->id); service_enter_stop(s, SERVICE_FAILURE_RESOURCES); } @@ -2031,7 +2031,7 @@ static int service_watch_pid_file(Service *s) { return 0; fail: - log_unit_error(UNIT(s)->id, "Failed to set a watch for %s's PID file %s: %s", UNIT(s)->id, s->pid_file_pathspec->path, strerror(-r)); + log_unit_error_errno(UNIT(s)->id, r, "Failed to set a watch for %s's PID file %s: %m", UNIT(s)->id, s->pid_file_pathspec->path); service_unwatch_pid_file(s); return r; } diff --git a/src/core/socket.c b/src/core/socket.c index 8f87ef2e8e..828ed31077 100644 --- a/src/core/socket.c +++ b/src/core/socket.c @@ -925,13 +925,13 @@ static void socket_apply_socket_options(Socket *s, int fd) { if (s->smack_ip_in) { r = mac_smack_apply_ip_in_fd(fd, s->smack_ip_in); if (r < 0) - log_unit_error(UNIT(s)->id, "mac_smack_apply_ip_in_fd: %s", strerror(-r)); + log_unit_error_errno(UNIT(s)->id, r, "mac_smack_apply_ip_in_fd: %m"); } if (s->smack_ip_out) { r = mac_smack_apply_ip_out_fd(fd, s->smack_ip_out); if (r < 0) - log_unit_error(UNIT(s)->id, "mac_smack_apply_ip_out_fd: %s", strerror(-r)); + log_unit_error_errno(UNIT(s)->id, r, "mac_smack_apply_ip_out_fd: %m"); } } @@ -948,7 +948,7 @@ static void socket_apply_fifo_options(Socket *s, int fd) { if (s->smack) { r = mac_smack_apply_fd(fd, s->smack); if (r < 0) - log_unit_error(UNIT(s)->id, "mac_smack_apply_fd: %s", strerror(-r)); + log_unit_error_errno(UNIT(s)->id, r, "mac_smack_apply_fd: %m"); } } @@ -1269,7 +1269,7 @@ static int socket_watch_fds(Socket *s) { r = sd_event_add_io(UNIT(s)->manager->event, &p->event_source, p->fd, EPOLLIN, socket_dispatch_io, p); if (r < 0) { - log_unit_warning(UNIT(s)->id, "Failed to watch listening fds: %s", strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "Failed to watch listening fds: %m"); goto fail; } } @@ -1605,7 +1605,7 @@ static void socket_enter_signal(Socket *s, SocketState state, SocketResult f) { return; fail: - log_unit_warning(UNIT(s)->id, "%s failed to kill processes: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to kill processes: %m", UNIT(s)->id); if (state == SOCKET_STOP_PRE_SIGTERM || state == SOCKET_STOP_PRE_SIGKILL) socket_enter_stop_post(s, SOCKET_FAILURE_RESOURCES); @@ -1636,7 +1636,7 @@ static void socket_enter_stop_pre(Socket *s, SocketResult f) { return; fail: - log_unit_warning(UNIT(s)->id, "%s failed to run 'stop-pre' task: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to run 'stop-pre' task: %m", UNIT(s)->id); socket_enter_stop_post(s, SOCKET_FAILURE_RESOURCES); } @@ -1646,7 +1646,7 @@ static void socket_enter_listening(Socket *s) { r = socket_watch_fds(s); if (r < 0) { - log_unit_warning(UNIT(s)->id, "%s failed to watch sockets: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to watch sockets: %m", UNIT(s)->id); goto fail; } @@ -1668,7 +1668,7 @@ static void socket_enter_start_post(Socket *s) { if (s->control_command) { r = socket_spawn(s, s->control_command, &s->control_pid); if (r < 0) { - log_unit_warning(UNIT(s)->id, "%s failed to run 'start-post' task: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to run 'start-post' task: %m", UNIT(s)->id); goto fail; } @@ -1689,7 +1689,7 @@ static void socket_enter_start_chown(Socket *s) { r = socket_open_fds(s); if (r < 0) { - log_unit_warning(UNIT(s)->id, "%s failed to listen on sockets: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to listen on sockets: %m", UNIT(s)->id); goto fail; } @@ -1701,7 +1701,7 @@ static void socket_enter_start_chown(Socket *s) { r = socket_chown(s, &s->control_pid); if (r < 0) { - log_unit_warning(UNIT(s)->id, "%s failed to fork 'start-chown' task: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to fork 'start-chown' task: %m", UNIT(s)->id); goto fail; } @@ -1726,7 +1726,7 @@ static void socket_enter_start_pre(Socket *s) { if (s->control_command) { r = socket_spawn(s, s->control_command, &s->control_pid); if (r < 0) { - log_unit_warning(UNIT(s)->id, "%s failed to run 'start-pre' task: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to run 'start-pre' task: %m", UNIT(s)->id); goto fail; } @@ -1760,14 +1760,14 @@ static void socket_enter_running(Socket *s, int cfd) { r = socket_open_fds(s); if (r < 0) { - log_unit_warning(UNIT(s)->id, "%s failed to listen on sockets: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to listen on sockets: %m", UNIT(s)->id); socket_enter_stop_pre(s, SOCKET_FAILURE_RESOURCES); return; } r = socket_watch_fds(s); if (r < 0) { - log_unit_warning(UNIT(s)->id, "%s failed to watch sockets: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to watch sockets: %m", UNIT(s)->id); socket_enter_stop_pre(s, SOCKET_FAILURE_RESOURCES); } } @@ -1894,7 +1894,7 @@ static void socket_run_next(Socket *s) { return; fail: - log_unit_warning(UNIT(s)->id, "%s failed to run next task: %s", UNIT(s)->id, strerror(-r)); + log_unit_warning_errno(UNIT(s)->id, r, "%s failed to run next task: %m", UNIT(s)->id); if (s->state == SOCKET_START_POST) socket_enter_stop_pre(s, SOCKET_FAILURE_RESOURCES); diff --git a/src/core/swap.c b/src/core/swap.c index e41d77aa54..346a5fd712 100644 --- a/src/core/swap.c +++ b/src/core/swap.c @@ -410,7 +410,7 @@ static int swap_add_one( return 0; fail: - log_unit_warning(e, "Failed to load swap unit: %s", strerror(-r)); + log_unit_warning_errno(e, r, "Failed to load swap unit: %m"); if (delete && u) unit_free(u); diff --git a/src/core/timer.c b/src/core/timer.c index 762453880f..fc474f78ea 100644 --- a/src/core/timer.c +++ b/src/core/timer.c @@ -485,7 +485,7 @@ static void timer_enter_waiting(Timer *t, bool initial) { return; fail: - log_unit_warning(UNIT(t)->id, "%s failed to enter waiting state: %s", UNIT(t)->id, strerror(-r)); + log_unit_warning_errno(UNIT(t)->id, r, "%s failed to enter waiting state: %m", UNIT(t)->id); timer_enter_dead(t, TIMER_FAILURE_RESOURCES); } diff --git a/src/core/unit.c b/src/core/unit.c index 88cddbd023..9df398ad4e 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -1726,7 +1726,7 @@ void unit_start_on_failure(Unit *u) { r = manager_add_job(u->manager, JOB_START, other, u->on_failure_job_mode, true, NULL, NULL); if (r < 0) - log_unit_error(u->id, "Failed to enqueue OnFailure= job: %s", strerror(-r)); + log_unit_error_errno(u->id, r, "Failed to enqueue OnFailure= job: %m"); } } @@ -3435,7 +3435,7 @@ int unit_kill_context( _cleanup_free_ char *comm = NULL; get_process_comm(main_pid, &comm); - log_unit_warning(u->id, "Failed to kill main process " PID_FMT " (%s): %s", main_pid, strna(comm), strerror(-r)); + log_unit_warning_errno(u->id, r, "Failed to kill main process " PID_FMT " (%s): %m", main_pid, strna(comm)); } else { if (!main_pid_alien) wait_for_exit = true; @@ -3452,7 +3452,7 @@ int unit_kill_context( _cleanup_free_ char *comm = NULL; get_process_comm(control_pid, &comm); - log_unit_warning(u->id, "Failed to kill control process " PID_FMT " (%s): %s", control_pid, strna(comm), strerror(-r)); + log_unit_warning_errno(u->id, r, "Failed to kill control process " PID_FMT " (%s): %m", control_pid, strna(comm)); } else { wait_for_exit = true; @@ -3472,7 +3472,7 @@ int unit_kill_context( r = cg_kill_recursive(SYSTEMD_CGROUP_CONTROLLER, u->cgroup_path, sig, true, true, false, pid_set); if (r < 0) { if (r != -EAGAIN && r != -ESRCH && r != -ENOENT) - log_unit_warning(u->id, "Failed to kill control group: %s", strerror(-r)); + log_unit_warning_errno(u->id, r, "Failed to kill control group: %m"); } else if (r > 0) { /* FIXME: For now, we will not wait for the diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c index 4328469909..5ff621d1fa 100644 --- a/src/sysv-generator/sysv-generator.c +++ b/src/sysv-generator/sysv-generator.c @@ -193,7 +193,7 @@ static int generate_unit_file(SysvStub *s) { STRV_FOREACH(p, s->wanted_by) { r = add_symlink(s->name, *p); if (r < 0) - log_unit_error(s->name, "Failed to create 'Wants' symlink to %s: %s", *p, strerror(-r)); + log_unit_error_errno(s->name, r, "Failed to create 'Wants' symlink to %s: %m", *p); } return 0; |