LCOV - code coverage report
Current view: top level - machine - machined-core.c (source / functions) Hit Total Coverage
Test: main_coverage.info Lines: 0 15 0.0 %
Date: 2019-08-22 15:41:25 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /* SPDX-License-Identifier: LGPL-2.1+ */
       2             : 
       3             : #include "machined.h"
       4             : #include "nscd-flush.h"
       5             : #include "strv.h"
       6             : 
       7           0 : static int on_nscd_cache_flush_event(sd_event_source *s, void *userdata) {
       8             :         /* Let's ask glibc's nscd daemon to flush its caches. We request this for the three database machines may show
       9             :          * up in: the hosts database (for resolvable machine names) and the user and group databases (for the user ns
      10             :          * ranges). */
      11             : 
      12           0 :         (void) nscd_flush_cache(STRV_MAKE("passwd", "group", "hosts"));
      13           0 :         return 0;
      14             : }
      15             : 
      16           0 : int manager_enqueue_nscd_cache_flush(Manager *m) {
      17             :         int r;
      18             : 
      19           0 :         assert(m);
      20             : 
      21           0 :         if (!m->nscd_cache_flush_event) {
      22           0 :                 r = sd_event_add_defer(m->event, &m->nscd_cache_flush_event, on_nscd_cache_flush_event, m);
      23           0 :                 if (r < 0)
      24           0 :                         return log_error_errno(r, "Failed to allocate NSCD cache flush event: %m");
      25             : 
      26           0 :                 sd_event_source_set_description(m->nscd_cache_flush_event, "nscd-cache-flush");
      27             :         }
      28             : 
      29           0 :         r = sd_event_source_set_enabled(m->nscd_cache_flush_event, SD_EVENT_ONESHOT);
      30           0 :         if (r < 0) {
      31           0 :                 m->nscd_cache_flush_event = sd_event_source_unref(m->nscd_cache_flush_event);
      32           0 :                 return log_error_errno(r, "Failed to enable NSCD cache flush event: %m");
      33             :         }
      34             : 
      35           0 :         return 0;
      36             : }

Generated by: LCOV version 1.14