about summary refs log tree commit diff
path: root/nscd/nscd.h
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-11-06 00:45:40 +0000
committerUlrich Drepper <drepper@redhat.com>2007-11-06 00:45:40 +0000
commitffb1b882828a6fa71fb4e9be1c30cacafb3c70c3 (patch)
tree9819639dc6d59b7cfbd3630b7027b57c0d696f47 /nscd/nscd.h
parent41ff2a4999f64527a0552c6a9c203157e161fa97 (diff)
downloadglibc-ffb1b882828a6fa71fb4e9be1c30cacafb3c70c3.tar.gz
glibc-ffb1b882828a6fa71fb4e9be1c30cacafb3c70c3.tar.xz
glibc-ffb1b882828a6fa71fb4e9be1c30cacafb3c70c3.zip
* nscd/aicache.c (addhstaiX): Check herrno after IPv4 lookup only
	when the lookup call failed.

	* nscd/nscd.h (struct database_dyn): Rename prunelock to prune_lock.
	Add prune_cond and wakeup_time.
	(CACHE_PRUNE_INTERNAL): Define.
	Update declarations of prune_cache and setup_thread.
	* nscd/connections.c (dbs): Update initializers.
	(CACHE_PRUNE_INTERNAL): Moved to nscd.h.
	(nscd_init): Default number of threads is now 4.
	(invalidate_cache): Take lock before calling prune_cache.
	(handle_request): If SELinux forbids the request, say so.
	(readylist_cond): Use static initializer.
	(nscd_run_prune): New function.  Used only by pruning threads.
	(nscd_run_worder): Renamed from nscd_run.  Remove support for pruning
	here.
	(fd_ready): Update nscd_run reference.
	(start_threads): No need to initialize readylist_cond.
	Start pruning threads separately.
	* nscd/nscd_setup_thread.c: Change return value type to int and always
	return 0.
	* sysdeps/unix/sysv/linux/nscd_setup_thread.c: Change return value type
	to int and return nonzero value if we can use the TID address hack.
	* nscd/cache.c (cache_add): If next wakeup time of cleanup thread for
	the database is later than the new entry's timeout, update the
	wakeup time and wake the cleanup thread.
	(prune_cache): Return seconds the next entry in the database is still
	valid.  Remove locking for pruning here.
	* nscd/nscd.conf: Document default number of threads.
Diffstat (limited to 'nscd/nscd.h')
-rw-r--r--nscd/nscd.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/nscd/nscd.h b/nscd/nscd.h
index e8199b8009..12b1f85f89 100644
--- a/nscd/nscd.h
+++ b/nscd/nscd.h
@@ -59,7 +59,9 @@ typedef enum
 struct database_dyn
 {
   pthread_rwlock_t lock;
-  pthread_mutex_t prunelock;
+  pthread_cond_t prune_cond;
+  pthread_mutex_t prune_lock;
+  time_t wakeup_time;
 
   int enabled;
   int check_file;
@@ -111,6 +113,11 @@ struct database_dyn
 #define DEFAULT_DATASIZE_PER_BUCKET 1024
 
 
+/* Number of seconds between two cache pruning runs if we do not have
+   better information when it is really needed.  */
+#define CACHE_PRUNE_INTERVAL	15
+
+
 /* Global variables.  */
 extern struct database_dyn dbs[lastdb];
 extern const char *const dbnames[lastdb];
@@ -189,7 +196,7 @@ extern struct datahead *cache_search (request_type, void *key, size_t len,
 extern int cache_add (int type, const void *key, size_t len,
 		      struct datahead *packet, bool first,
 		      struct database_dyn *table, uid_t owner);
-extern void prune_cache (struct database_dyn *table, time_t now, int fd);
+extern time_t prune_cache (struct database_dyn *table, time_t now, int fd);
 
 /* pwdcache.c */
 extern void addpwbyname (struct database_dyn *db, int fd, request_header *req,
@@ -258,7 +265,7 @@ extern void gc (struct database_dyn *db);
 
 
 /* nscd_setup_thread.c */
-extern void setup_thread (struct database_dyn *db);
+extern int setup_thread (struct database_dyn *db);
 
 
 /* Special version of TEMP_FAILURE_RETRY for functions returning error