]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/libsystemd/sd-bus/bus-kernel.c
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
3 #if HAVE_VALGRIND_MEMCHECK_H
4 #include <valgrind/memcheck.h>
10 #include <sys/prctl.h>
12 #include "alloc-util.h"
13 #include "bus-internal.h"
14 #include "bus-kernel.h"
15 #include "bus-label.h"
16 #include "bus-message.h"
17 #include "capability-util.h"
20 #include "format-util.h"
21 #include "memfd-util.h"
22 #include "parse-util.h"
23 #include "stdio-util.h"
24 #include "string-util.h"
26 #include "user-util.h"
27 #include "memory-util.h"
29 void close_and_munmap(int fd
, void *address
, size_t size
) {
31 size
= PAGE_ALIGN(size
);
32 assert(size
< SIZE_MAX
);
33 assert_se(munmap(address
, size
) >= 0);
39 void bus_flush_memfd(sd_bus
*b
) {
42 for (unsigned i
= 0; i
< b
->n_memfd_cache
; i
++)
43 close_and_munmap(b
->memfd_cache
[i
].fd
, b
->memfd_cache
[i
].address
, b
->memfd_cache
[i
].mapped
);