&u->job_id,
&u->job_type,
&u->job_path);
- if (r < 0) {
- log_error("Failed to parse message as unit_info.");
- return -EIO;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
return r;
}
}
}
+ if (r < 0)
+ return bus_log_parse_error(r);
+
return r;
}
&reply,
"s");
if (r < 0) {
- log_error("Failed to parse reply: %s", bus_error_message(&error, -r));
+ log_error("Failed to get ID: %s", bus_error_message(&error, -r));
return r;
}
r = sd_bus_message_read(reply, "s", &id);
- if (r < 0) {
- log_error("Failed to parse reply.");
- return r;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
times = hashmap_get(unit_times_hashmap, id);
return 0;
}
+
static int dump(sd_bus *bus, char **args) {
_cleanup_bus_message_unref_ sd_bus_message *reply = NULL;
_cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
}
r = sd_bus_message_read(reply, "s", &text);
- if (r < 0) {
- log_error("Failed to parse reply");
- return r;
- }
+ if (r < 0)
+ return bus_log_parse_error(r);
fputs(text, stdout);
return 0;
return 0;
}
-static void help(void) {
+static int help(void) {
pager_open_if_enabled();
"Process systemd profiling information.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
+ " --no-pager Do not pipe output into a pager\n"
" --system Connect to system manager\n"
" --user Connect to user manager\n"
" -H --host=[USER@]HOST Operate on remote host\n"
" --fuzz=TIMESPAN When printing the tree of the critical chain, print also\n"
" services, which finished TIMESPAN earlier, than the\n"
" latest in the branch. The unit of TIMESPAN is seconds\n"
- " unless specified with a different unit, i.e. 50ms\n"
- " --no-pager Do not pipe output into a pager\n\n"
+ " unless specified with a different unit, i.e. 50ms\n\n"
"Commands:\n"
" time Print time spent in the kernel before reaching userspace\n"
" blame Print list of running units ordered by time to init\n"
/* When updating this list, including descriptions, apply
* changes to shell-completion/bash/systemd and
* shell-completion/systemd-zsh-completion.zsh too. */
+
+ return 0;
}
static int parse_argv(int argc, char *argv[]) {
- int r;
-
enum {
ARG_VERSION = 0x100,
ARG_ORDER,
{ "to-pattern", required_argument, NULL, ARG_DOT_TO_PATTERN },
{ "fuzz", required_argument, NULL, ARG_FUZZ },
{ "no-pager", no_argument, NULL, ARG_NO_PAGER },
- { NULL, 0, NULL, 0 }
+ {}
};
+ int r, c;
+
assert(argc >= 0);
assert(argv);
- for (;;) {
- switch (getopt_long(argc, argv, "hH:M:", options, NULL)) {
+ while ((c = getopt_long(argc, argv, "hH:M:", options, NULL)) >= 0) {
+
+ switch (c) {
case 'h':
- help();
- return 0;
+ return help();
case ARG_VERSION:
puts(PACKAGE_STRING);
arg_host = optarg;
break;
- case -1:
- return 1;
-
case '?':
return -EINVAL;
assert_not_reached("Unhandled option");
}
}
+
+ return 1;
}
int main(int argc, char *argv[]) {