*/
#include <ccan/tdb2/tdb2.h>
-#include <ccan/hash/hash.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
" store key data : store a record (replace)\n"
" show key : show a record by key\n"
" delete key : delete a record by key\n"
+#if 0
" list : print the database hash table and freelist\n"
" free : print the database freelist\n"
+#endif
" check : check the integrity of an opened database\n"
" speed : perform speed tests on the database\n"
" ! command : execute system command\n"
}
}
-static uint64_t jenkins_hash(const void *key, size_t len, uint64_t seed,
- void *priv)
-{
- return hash_any(key, len, seed);
-}
-
static void open_tdb(const char *tdbname)
{
union tdb_attribute log_attr;
{
char string[100];
- sprintf(string, "%u: death at %p (map_ptr %p, map_size %llu)\n",
- getpid(), info->si_addr, db->map_ptr, db->map_size);
- write(2, string, strlen(string));
- sleep(60);
+ sprintf(string, "%u: death at %p (map_ptr %p, map_size %zu)\n",
+ getpid(), info->si_addr, db->file->map_ptr,
+ (size_t)db->file->map_size);
+ if (write(2, string, strlen(string)) > 0)
+ sleep(60);
_exit(11);
}
static void send_count_and_suicide(int sig)
{
/* This ensures our successor can continue where we left off. */
- write(count_pipe, &loopnum, sizeof(loopnum));
+ if (write(count_pipe, &loopnum, sizeof(loopnum)) != sizeof(loopnum))
+ exit(2);
/* This gives a unique signature. */
kill(getpid(), SIGUSR2);
}
|| WTERMSIG(status) == SIGUSR1) {
/* SIGUSR2 means they wrote to pipe. */
if (WTERMSIG(status) == SIGUSR2) {
- read(pfds[0], &done[j],
- sizeof(done[j]));
+ if (read(pfds[0], &done[j],
+ sizeof(done[j]))
+ != sizeof(done[j]))
+ err(1,
+ "Short read from child?");
}
pids[j] = fork();
if (pids[j] == 0)