1#include <sys/types.h> 2 3#include <ctype.h> 4#include <errno.h> 5#include <fcntl.h> 6#include <pthread.h> 7#include <stdio.h> 8#include <stdlib.h> 9#include <strings.h> 10#include <unistd.h> 11 12#include "db.h" 13 14#define E(api, func, name) { \ 15 if ((ret = api(func)) != 0) { \ 16 fprintf(stderr, "%s: %s", name, db_strerror(ret)); \ 17 return (1); \ 18 } \ 19} 20 21#define F(api, func1, func2, name) { \ 22 if ((ret = api(func1, func2)) != 0) { \ 23 fprintf(stderr, "%s: %s", name, db_strerror(ret)); \ 24 return (1); \ 25 } \ 26} 27 28void 29dirfree(char **namesp, int cnt) 30{ return; } 31int 32dirlist(const char *dir, char ***namesp, int *cntp) 33{ return (0); } 34int 35exists(const char *path, int *isdirp) 36{ return (0); } 37int 38ioinfo(const char *path, 39 int fd, u_int32_t *mbytesp, u_int32_t *bytesp, u_int32_t *iosizep) 40{ return (0); } 41int 42file_map(DB_ENV *dbenv, char *path, size_t len, int is_readonly, void **addr) 43{ return (0); } 44int 45region_map(DB_ENV *dbenv, char *path, size_t len, int *is_create, void **addr) 46{ return (0); } 47int 48seek(int fd, off_t offset, int whence) 49{ return (0); } 50int 51local_sleep(u_long seconds, u_long microseconds) 52{ return (0); } 53int 54unmap(DB_ENV *dbenv, void *addr) 55{ return (0); } 56 57int 58main(int argc, char *argv[]) 59{ 60 int ret; 61 62 E(db_env_set_func_close, close, "close"); 63 E(db_env_set_func_dirfree, dirfree, "dirfree"); 64 E(db_env_set_func_dirlist, dirlist, "dirlist"); 65 E(db_env_set_func_exists, exists, "exists"); 66 F(db_env_set_func_file_map, file_map, unmap, "file map"); 67 E(db_env_set_func_free, free, "free"); 68 E(db_env_set_func_fsync, fsync, "fsync"); 69 E(db_env_set_func_ftruncate, ftruncate, "ftruncate"); 70 E(db_env_set_func_ioinfo, ioinfo, "ioinfo"); 71 E(db_env_set_func_malloc, malloc, "malloc"); 72 E(db_env_set_func_open, open, "open"); 73 E(db_env_set_func_pread, pread, "pread"); 74 E(db_env_set_func_pwrite, pwrite, "pwrite"); 75 E(db_env_set_func_read, read, "read"); 76 E(db_env_set_func_realloc, realloc, "realloc"); 77 F(db_env_set_func_region_map, region_map, unmap, "region map"); 78 E(db_env_set_func_rename, rename, "rename"); 79 E(db_env_set_func_seek, seek, "seek"); 80 E(db_env_set_func_unlink, unlink, "unlink"); 81 E(db_env_set_func_write, write, "write"); 82 E(db_env_set_func_yield, local_sleep, "sleep/yield"); 83 84 return (0); 85} 86