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

systemd / systemd / 15232239991

24 May 2025 08:01PM UTC coverage: 72.053% (-0.02%) from 72.07%
15232239991

push

github

web-flow
docs: add man pages for sd_device_enumerator_[new,ref,unref,unrefp] (#37586)

For #20929.

299160 of 415197 relevant lines covered (72.05%)

703671.29 hits per line

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

95.56
/src/shared/daemon-util.c
1
/* SPDX-License-Identifier: LGPL-2.1-or-later */
2

3
#include "sd-daemon.h"
4

5
#include "alloc-util.h"
6
#include "daemon-util.h"
7
#include "fd-util.h"
8
#include "log.h"
9
#include "string-util.h"
10
#include "time-util.h"
11

12
int notify_remove_fd_warn(const char *name) {
1,664✔
13
        int r;
1,664✔
14

15
        assert(name);
1,664✔
16

17
        r = sd_notifyf(/* unset_environment = */ false,
1,664✔
18
                       "FDSTOREREMOVE=1\n"
19
                       "FDNAME=%s", name);
20
        if (r < 0)
1,664✔
21
                return log_warning_errno(r,
3✔
22
                                         "Failed to remove file descriptor \"%s\" from the store, ignoring: %m",
23
                                         name);
24

25
        return 0;
26
}
27

28
int notify_remove_fd_warnf(const char *format, ...) {
973✔
29
        _cleanup_free_ char *p = NULL;
973✔
30
        va_list ap;
973✔
31
        int r;
973✔
32

33
        assert(format);
973✔
34

35
        va_start(ap, format);
973✔
36
        r = vasprintf(&p, format, ap);
973✔
37
        va_end(ap);
973✔
38
        if (r < 0)
973✔
39
                return log_oom();
×
40

41
        return notify_remove_fd_warn(p);
973✔
42
}
43

44
int close_and_notify_warn(int fd, const char *name) {
6✔
45
        if (name)
6✔
46
                (void) notify_remove_fd_warn(name);
6✔
47

48
        return safe_close(fd);
6✔
49
}
50

51
int notify_push_fd(int fd, const char *name) {
629✔
52
        _cleanup_free_ char *state = NULL;
629✔
53

54
        assert(fd >= 0);
629✔
55
        assert(name);
629✔
56

57
        state = strjoin("FDSTORE=1\n"
629✔
58
                        "FDNAME=", name);
59
        if (!state)
629✔
60
                return -ENOMEM;
61

62
        /* Remove existing fds with the same name in fdstore. */
63
        (void) notify_remove_fd_warn(name);
629✔
64

65
        return sd_pid_notify_with_fds(0, /* unset_environment = */ false, state, &fd, 1);
629✔
66
}
67

68
int notify_push_fdf(int fd, const char *format, ...) {
510✔
69
        _cleanup_free_ char *name = NULL;
510✔
70
        va_list ap;
510✔
71
        int r;
510✔
72

73
        assert(fd >= 0);
510✔
74
        assert(format);
510✔
75

76
        va_start(ap, format);
510✔
77
        r = vasprintf(&name, format, ap);
510✔
78
        va_end(ap);
510✔
79
        if (r < 0)
510✔
80
                return -ENOMEM;
81

82
        return notify_push_fd(fd, name);
510✔
83
}
84

85
int notify_reloading_full(const char *status) {
327✔
86
        int r;
327✔
87

88
        r = sd_notifyf(/* unset_environment = */ false,
327✔
89
                       "RELOADING=1\n"
90
                       "MONOTONIC_USEC=" USEC_FMT
91
                       "%s%s",
92
                       now(CLOCK_MONOTONIC),
93
                       status ? "\nSTATUS=" : "", strempty(status));
94
        if (r < 0)
327✔
95
                return log_debug_errno(r, "Failed to notify service manager for reloading status: %m");
×
96

97
        return 0;
98
}
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