LCOV - code coverage report
Current view: top level - libsystemd/sd-bus - bus-kernel.c (source / functions) Hit Total Coverage
Test: main_coverage.info Lines: 4 10 40.0 %
Date: 2019-08-22 15:41:25 Functions: 1 2 50.0 %

          Line data    Source code
       1             : /* SPDX-License-Identifier: LGPL-2.1+ */
       2             : 
       3             : #if HAVE_VALGRIND_MEMCHECK_H
       4             : #include <valgrind/memcheck.h>
       5             : #endif
       6             : 
       7             : #include <fcntl.h>
       8             : #include <malloc.h>
       9             : #include <sys/mman.h>
      10             : #include <sys/prctl.h>
      11             : 
      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(). */
      15             : #include <libgen.h>
      16             : #undef basename
      17             : 
      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"
      23             : #include "bus-util.h"
      24             : #include "capability-util.h"
      25             : #include "fd-util.h"
      26             : #include "fileio.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"
      32             : #include "strv.h"
      33             : #include "user-util.h"
      34             : #include "memory-util.h"
      35             : 
      36           0 : void close_and_munmap(int fd, void *address, size_t size) {
      37           0 :         if (size > 0)
      38           0 :                 assert_se(munmap(address, PAGE_ALIGN(size)) >= 0);
      39             : 
      40           0 :         safe_close(fd);
      41           0 : }
      42             : 
      43          53 : void bus_flush_memfd(sd_bus *b) {
      44             :         unsigned i;
      45             : 
      46          53 :         assert(b);
      47             : 
      48          53 :         for (i = 0; i < b->n_memfd_cache; i++)
      49           0 :                 close_and_munmap(b->memfd_cache[i].fd, b->memfd_cache[i].address, b->memfd_cache[i].mapped);
      50          53 : }

Generated by: LCOV version 1.14