• 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

86.36
/src/basic/percent-util.h
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2
#pragma once
3

4
#include "forward.h"
5

6
int parse_percent_unbounded(const char *p);
7
int parse_percent(const char *p);
8

9
int parse_permille_unbounded(const char *p);
10
int parse_permille(const char *p);
11

12
int parse_permyriad_unbounded(const char *p);
13
int parse_permyriad(const char *p);
14

15
/* Some macro-like helpers that convert a percent/permille/permyriad value (as parsed by parse_percent()) to
16
 * a value relative to 100% == 2^32-1. Rounds to closest. */
17
static inline uint32_t UINT32_SCALE_FROM_PERCENT(int percent) {
303✔
18
        assert_cc(INT_MAX <= UINT32_MAX);
303✔
19

20
        return (uint32_t) (((uint64_t) CLAMP(percent, 0, 100) * UINT32_MAX + 50) / 100U);
498✔
21
}
22

23
static inline uint32_t UINT32_SCALE_FROM_PERMILLE(int permille) {
3,003✔
24
        return (uint32_t) (((uint64_t) CLAMP(permille, 0, 1000) * UINT32_MAX + 500) / 1000U);
1,002✔
25
}
26

27
static inline uint32_t UINT32_SCALE_FROM_PERMYRIAD(int permyriad) {
30,004✔
28
        return (uint32_t) (((uint64_t) CLAMP(permyriad, 0, 10000) * UINT32_MAX + 5000) / 10000U);
10,003✔
29
}
30

31
static inline int UINT32_SCALE_TO_PERCENT(uint32_t scale) {
202✔
32
        uint32_t u;
202✔
33

34
        u = (uint32_t) ((((uint64_t) scale) * 100U + UINT32_MAX/2) / UINT32_MAX);
202✔
35
        if (u > INT_MAX)
202✔
UNCOV
36
                return -ERANGE;
×
37

38
        return (int) u;
39
}
40

41
static inline int UINT32_SCALE_TO_PERMILLE(uint32_t scale) {
2,002✔
42
        uint32_t u;
2,002✔
43

44
        u = (uint32_t) ((((uint64_t) scale) * 1000U + UINT32_MAX/2) / UINT32_MAX);
2,002✔
45
        if (u > INT_MAX)
2,002✔
UNCOV
46
                return -ERANGE;
×
47

48
        return (int) u;
49
}
50

51
static inline int UINT32_SCALE_TO_PERMYRIAD(uint32_t scale) {
20,247✔
52
        uint32_t u;
20,247✔
53

54
        u = (uint32_t) ((((uint64_t) scale) * 10000U + UINT32_MAX/2) / UINT32_MAX);
20,247✔
55
        if (u > INT_MAX)
20,247✔
UNCOV
56
                return -ERANGE;
×
57

58
        return (int) u;
59
}
60

61
#define PERMYRIAD_AS_PERCENT_FORMAT_STR "%i.%02i%%"
62
#define PERMYRIAD_AS_PERCENT_FORMAT_VAL(x) ((x)/100), ((x)%100)
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