• 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

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

3
#include <fcntl.h>
4
#include <sys/stat.h>
5

6
#include "dirent-util.h"
7
#include "path-util.h"
8
#include "string-util.h"
9

10
int dirent_ensure_type(int dir_fd, struct dirent *de) {
10,243,997✔
11
        struct statx sx;
10,243,997✔
12

13
        assert(dir_fd >= 0);
10,243,997✔
14
        assert(de);
10,243,997✔
15

16
        if (de->d_type != DT_UNKNOWN)
10,243,997✔
17
                return 0;
10,243,997✔
18

19
        if (dot_or_dot_dot(de->d_name)) {
2✔
20
                de->d_type = DT_DIR;
1✔
21
                return 0;
1✔
22
        }
23

24
        /* Let's ask only for the type, nothing else. */
25
        if (statx(dir_fd, de->d_name, AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT, STATX_TYPE, &sx) < 0)
1✔
26
                return -errno;
1✔
27

UNCOV
28
        assert(FLAGS_SET(sx.stx_mask, STATX_TYPE));
×
29
        de->d_type = IFTODT(sx.stx_mode);
×
30

31
        /* If the inode is passed too, update the field, i.e. report most recent data */
UNCOV
32
        if (FLAGS_SET(sx.stx_mask, STATX_INO))
×
33
                de->d_ino = sx.stx_ino;
×
34

35
        return 0;
36
}
37

38
bool dirent_is_file(const struct dirent *de) {
16,743✔
39
        assert(de);
16,743✔
40

41
        if (!IN_SET(de->d_type, DT_REG, DT_LNK, DT_UNKNOWN))
16,743✔
42
                return false;
43

44
        if (hidden_or_backup_file(de->d_name))
14,320✔
45
                return false;
5✔
46

47
        return true;
48
}
49

50
bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix) {
12✔
51
        assert(de);
12✔
52

53
        if (!IN_SET(de->d_type, DT_REG, DT_LNK, DT_UNKNOWN))
12✔
54
                return false;
55

56
        if (de->d_name[0] == '.')
11✔
57
                return false;
58

59
        if (!suffix)
9✔
60
                return true;
61

62
        return endswith(de->d_name, suffix);
6✔
63
}
64

65
struct dirent *readdir_ensure_type(DIR *d) {
10,950,039✔
66
        int r;
10,950,039✔
67

68
        assert(d);
10,950,039✔
69

70
        /* Like readdir(), but fills in .d_type if it is DT_UNKNOWN */
71

72
        for (;;) {
10,950,039✔
73
                struct dirent *de;
10,950,039✔
74

75
                errno = 0;
10,950,039✔
76
                de = readdir(d);
10,950,039✔
77
                if (!de)
10,950,039✔
78
                        return NULL;
79

80
                r = dirent_ensure_type(dirfd(d), de);
10,243,756✔
81
                if (r >= 0)
10,243,756✔
82
                        return de;
UNCOV
83
                if (r != -ENOENT) {
×
84
                        errno = -r; /* We want to be compatible with readdir(), hence propagate error via errno here */
×
85
                        return NULL;
×
86
                }
87

88
                /* Vanished by now? Then skip immediately to next */
89
        }
90
}
91

92
struct dirent *readdir_no_dot(DIR *d) {
82,459✔
93
        assert(d);
82,459✔
94

95
        for (;;) {
107,379✔
96
                struct dirent *de;
107,379✔
97

98
                de = readdir_ensure_type(d);
107,379✔
99
                if (!de || !dot_or_dot_dot(de->d_name))
107,379✔
100
                        return de;
82,459✔
101
        }
102
}
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