• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

systemd / systemd / 23990547145

04 Apr 2026 09:30PM UTC coverage: 72.373% (+0.3%) from 72.107%
23990547145

push

github

web-flow
shutdown: enforce a minimum uptime to make boot loops less annoying (#41215)

Fixes: #9453

Split out of #41016

3 of 39 new or added lines in 2 files covered. (7.69%)

2565 existing lines in 66 files now uncovered.

319531 of 441505 relevant lines covered (72.37%)

1187721.39 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/report/report-basic-server.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

3
#include "sd-varlink.h"
4

5
#include "ansi-color.h"
6
#include "build.h"
7
#include "facts.h"
8
#include "format-table.h"
9
#include "log.h"
10
#include "main-func.h"
11
#include "options.h"
12
#include "report-basic.h"
13
#include "varlink-util.h"
14

15
static int vl_server(void) {
×
16
        _cleanup_(sd_varlink_server_unrefp) sd_varlink_server *vs = NULL;
×
17
        int r;
×
18

19
        r = varlink_server_new(&vs, /* flags= */ 0, /* userdata= */ NULL);
×
20
        if (r < 0)
×
21
                return log_error_errno(r, "Failed to allocate Varlink server: %m");
×
22

23
        r = facts_add_to_varlink_server(vs, vl_method_list_facts, vl_method_describe_facts);
×
24
        if (r < 0)
×
25
                return log_error_errno(r, "Failed to register Facts varlink interface: %m");
×
26

27
        r = sd_varlink_server_loop_auto(vs);
×
28
        if (r < 0)
×
29
                return log_error_errno(r, "Failed to run Varlink event loop: %m");
×
30

31
        return 0;
32
}
33

34
static int help(void) {
×
35
        _cleanup_(table_unrefp) Table *options = NULL;
×
36
        int r;
×
37

38
        r = option_parser_get_help_table(&options);
×
39
        if (r < 0)
×
40
                return r;
41

42
        printf("%s [OPTIONS...]\n"
×
43
               "\n%sGenerate a report describing the current system%s\n"
44
               "\n%sOptions:%s\n",
45
               program_invocation_short_name,
46
               ansi_highlight(),
47
               ansi_normal(),
48
               ansi_underline(),
49
               ansi_normal());
50

UNCOV
51
        return table_print_or_warn(options);
×
52
}
53

UNCOV
54
static int parse_argv(int argc, char *argv[]) {
×
55
        int r;
×
56

UNCOV
57
        assert(argc >= 0);
×
58
        assert(argv);
×
59

UNCOV
60
        OptionParser state = { argc, argv };
×
61

UNCOV
62
        FOREACH_OPTION(&state, c, /* ret_a= */ NULL, /* on_error= */ return c)
×
63
                switch (c) {
×
64
                OPTION_COMMON_HELP:
×
65
                        return help();
×
66

UNCOV
67
                OPTION_COMMON_VERSION:
×
68
                        return version();
×
69
                }
70

UNCOV
71
        if (state.optind < argc)
×
72
                return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
×
73
                                       "This program takes no arguments.");
74

UNCOV
75
        r = sd_varlink_invocation(SD_VARLINK_ALLOW_ACCEPT);
×
76
        if (r < 0)
×
77
                return log_error_errno(r, "Failed to check if invoked in Varlink mode: %m");
×
78
        if (r == 0)
×
79
                return log_error_errno(SYNTHETIC_ERRNO(EINVAL),
×
80
                                       "This program can only run as a Varlink service.");
81
        return 1;
82
}
83

UNCOV
84
static int run(int argc, char *argv[]) {
×
85
        int r;
×
86

UNCOV
87
        log_setup();
×
88

UNCOV
89
        r = parse_argv(argc, argv);
×
90
        if (r <= 0)
×
91
                return r;
92

UNCOV
93
        return vl_server();
×
94
}
95

UNCOV
96
DEFINE_MAIN_FUNCTION(run);
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc