about summary refs log tree commit diff
path: root/nscd/nscd.c
diff options
context:
space:
mode:
authorDJ Delorie <dj@redhat.com>2020-02-19 12:31:09 -0500
committerDJ Delorie <dj@redhat.com>2020-03-13 16:43:19 -0400
commitdcf46d3fe5ad8e93f25ad90771484aa22c2ca4fc (patch)
tree7384d2a94cdb28261ca76c53a49cea034067ef93 /nscd/nscd.c
parent2de7fe62534b7a6461c633114f03e9dff394f5f7 (diff)
downloadglibc-dcf46d3fe5ad8e93f25ad90771484aa22c2ca4fc.tar.gz
glibc-dcf46d3fe5ad8e93f25ad90771484aa22c2ca4fc.tar.xz
glibc-dcf46d3fe5ad8e93f25ad90771484aa22c2ca4fc.zip
nscd: add cache dumper
Diffstat (limited to 'nscd/nscd.c')
-rw-r--r--nscd/nscd.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/nscd/nscd.c b/nscd/nscd.c
index 310111ae6d..4731146fad 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -77,6 +77,8 @@ static run_modes run_mode = RUN_DAEMONIZE;
 
 static const char *conffile = _PATH_NSCDCONF;
 
+static const char *print_cache = NULL;
+
 time_t start_time;
 
 uintptr_t pagesize_m1;
@@ -106,6 +108,8 @@ static const struct argp_option options[] =
     N_("Read configuration data from NAME") },
   { "debug", 'd', NULL, 0,
     N_("Do not fork and display messages on the current tty") },
+  { "print", 'p', N_("NAME"), 0,
+    N_("Print contents of the offline cache file NAME") },
   { "foreground", 'F', NULL, 0,
     N_("Do not fork, but otherwise behave like a daemon") },
   { "nthreads", 't', N_("NUMBER"), 0, N_("Start NUMBER threads") },
@@ -157,6 +161,11 @@ main (int argc, char **argv)
       exit (1);
     }
 
+  /* Print the contents of the indicated cache file.  */
+  if (print_cache != NULL)
+    /* Does not return.  */
+    nscd_print_cache (print_cache);
+
   /* Read the configuration file.  */
   if (nscd_parse_file (conffile, dbs) != 0)
     /* We couldn't read the configuration file.  We don't start the
@@ -404,6 +413,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
       run_mode = RUN_DEBUG;
       break;
 
+    case 'p':
+      print_cache = arg;
+      break;
+
     case 'F':
       run_mode = RUN_FOREGROUND;
       break;