diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-09-10 23:56:29 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-09-10 23:56:29 +0000 |
commit | 3418007ed675c2ab8a9885bcd101752246f9c2d8 (patch) | |
tree | 1a0d2e7f986886c77389bf78250eff720810c6cc /nscd | |
parent | 9b2dc5158996348484428ef6698186628152da3f (diff) | |
download | glibc-3418007ed675c2ab8a9885bcd101752246f9c2d8.zip glibc-3418007ed675c2ab8a9885bcd101752246f9c2d8.tar.gz glibc-3418007ed675c2ab8a9885bcd101752246f9c2d8.tar.bz2 |
Update.
2004-09-10 Ulrich Drepper <drepper@redhat.com>
* nscd/nscd.c (pagesize_m1): New variable.
(main): Initialize it.
* nscd/nscd.h: Declare pagesize_m1.
* nscd/hstcache.c: Pass correctly aligned address to msync.
* nscd/grpcache.c: Likewise.
* nscd/pwdcache.c: Likewise.
Diffstat (limited to 'nscd')
-rw-r--r-- | nscd/grpcache.c | 9 | ||||
-rw-r--r-- | nscd/hstcache.c | 9 | ||||
-rw-r--r-- | nscd/nscd.c | 5 | ||||
-rw-r--r-- | nscd/nscd.h | 3 | ||||
-rw-r--r-- | nscd/pwdcache.c | 9 |
5 files changed, 29 insertions, 6 deletions
diff --git a/nscd/grpcache.c b/nscd/grpcache.c index 7315eec..d07693f 100644 --- a/nscd/grpcache.c +++ b/nscd/grpcache.c @@ -291,8 +291,13 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req, { /* If necessary, we also propagate the data to disk. */ if (db->persistent) - // XXX async OK? - msync (dataset, total + n, MS_ASYNC); + { + // XXX async OK? + uintptr_t pval = (uintptr_t) dataset & ~pagesize_m1; + msync ((void *) pval, + ((uintptr_t) dataset & pagesize_m1) + total + n, + MS_ASYNC); + } /* Now get the lock to safely insert the records. */ pthread_rwlock_rdlock (&db->lock); diff --git a/nscd/hstcache.c b/nscd/hstcache.c index 94568d0..78e29fb 100644 --- a/nscd/hstcache.c +++ b/nscd/hstcache.c @@ -332,8 +332,13 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req, { /* If necessary, we also propagate the data to disk. */ if (db->persistent) - // XXX async OK? - msync (dataset, total + req->key_len, MS_ASYNC); + { + // XXX async OK? + uintptr_t pval = (uintptr_t) dataset & ~pagesize_m1; + msync ((void *) pval, + ((uintptr_t) dataset & pagesize_m1) + + total + req->key_len, MS_ASYNC); + } addr_list_type = (hst->h_length == NS_INADDRSZ ? GETHOSTBYADDR : GETHOSTBYADDRv6); diff --git a/nscd/nscd.c b/nscd/nscd.c index f6b22d4..5c5c155 100644 --- a/nscd/nscd.c +++ b/nscd/nscd.c @@ -76,6 +76,8 @@ static const char *conffile = _PATH_NSCDCONF; time_t start_time; +uintptr_t pagesize_m1; + static int check_pid (const char *file); static int write_pid (const char *file); @@ -155,6 +157,9 @@ main (int argc, char **argv) /* Remember when we started. */ start_time = time (NULL); + /* Determine page size. */ + pagesize_m1 = getpagesize () - 1; + /* Behave like a daemon. */ if (go_background) { diff --git a/nscd/nscd.h b/nscd/nscd.h index 910fba3..d32f5fe 100644 --- a/nscd/nscd.h +++ b/nscd/nscd.h @@ -124,6 +124,9 @@ extern const size_t block_align; means unlimited. */ extern unsigned int reload_count; +/* Pagesize minus one. */ +extern uintptr_t pagesize_m1; + /* Prototypes for global functions. */ /* nscd.c */ diff --git a/nscd/pwdcache.c b/nscd/pwdcache.c index b322778..2354b6d 100644 --- a/nscd/pwdcache.c +++ b/nscd/pwdcache.c @@ -287,8 +287,13 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req, { /* If necessary, we also propagate the data to disk. */ if (db->persistent) - // XXX async OK? - msync (dataset, total + n, MS_ASYNC); + { + // XXX async OK? + uintptr_t pval = (uintptr_t) dataset & ~pagesize_m1; + msync ((void *) pval, + ((uintptr_t) dataset & pagesize_m1) + total + n, + MS_ASYNC); + } /* Now get the lock to safely insert the records. */ pthread_rwlock_rdlock (&db->lock); |