00001 /*- 00002 * See the file LICENSE for redistribution information. 00003 * 00004 * Copyright (c) 1999, 2000 00005 * Sleepycat Software. All rights reserved. 00006 */ 00007 00008 #include "config.h" 00009 00010 #ifndef lint 00011 static const char revid[] = "$Id: os__method_8c-source.html,v 1.1 2008年06月08日 10:21:20 sebdiaz Exp $"; 00012 #endif /* not lint */ 00013 00014 #ifndef NO_SYSTEM_INCLUDES 00015 #include <sys/types.h> 00016 #endif 00017 00018 #include "db_int.h" 00019 #include "os_jump.h" 00020 00021 struct __db_jumptab CDB___db_jump; 00022 00023 int 00024 CDB_db_env_set_func_close(func_close) 00025 int (*func_close) __P((int)); 00026 { 00027 CDB___db_jump.j_close = func_close; 00028 return (0); 00029 } 00030 00031 int 00032 CDB_db_env_set_func_dirfree(func_dirfree) 00033 void (*func_dirfree) __P((char **, int)); 00034 { 00035 CDB___db_jump.j_dirfree = func_dirfree; 00036 return (0); 00037 } 00038 00039 int 00040 CDB_db_env_set_func_dirlist(func_dirlist) 00041 int (*func_dirlist) __P((const char *, char ***, int *)); 00042 { 00043 CDB___db_jump.j_dirlist = func_dirlist; 00044 return (0); 00045 } 00046 00047 int 00048 CDB_db_env_set_func_exists(func_exists) 00049 int (*func_exists) __P((const char *, int *)); 00050 { 00051 CDB___db_jump.j_exists = func_exists; 00052 return (0); 00053 } 00054 00055 int 00056 CDB_db_env_set_func_free(func_free) 00057 void (*func_free) __P((void *)); 00058 { 00059 CDB___db_jump.j_free = func_free; 00060 return (0); 00061 } 00062 00063 int 00064 CDB_db_env_set_func_fsync(func_fsync) 00065 int (*func_fsync) __P((int)); 00066 { 00067 CDB___db_jump.j_fsync = func_fsync; 00068 return (0); 00069 } 00070 00071 int 00072 CDB_db_env_set_func_ioinfo(func_ioinfo) 00073 int (*func_ioinfo) 00074 __P((const char *, int, u_int32_t *, u_int32_t *, u_int32_t *)); 00075 { 00076 CDB___db_jump.j_ioinfo = func_ioinfo; 00077 return (0); 00078 } 00079 00080 int 00081 CDB_db_env_set_func_malloc(func_malloc) 00082 void *(*func_malloc) __P((size_t)); 00083 { 00084 CDB___db_jump.j_malloc = func_malloc; 00085 return (0); 00086 } 00087 00088 int 00089 CDB_db_env_set_func_map(func_map) 00090 int (*func_map) __P((char *, size_t, int, int, void **)); 00091 { 00092 CDB___db_jump.j_map = func_map; 00093 return (0); 00094 } 00095 00096 int 00097 CDB_db_env_set_func_open(func_open) 00098 int (*func_open) __P((const char *, int, ...)); 00099 { 00100 CDB___db_jump.j_open = func_open; 00101 return (0); 00102 } 00103 00104 int 00105 CDB_db_env_set_func_read(func_read) 00106 ssize_t (*func_read) __P((int, void *, size_t)); 00107 { 00108 CDB___db_jump.j_read = func_read; 00109 return (0); 00110 } 00111 00112 int 00113 CDB_db_env_set_func_realloc(func_realloc) 00114 void *(*func_realloc) __P((void *, size_t)); 00115 { 00116 CDB___db_jump.j_realloc = func_realloc; 00117 return (0); 00118 } 00119 00120 int 00121 CDB_db_env_set_func_rename(func_rename) 00122 int (*func_rename) __P((const char *, const char *)); 00123 { 00124 CDB___db_jump.j_rename = func_rename; 00125 return (0); 00126 } 00127 00128 int 00129 CDB_db_env_set_func_seek(func_seek) 00130 int (*func_seek) __P((int, size_t, db_pgno_t, u_int32_t, int, int)); 00131 { 00132 CDB___db_jump.j_seek = func_seek; 00133 return (0); 00134 } 00135 00136 int 00137 CDB_db_env_set_func_sleep(func_sleep) 00138 int (*func_sleep) __P((u_long, u_long)); 00139 { 00140 CDB___db_jump.j_sleep = func_sleep; 00141 return (0); 00142 } 00143 00144 int 00145 CDB_db_env_set_func_unlink(func_unlink) 00146 int (*func_unlink) __P((const char *)); 00147 { 00148 CDB___db_jump.j_unlink = func_unlink; 00149 return (0); 00150 } 00151 00152 int 00153 CDB_db_env_set_func_unmap(func_unmap) 00154 int (*func_unmap) __P((void *, size_t)); 00155 { 00156 CDB___db_jump.j_unmap = func_unmap; 00157 return (0); 00158 } 00159 00160 int 00161 CDB_db_env_set_func_write(func_write) 00162 ssize_t (*func_write) __P((int, const void *, size_t)); 00163 { 00164 CDB___db_jump.j_write = func_write; 00165 return (0); 00166 } 00167 00168 int 00169 CDB_db_env_set_func_yield(func_yield) 00170 int (*func_yield) __P((void)); 00171 { 00172 CDB___db_jump.j_yield = func_yield; 00173 return (0); 00174 } 00175 00176 int 00177 CDB_db_env_set_mutexlocks(onoff) 00178 int onoff; 00179 { 00180 DB_GLOBAL(db_mutexlocks) = onoff; 00181 return (0); 00182 } 00183 00184 int 00185 CDB_db_env_set_pageyield(onoff) 00186 int onoff; 00187 { 00188 DB_GLOBAL(db_pageyield) = onoff; 00189 return (0); 00190 } 00191 00192 int 00193 CDB_db_env_set_panicstate(onoff) 00194 int onoff; 00195 { 00196 DB_GLOBAL(db_panic) = onoff; 00197 return (0); 00198 } 00199 00200 int 00201 CDB_db_env_set_region_init(onoff) 00202 int onoff; 00203 { 00204 DB_GLOBAL(db_region_init) = onoff; 00205 return (0); 00206 } 00207 00208 int 00209 CDB_db_env_set_tas_spins(tas_spins) 00210 u_int32_t tas_spins; 00211 { 00212 DB_GLOBAL(db_tas_spins) = tas_spins; 00213 return (0); 00214 }