]>
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 /* When we include libgen.h because we need dirname() we immediately
13 * undefine basename() since libgen.h defines it as a macro to the POSIX
14 * version which is really broken. We prefer GNU basename(). */
18 #include "alloc-util.h"
19 #include "bus-internal.h"
20 #include "bus-kernel.h"
21 #include "bus-label.h"
22 #include "bus-message.h"
24 #include "capability-util.h"
27 #include "format-util.h"
28 #include "memfd-util.h"
29 #include "parse-util.h"
30 #include "stdio-util.h"
31 #include "string-util.h"
33 #include "user-util.h"
34 #include "memory-util.h"
36 void close_and_munmap(int fd
, void *address
, size_t size
) {
38 assert_se(munmap(address
, PAGE_ALIGN(size
)) >= 0);
43 void bus_flush_memfd(sd_bus
*b
) {
48 for (i
= 0; i
< b
->n_memfd_cache
; i
++)
49 close_and_munmap(b
->memfd_cache
[i
].fd
, b
->memfd_cache
[i
].address
, b
->memfd_cache
[i
].mapped
);