Lines Matching defs:cache
199 /* insert a new cache entry at the head of the list (youngest entry) */
211 /* remove an arbitrary cache entry for promotion */
240 if (crecp->addr.cname.cache && crecp->addr.cname.uid == crecp->addr.cname.cache->uid)
263 entries in the whole cache.
264 If (flags == 0) remove any expired entries in the whole cache.
267 name exists in the cache as a HOSTS or DHCP entry (these are never deleted)
369 /* CONFIG bit means something else when stored in cache entries */
385 /* Now get a cache entry from the end of the LRU list */
387 if (!(new = cache_tail)) /* no entries left - cache is too small, bail */
463 new->addr.cname.cache = NULL;
644 static void add_hosts_entry(struct crec *cache, struct all_addr *addr, int addrlen,
647 struct crec *lookup = cache_find_by_name(NULL, cache->name.sname, 0, flags & (F_IPV4 | F_IPV6));
657 free(cache);
687 cache->flags = flags;
688 cache->uid = index;
689 memcpy(&cache->addr.addr, addr, addrlen);
690 cache_hash(cache);
695 if (hostname_isequal(cache->name.sname, a->target) &&
700 lookup->addr.cname.cache = cache;
823 struct crec *cache;
836 (cache = whine_malloc(sizeof(struct crec) +
839 strcpy(cache->name.sname, canon);
840 strcat(cache->name.sname, ".");
841 strcat(cache->name.sname, domain_suffix);
842 add_hosts_entry(cache, &addr, addrlen, flags, index, addr_dup);
846 if ((cache = whine_malloc(sizeof(struct crec) + strlen(canon)+1-SMALLDNAME)))
848 strcpy(cache->name.sname, canon);
849 add_hosts_entry(cache, &addr, addrlen, flags, index, addr_dup);
870 struct crec *cache, **up, *tmp;
877 for (cache = hash_table[i], up = &hash_table[i]; cache; cache = tmp)
879 tmp = cache->hash_next;
880 if (cache->flags & F_HOSTS)
882 *up = cache->hash_next;
883 free(cache);
885 else if (!(cache->flags & F_DHCP))
887 *up = cache->hash_next;
888 if (cache->flags & F_BIGNAME)
890 cache->name.bname->next = big_free;
891 big_free = cache->name.bname;
893 cache->flags = 0;
896 up = &cache->hash_next;
902 my_syslog(LOG_INFO, _("cleared cache"));
1020 struct crec *cache, **up;
1024 for (cache = hash_table[i], up = &hash_table[i]; cache; cache = cache->hash_next)
1025 if (cache->flags & F_DHCP)
1027 *up = cache->hash_next;
1028 cache->next = dhcp_spare;
1029 dhcp_spare = cache;
1032 up = &cache->hash_next;
1115 aliasc->addr.cname.cache = crec;
1130 my_syslog(LOG_INFO, _("cache size %d, %d/%d cache insertions re-used unexpired cache entries."),
1160 struct crec *cache ;
1165 for (cache = hash_table[i]; cache; cache = cache->hash_next)
1168 p += sprintf(p, "%-40.40s ", cache_get_name(cache));
1169 if ((cache->flags & F_NEG) && (cache->flags & F_FORWARD))
1171 else if (cache->flags & F_CNAME)
1174 if (!is_outdated_cname_pointer(cache))
1175 a = cache_get_name(cache->addr.cname.cache);
1181 if (cache->flags & F_IPV4)
1182 inet_ntop(AF_INET, &cache->addr.addr, addrbuff, ADDRSTRLEN);
1183 else if (cache->flags & F_IPV6)
1184 inet_ntop(AF_INET6, &cache->addr.addr, addrbuff, ADDRSTRLEN);
1188 a = inet_ntoa(cache->addr.addr.addr.addr4);
1191 cache->flags & F_IPV4 ? "4" : "",
1192 cache->flags & F_IPV6 ? "6" : "",
1193 cache->flags & F_CNAME ? "C" : "",
1194 cache->flags & F_FORWARD ? "F" : " ",
1195 cache->flags & F_REVERSE ? "R" : " ",
1196 cache->flags & F_IMMORTAL ? "I" : " ",
1197 cache->flags & F_DHCP ? "D" : " ",
1198 cache->flags & F_NEG ? "N" : " ",
1199 cache->flags & F_NXDOMAIN ? "X" : " ",
1200 cache->flags & F_HOSTS ? "H" : " ");
1202 p += sprintf(p, "%lu", cache->flags & F_IMMORTAL ? 0: (unsigned long)(cache->ttd - now));
1204 p += sprintf(p, "%s", cache->flags & F_IMMORTAL ? "\n" : ctime(&(cache->ttd)));