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.
This commit is contained in:
Ulrich Drepper 2004-09-10 23:56:29 +00:00
parent 9b2dc51589
commit 3418007ed6
6 changed files with 38 additions and 6 deletions

View File

@ -1,3 +1,12 @@
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.
2004-09-10 Kaz Kojima <kkojima@rr.iij4u.or.jp>
* sysdeps/unix/sysv/linux/sh/pthread_cond_wait.S: Decrement

View File

@ -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);

View File

@ -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);

View File

@ -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)
{

View File

@ -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 */

View File

@ -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);