aboutsummaryrefslogtreecommitdiff
path: root/nscd/nscd.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-08-26 18:35:05 +0000
committerUlrich Drepper <drepper@redhat.com>2004-08-26 18:35:05 +0000
commita95a08b4af38992cbcf3d1da97199ef19528fbde (patch)
tree669bba61a337bf8b9c9c15857877bc589792435c /nscd/nscd.c
parent1114ffff54dfbd35cbff9c845376b8221c2c9ced (diff)
downloadglibc-a95a08b4af38992cbcf3d1da97199ef19528fbde.zip
glibc-a95a08b4af38992cbcf3d1da97199ef19528fbde.tar.gz
glibc-a95a08b4af38992cbcf3d1da97199ef19528fbde.tar.bz2
Update.
2004-08-26 Ulrich Drepper <drepper@redhat.com> * nscd/cache.c: Major rewrite. The data is now optionally kept in a mmaped memory region which is automatically mirrored on disk. This implements persistent data storage. The Memory handled needed to be completely revamped, it now uses a garbage collection mechanism instead of malloc. * nscd/connections.c: Likewise. * nscd/nscd.c: Likewise. * nscd/nscd.h: Likewise. * nscd/nscd_conf.c: Likewise. * nscd/nscd_stat.c: Likewise. * nscd/grpcache.c: Likewise. * nscd/hstcache.c:: Likewise. * nscd/pwdcache.c:: Likewise. * nscd/Makefile: Add rules to build mem.c. * nscd/mem.c: New file. * nscd/nscd.conf: Describe new configuration options.
Diffstat (limited to 'nscd/nscd.c')
-rw-r--r--nscd/nscd.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/nscd/nscd.c b/nscd/nscd.c
index e3040bb..35e48ca 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -36,6 +36,7 @@
#include <string.h>
#include <syslog.h>
#include <unistd.h>
+#include <sys/mman.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/un.h>
@@ -69,7 +70,6 @@ int disabled_passwd;
int disabled_group;
int go_background = 1;
-int secure[lastdb];
int secure_in_use;
static const char *conffile = _PATH_NSCDCONF;
@@ -342,11 +342,11 @@ parse_opt (int key, char *arg, struct argp_state *state)
case 'S':
if (strcmp (arg, "passwd,yes") == 0)
- secure_in_use = secure[pwddb] = 1;
+ secure_in_use = dbs[pwddb].secure = 1;
else if (strcmp (arg, "group,yes") == 0)
- secure_in_use = secure[grpdb] = 1;
+ secure_in_use = dbs[grpdb].secure = 1;
else if (strcmp (arg, "hosts,yes") == 0)
- secure_in_use = secure[hstdb] = 1;
+ secure_in_use = dbs[hstdb].secure = 1;
break;
default:
@@ -406,6 +406,14 @@ termination_handler (int signum)
/* Clean up pid file. */
unlink (_PATH_NSCDPID);
+ // XXX Terminate threads.
+
+ /* Synchronize memory. */
+ for (int cnt = 0; cnt < lastdb; ++cnt)
+ if (dbs[cnt].persistent)
+ // XXX async OK?
+ msync (dbs[cnt].head, dbs[cnt].memsize, MS_ASYNC);
+
_exit (EXIT_SUCCESS);
}