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

systemd / systemd / 15263807472

26 May 2025 08:53PM UTC coverage: 72.046% (-0.002%) from 72.048%
15263807472

push

github

yuwata
src/core/manager.c: log preset activity on first boot

This gives us a little more information about what units were enabled
or disabled on that first boot and will be useful for OS developers
tracking down the source of unit state.

An example with this enabled looks like:

```
NET: Registered PF_VSOCK protocol family
systemd[1]: Applying preset policy.
systemd[1]: Unit /etc/systemd/system/dnsmasq.service is masked, ignoring.
systemd[1]: Unit /etc/systemd/system/systemd-repart.service is masked, ignoring.
systemd[1]: Removed '/etc/systemd/system/sockets.target.wants/systemd-resolved-monitor.socket'.
systemd[1]: Removed '/etc/systemd/system/sockets.target.wants/systemd-resolved-varlink.socket'.
systemd[1]: Created symlink '/etc/systemd/system/multi-user.target.wants/var-mnt-workdir.mount' → '/etc/systemd/system/var-mnt-workdir.mount'.
systemd[1]: Created symlink '/etc/systemd/system/multi-user.target.wants/var-mnt-workdir\x2dtmp.mount' → '/etc/systemd/system/var-mnt-workdir\x2dtmp.mount'.
systemd[1]: Created symlink '/etc/systemd/system/afterburn-sshkeys.target.requires/afterburn-sshkeys@core.service' → '/usr/lib/systemd/system/afterburn-sshkeys@.service'.
systemd[1]: Created symlink '/etc/systemd/system/sockets.target.wants/systemd-resolved-varlink.socket' → '/usr/lib/systemd/system/systemd-resolved-varlink.socket'.
systemd[1]: Created symlink '/etc/systemd/system/sockets.target.wants/systemd-resolved-monitor.socket' → '/usr/lib/systemd/system/systemd-resolved-monitor.socket'.
systemd[1]: Populated /etc with preset unit settings.
```

Considering it only happens on first boot and not on every boot I think
the extra information is worth the extra verbosity in the logs just for
that boot.

5 of 6 new or added lines in 1 file covered. (83.33%)

5463 existing lines in 165 files now uncovered.

299151 of 415222 relevant lines covered (72.05%)

702386.45 hits per line

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

97.14
/src/basic/dlfcn-util.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

3
#include "dlfcn-util.h"
4
#include "log.h"
5

6
void* safe_dlclose(void *dl) {
285,906✔
7
        if (!dl)
285,906✔
8
                return NULL;
9

10
        assert_se(dlclose(dl) == 0);
18,520✔
11
        return NULL;
12
}
13

14
static int dlsym_many_or_warnv(void *dl, int log_level, va_list ap) {
4,265✔
15
        void (**fn)(void);
4,265✔
16

17
        /* Tries to resolve a bunch of function symbols, and logs an error about if it cannot resolve one of
18
         * them. Note that this function possibly modifies the supplied function pointers if the whole
19
         * operation fails. */
20

21
        while ((fn = va_arg(ap, typeof(fn)))) {
73,754✔
22
                void (*tfn)(void);
69,489✔
23
                const char *symbol;
69,489✔
24

25
                symbol = va_arg(ap, typeof(symbol));
69,489✔
26

27
                tfn = (typeof(tfn)) dlsym(dl, symbol);
69,489✔
28
                if (!tfn)
69,489✔
UNCOV
29
                        return log_full_errno(log_level,
×
30
                                              SYNTHETIC_ERRNO(ELIBBAD),
31
                                              "Can't find symbol %s: %s", symbol, dlerror());
32
                *fn = tfn;
69,489✔
33
        }
34

35
        return 0;
36
}
37

38
int dlsym_many_or_warn_sentinel(void *dl, int log_level, ...) {
2,071✔
39
        va_list ap;
2,071✔
40
        int r;
2,071✔
41

42
        va_start(ap, log_level);
2,071✔
43
        r = dlsym_many_or_warnv(dl, log_level, ap);
2,071✔
44
        va_end(ap);
2,071✔
45

46
        return r;
2,071✔
47
}
48

49
int dlopen_many_sym_or_warn_sentinel(void **dlp, const char *filename, int log_level, ...) {
267,384✔
50
        _cleanup_(dlclosep) void *dl = NULL;
267,384✔
51
        int r;
267,384✔
52

53
        if (*dlp)
267,384✔
54
                return 0; /* Already loaded */
55

56
        dl = dlopen(filename, RTLD_NOW|RTLD_NODELETE);
2,261✔
57
        if (!dl)
2,261✔
58
                return log_debug_errno(SYNTHETIC_ERRNO(EOPNOTSUPP),
67✔
59
                                       "%s is not installed: %s", filename, dlerror());
60

61
        log_debug("Loaded '%s' via dlopen()", filename);
2,194✔
62

63
        va_list ap;
2,194✔
64
        va_start(ap, log_level);
2,194✔
65
        r = dlsym_many_or_warnv(dl, log_level, ap);
2,194✔
66
        va_end(ap);
2,194✔
67

68
        if (r < 0)
2,194✔
69
                return r;
70

71
        /* Note that we never release the reference here, because there's no real reason to. After all this
72
         * was traditionally a regular shared library dependency which lives forever too. */
73
        *dlp = TAKE_PTR(dl);
2,194✔
74
        return 1;
2,194✔
75
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc