• 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

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

3
#include "fd-util.h"
4
#include "inotify-util.h"
5
#include "log.h"
6
#include "memory-util.h"
7

8
bool inotify_event_next(
60,334✔
9
                union inotify_event_buffer *buffer,
10
                size_t size,
11
                struct inotify_event **iterator,
12
                int log_level) {
13

14
        struct inotify_event *e;
60,334✔
15
        size_t offset = 0;
60,334✔
16

17
        assert(buffer);
60,334✔
18
        assert(iterator);
60,334✔
19

20
        if (*iterator) {
60,334✔
21
                assert((uint8_t*) *iterator >= buffer->raw);
35,960✔
22
                offset = (uint8_t*) *iterator - buffer->raw;
35,960✔
23
                offset += offsetof(struct inotify_event, name) + (*iterator)->len;
35,960✔
24
        }
25

26
        if (size == offset)
60,334✔
27
                return false; /* reached end of list */
28

29
        if (size < offset ||
36,039✔
30
            size - offset < offsetof(struct inotify_event, name)) {
36,039✔
31
                log_full(log_level, "Received invalid inotify event, ignoring.");
×
UNCOV
32
                return false;
×
33
        }
34

35
        e = CAST_ALIGN_PTR(struct inotify_event, buffer->raw + offset);
36,039✔
36
        if (size - offset - offsetof(struct inotify_event, name) < e->len) {
36,039✔
37
                log_full(log_level, "Received invalid inotify event, ignoring.");
×
UNCOV
38
                return false;
×
39
        }
40

41
        *iterator = e;
36,039✔
42
        return true;
36,039✔
43
}
44

45
int inotify_add_watch_fd(int fd, int what, uint32_t mask) {
1,078✔
46
        int wd;
1,078✔
47

48
        assert(fd >= 0);
1,078✔
49
        assert(what >= 0);
1,078✔
50

51
        /* This is like inotify_add_watch(), except that the file to watch is not referenced by a path, but by an fd */
52
        wd = inotify_add_watch(fd, FORMAT_PROC_FD_PATH(what), mask);
1,078✔
53
        if (wd < 0) {
1,078✔
54
                if (errno != ENOENT)
×
UNCOV
55
                        return -errno;
×
56

UNCOV
57
                return proc_fd_enoent_errno();
×
58
        }
59

60
        return wd;
61
}
62

63
int inotify_add_watch_and_warn(int fd, const char *pathname, uint32_t mask) {
46✔
64
        int wd;
46✔
65

66
        wd = inotify_add_watch(fd, pathname, mask);
46✔
67
        if (wd < 0) {
46✔
68
                if (errno == ENOSPC)
×
UNCOV
69
                        return log_error_errno(errno, "Failed to add a watch for %s: inotify watch limit reached", pathname);
×
70

UNCOV
71
                return log_error_errno(errno, "Failed to add a watch for %s: %m", pathname);
×
72
        }
73

74
        return wd;
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