diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | nscd/connections.c | 18 | ||||
-rw-r--r-- | nscd/nscd_stat.c | 15 |
3 files changed, 31 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog index cd85f06317..e4bf276ccd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-09-10 Ulrich Drepper <drepper@redhat.com> + + * nscd/nscd_stat.c: Improve output by also printing .shared and + .persistent. + + * nscd/connections.c: Allow cache sharing to be really disabled. + 2004-09-10 Jakub Jelinek <jakub@redhat.com> * malloc/malloc.c (_int_free): Only do arena boundary check for diff --git a/nscd/connections.c b/nscd/connections.c index 2ca6f69cf2..11be7c3d0c 100644 --- a/nscd/connections.c +++ b/nscd/connections.c @@ -258,14 +258,16 @@ nscd_init (void) dbnames[cnt]); dbs[cnt].wr_fd = fd; - dbs[cnt].ro_fd = open (dbs[cnt].db_filename, O_RDONLY); fd = -1; /* We also need a read-only descriptor. */ - dbs[cnt].ro_fd = open (dbs[cnt].db_filename, O_RDONLY); - if (dbs[cnt].ro_fd == -1) - dbg_log (_("\ + if (dbs[cnt].shared) + { + dbs[cnt].ro_fd = open (dbs[cnt].db_filename, O_RDONLY); + if (dbs[cnt].ro_fd == -1) + dbg_log (_("\ cannot create read-only descriptor for \"%s\"; no mmap"), - dbs[cnt].db_filename); + dbs[cnt].db_filename); + } // XXX Shall we test whether the descriptors actually // XXX point to the same file? @@ -299,7 +301,7 @@ cannot create read-only descriptor for \"%s\"; no mmap"), fd = open (dbs[cnt].db_filename, O_RDWR | O_CREAT | O_EXCL | O_TRUNC, S_IRUSR | S_IWUSR); - if (fd != -1) + if (fd != -1 && dbs[cnt].shared) ro_fd = open (dbs[cnt].db_filename, O_RDONLY); } else @@ -312,7 +314,7 @@ cannot create read-only descriptor for \"%s\"; no mmap"), /* We do not need the file name anymore after we opened another file descriptor in read-only mode. */ - if (fd != -1) + if (fd != -1 && dbs[cnt].shared) { ro_fd = open (fname, O_RDONLY); @@ -344,7 +346,7 @@ cannot create read-only descriptor for \"%s\"; no mmap"), { /* Tell the user if we could not create the read-only descriptor. */ - if (ro_fd == -1) + if (ro_fd == -1 && dbs[cnt].shared) dbg_log (_("\ cannot create read-only descriptor for \"%s\"; no mmap"), dbs[cnt].db_filename); diff --git a/nscd/nscd_stat.c b/nscd/nscd_stat.c index 30f427bd20..73dafe120b 100644 --- a/nscd/nscd_stat.c +++ b/nscd/nscd_stat.c @@ -38,6 +38,8 @@ struct dbstat { int enabled; int check_file; + int shared; + int persistent; size_t module; unsigned long int postimeout; @@ -88,6 +90,8 @@ send_stats (int fd, struct database_dyn dbs[lastdb]) { data.dbs[cnt].enabled = dbs[cnt].enabled; data.dbs[cnt].check_file = dbs[cnt].check_file; + data.dbs[cnt].shared = dbs[cnt].shared; + data.dbs[cnt].persistent = dbs[cnt].persistent; data.dbs[cnt].module = dbs[cnt].head->module; data.dbs[cnt].postimeout = dbs[cnt].postimeout; data.dbs[cnt].negtimeout = dbs[cnt].negtimeout; @@ -213,6 +217,9 @@ receive_print_stats (void) const char *enabled = nl_langinfo (data.dbs[i].enabled ? YESSTR : NOSTR); const char *check_file = nl_langinfo (data.dbs[i].check_file ? YESSTR : NOSTR); + const char *shared = nl_langinfo (data.dbs[i].shared ? YESSTR : NOSTR); + const char *persistent = nl_langinfo (data.dbs[i].persistent + ? YESSTR : NOSTR); if (enabled[0] == '\0') /* The locale does not provide this information so we have to @@ -221,6 +228,10 @@ receive_print_stats (void) enabled = data.dbs[i].enabled ? _(" yes") : _(" no"); if (check_file[0] == '\0') check_file = data.dbs[i].check_file ? _(" yes") : _(" no"); + if (shared[0] == '\0') + shared = data.dbs[i].shared ? _(" yes") : _(" no"); + if (persistent[0] == '\0') + persistent = data.dbs[i].persistent ? _(" yes") : _(" no"); if (all == 0) /* If nothing happened so far report a 0% hit rate. */ @@ -228,6 +239,8 @@ receive_print_stats (void) printf (_("\n%s cache:\n\n" "%15s cache is enabled\n" + "%15s cache is persistent\n" + "%15s cache is shared\n" "%15zu suggested size\n" "%15zu total data pool size\n" "%15zu used data pool size\n" @@ -245,7 +258,7 @@ receive_print_stats (void) "%15" PRIuMAX " number of delays on wrlock\n" "%15" PRIuMAX " memory allocations failed\n" "%15s check /etc/%s for changes\n"), - dbnames[i], enabled, + dbnames[i], enabled, persistent, shared, data.dbs[i].module, data.dbs[i].datasize, data.dbs[i].dataused, data.dbs[i].postimeout, data.dbs[i].negtimeout, |