// Purge the use table of old entries.
int PurgeUseTable(StrBuf *ErrMsg) {
int purged = 0;
+ int total = 0;
struct cdbdata *cdbut;
struct UseTable ut;
struct UPurgeList *ul = NULL;
syslog(LOG_DEBUG, "Purge use table: phase 1");
cdb_rewind(CDB_USETABLE);
while(cdbut = cdb_next_item(CDB_USETABLE), cdbut != NULL) {
+ ++total;
if (cdbut->len > sizeof(struct UseTable))
memcpy(&ut, cdbut->ptr, sizeof(struct UseTable));
else {
ul = uptr;
}
- syslog(LOG_DEBUG, "Purge use table: finished (purged %d records)", purged);
+ syslog(LOG_DEBUG, "Purge use table: finished (purged %d of %d records)", purged, total);
return(purged);
}
int main(int argc, char **argv) {
+ char ctdldir[PATH_MAX]=CTDLDIR;
+ // Check to make sure we're running on the target 64-bit system
if (sizeof(void *) != 8) {
fprintf(stderr, "%s: this is a %ld-bit system.\n", argv[0], sizeof(void *)*8);
fprintf(stderr, "%s: you must run this on a 64-bit system, onto which a 32-bit database has been copied.\n", argv[0]);
exit(1);
}
+ // Parse command line
+ while ((int a = getopt(argc, argv, "h:w:")) != EOF) {
+ switch (a) {
+ case 'h':
+ strncpy(ctdldir, optarg, sizeof ctdldir);
+ break;
+ case 'w':
+ watchdog = atoi(optarg);
+ break;
+ default:
+ fprintf(stderr, "%s: usage: %s [-h server_dir]\n", argv[0], argv[0]);
+ exit(2);
+ }
+ }
exit(0);
}
start_line=$(cat ${SERVER_H} | egrep -n "^struct $1 {" | cut -d: -f1)
tail +${start_line} ${SERVER_H} | sed '/};/q' \
| sed s/"^struct $1 {"/"struct ${1}_32 {"/g \
- | sed s/"int "/"int32_t "/g \
| sed s/"long "/"int32_t "/g \
- | sed s/"unsigned "/"uint32_t "/g \
| sed s/"time_t "/"int32_t "/g \
| sed s/"struct ExpirePolicy "/"struct ExpirePolicy_32 "/g
echo ''