]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/libsystemd/sd-bus/bus-kernel.c
90fc60afbde232d5efb28a8f6d0c88cfdcf7e34a
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
5 #include "bus-kernel.h"
6 #include "bus-internal.h"
8 #include "memory-util.h"
10 void close_and_munmap(int fd
, void *address
, size_t size
) {
12 size
= PAGE_ALIGN(size
);
13 assert(size
< SIZE_MAX
);
14 assert_se(munmap(address
, size
) >= 0);
20 void bus_flush_memfd(sd_bus
*b
) {
23 for (unsigned i
= 0; i
< b
->n_memfd_cache
; i
++)
24 close_and_munmap(b
->memfd_cache
[i
].fd
, b
->memfd_cache
[i
].address
, b
->memfd_cache
[i
].mapped
);