diff options
Diffstat (limited to 'nscd/nscd.h')
-rw-r--r-- | nscd/nscd.h | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/nscd/nscd.h b/nscd/nscd.h index e8199b8009..cd6fe15c30 100644 --- a/nscd/nscd.h +++ b/nscd/nscd.h @@ -55,11 +55,21 @@ typedef enum #define RESTART_INTERVAL (60 * 60) +/* Stack size for worker threads. */ +#define NSCD_THREAD_STACKSIZE 1024 * 1024 * (sizeof (void *) / 4) + +/* Maximum size of stack frames we allow the thread to use. We use + 80% of the thread stack size. */ +#define MAX_STACK_USE ((8 * NSCD_THREAD_STACKSIZE) / 10) + + /* Structure describing dynamic part of one database. */ 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 +121,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 +204,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 +273,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 |