Changeset 988 for vendor/current/lib/tdb/tools
- Timestamp:
- Nov 24, 2016, 1:14:11 PM (9 years ago)
- Location:
- vendor/current/lib/tdb/tools
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/lib/tdb/tools/tdbbackup.c
r986 r988 1 /* 1 /* 2 2 Unix SMB/CIFS implementation. 3 3 low level tdb backup and restore utility … … 8 8 the Free Software Foundation; either version 3 of the License, or 9 9 (at your option) any later version. 10 10 11 11 This program is distributed in the hope that it will be useful, 12 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 GNU General Public License for more details. 15 15 16 16 You should have received a copy of the GNU General Public License 17 17 along with this program. If not, see <http://www.gnu.org/licenses/>. … … 62 62 { 63 63 va_list ap; 64 64 65 65 va_start(ap, format); 66 66 vfprintf(stdout, format, ap); … … 105 105 this function is also used for restore 106 106 */ 107 static int backup_tdb(const char *old_name, const char *new_name, int hash_size) 107 static int backup_tdb(const char *old_name, const char *new_name, 108 int hash_size, int nolock) 108 109 { 109 110 TDB_CONTEXT *tdb; … … 123 124 124 125 /* open the old tdb */ 125 tdb = tdb_open_ex(old_name, 0, 0, 126 tdb = tdb_open_ex(old_name, 0, 127 TDB_DEFAULT | (nolock ? TDB_NOLOCK : 0), 126 128 O_RDWR, 0, &log_ctx, NULL); 127 129 if (!tdb) { … … 133 135 /* create the new tdb */ 134 136 unlink(tmp_name); 135 tdb_new = tdb_open_ex(tmp_name, 136 hash_size ? hash_size : tdb_hash_size(tdb), 137 TDB_DEFAULT, 138 O_RDWR|O_CREAT|O_EXCL, st.st_mode & 0777, 137 tdb_new = tdb_open_ex(tmp_name, 138 hash_size ? hash_size : tdb_hash_size(tdb), 139 TDB_DEFAULT, 140 O_RDWR|O_CREAT|O_EXCL, st.st_mode & 0777, 139 141 &log_ctx, NULL); 140 142 if (!tdb_new) { … … 193 195 /* close the new tdb and re-open read-only */ 194 196 tdb_close(tdb_new); 195 tdb_new = tdb_open_ex(tmp_name, 197 tdb_new = tdb_open_ex(tmp_name, 196 198 0, 197 TDB_DEFAULT, 199 TDB_DEFAULT, 198 200 O_RDONLY, 0, 199 201 &log_ctx, NULL); … … 205 207 return 1; 206 208 } 207 209 208 210 /* traverse the new tdb to confirm */ 209 211 count2 = tdb_traverse(tdb_new, test_fn, NULL); … … 238 240 239 241 /* open the tdb */ 240 tdb = tdb_open_ex(fname, 0, 0, 242 tdb = tdb_open_ex(fname, 0, 0, 241 243 O_RDONLY, 0, &log_ctx, NULL); 242 244 … … 250 252 if (count < 0) { 251 253 printf("restoring %s\n", fname); 252 return backup_tdb(bak_name, fname, 0 );254 return backup_tdb(bak_name, fname, 0, 0); 253 255 } 254 256 … … 280 282 printf(" -v verify mode (restore if corrupt)\n"); 281 283 printf(" -n hashsize set the new hash size for the backup\n"); 282 } 283 284 printf(" -l open without locking to back up mutex dbs\n"); 285 } 284 286 285 287 int main(int argc, char *argv[]) … … 290 292 int verify = 0; 291 293 int hashsize = 0; 294 int nolock = 0; 292 295 const char *suffix = ".bak"; 293 296 294 297 log_ctx.log_fn = tdb_log; 295 298 296 while ((c = getopt(argc, argv, "vhs:n: ")) != -1) {299 while ((c = getopt(argc, argv, "vhs:n:l")) != -1) { 297 300 switch (c) { 298 301 case 'h': … … 308 311 hashsize = atoi(optarg); 309 312 break; 313 case 'l': 314 nolock = 1; 315 break; 310 316 } 311 317 } … … 331 337 } else { 332 338 if (file_newer(fname, bak_name) && 333 backup_tdb(fname, bak_name, hashsize) != 0) { 339 backup_tdb(fname, bak_name, hashsize, 340 nolock) != 0) { 334 341 ret = 1; 335 342 } -
vendor/current/lib/tdb/tools/tdbdump.c
r414 r988 1 /* 1 /* 2 2 Unix SMB/CIFS implementation. 3 3 simple tdb dump util … … 8 8 the Free Software Foundation; either version 3 of the License, or 9 9 (at your option) any later version. 10 10 11 11 This program is distributed in the hope that it will be useful, 12 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 GNU General Public License for more details. 15 15 16 16 You should have received a copy of the GNU General Public License 17 17 along with this program. If not, see <http://www.gnu.org/licenses/>. … … 52 52 } 53 53 54 static int dump_tdb(const char *fname, const char *keyname) 54 static void log_stderr(struct tdb_context *tdb, enum tdb_debug_level level, 55 const char *fmt, ...) 56 { 57 va_list ap; 58 const char *name = tdb_name(tdb); 59 const char *prefix = ""; 60 61 if (!name) 62 name = "unnamed"; 63 64 switch (level) { 65 case TDB_DEBUG_ERROR: 66 prefix = "ERROR: "; 67 break; 68 case TDB_DEBUG_WARNING: 69 prefix = "WARNING: "; 70 break; 71 case TDB_DEBUG_TRACE: 72 return; 73 74 default: 75 case TDB_DEBUG_FATAL: 76 prefix = "FATAL: "; 77 break; 78 } 79 80 va_start(ap, fmt); 81 fprintf(stderr, "tdb(%s): %s", name, prefix); 82 vfprintf(stderr, fmt, ap); 83 va_end(ap); 84 } 85 86 static void emergency_walk(TDB_DATA key, TDB_DATA dbuf, void *keyname) 87 { 88 if (keyname) { 89 if (key.dsize != strlen(keyname)) 90 return; 91 if (memcmp(key.dptr, keyname, key.dsize) != 0) 92 return; 93 } 94 traverse_fn(NULL, key, dbuf, NULL); 95 } 96 97 static int dump_tdb(const char *fname, const char *keyname, bool emergency) 55 98 { 56 99 TDB_CONTEXT *tdb; 57 100 TDB_DATA key, value; 58 59 tdb = tdb_open(fname, 0, 0, O_RDONLY, 0); 101 struct tdb_logging_context logfn = { log_stderr }; 102 int tdb_flags = TDB_DEFAULT; 103 104 /* 105 * Note: that O_RDONLY implies TDB_NOLOCK, but we want to make it 106 * explicit as it's important when working on databases which were 107 * created with mutex locking. 108 */ 109 tdb_flags |= TDB_NOLOCK; 110 111 tdb = tdb_open_ex(fname, 0, tdb_flags, O_RDONLY, 0, &logfn, NULL); 60 112 if (!tdb) { 61 113 printf("Failed to open %s\n", fname); … … 63 115 } 64 116 117 if (emergency) { 118 return tdb_rescue(tdb, emergency_walk, discard_const(keyname)) == 0; 119 } 65 120 if (!keyname) { 66 tdb_traverse(tdb, traverse_fn, NULL);121 return tdb_traverse(tdb, traverse_fn, NULL) == -1 ? 1 : 0; 67 122 } else { 68 123 key.dptr = discard_const_p(uint8_t, keyname); … … 85 140 printf( " -h this help message\n"); 86 141 printf( " -k keyname dumps value of keyname\n"); 142 printf( " -e emergency dump, for corrupt databases\n"); 87 143 } 88 144 … … 90 146 { 91 147 char *fname, *keyname=NULL; 148 bool emergency = false; 92 149 int c; 93 150 … … 97 154 } 98 155 99 while ((c = getopt( argc, argv, "hk: ")) != -1) {156 while ((c = getopt( argc, argv, "hk:e")) != -1) { 100 157 switch (c) { 101 158 case 'h': … … 104 161 case 'k': 105 162 keyname = optarg; 163 break; 164 case 'e': 165 emergency = true; 106 166 break; 107 167 default: … … 113 173 fname = argv[optind]; 114 174 115 return dump_tdb(fname, keyname );175 return dump_tdb(fname, keyname, emergency); 116 176 } -
vendor/current/lib/tdb/tools/tdbrestore.c
r986 r988 18 18 */ 19 19 20 #include "replace.h" 20 21 #include <assert.h> 21 #include "replace.h"22 22 #include "system/locale.h" 23 23 #include "system/time.h" … … 25 25 #include "system/wait.h" 26 26 #include "tdb.h" 27 28 #define debug_fprintf(file, fmt, ...) do {/*nothing*/} while (0)29 27 30 28 static int read_linehead(FILE *f) … … 171 169 goto fail; 172 170 } 173 if (tdb_store(tdb, key, data, TDB_INSERT) == -1) {171 if (tdb_store(tdb, key, data, TDB_INSERT) != 0) { 174 172 fprintf(stderr, "TDB error: %s\n", tdb_errorstr(tdb)); 175 173 goto fail; … … 207 205 return 1; 208 206 } 209 fprintf(stderr, "EOF\n");210 207 return 0; 211 208 } -
vendor/current/lib/tdb/tools/tdbtest.c
r986 r988 25 25 { 26 26 gettimeofday(&tp2,NULL); 27 return((tp2.tv_sec - tp1.tv_sec) + 27 return((tp2.tv_sec - tp1.tv_sec) + 28 28 (tp2.tv_usec - tp1.tv_usec)*1.0e-6); 29 29 } … … 41 41 { 42 42 va_list ap; 43 43 44 44 va_start(ap, format); 45 45 vfprintf(stdout, format, ap); … … 190 190 char tdata[] = "test"; 191 191 TDB_DATA key, data; 192 192 193 193 for (i = 0; i < 5; i++) { 194 194 snprintf(keys[i],2, "%d", i); 195 195 key.dptr = keys[i]; 196 196 key.dsize = 2; 197 197 198 198 data.dptr = tdata; 199 199 data.dsize = 4; 200 200 201 201 if (tdb_store(db, key, data, TDB_REPLACE) != 0) { 202 202 fatal("tdb_store failed"); … … 249 249 db = tdb_open(test_tdb, 0, TDB_CLEAR_IF_FIRST, 250 250 O_RDWR | O_CREAT | O_TRUNC, 0600); 251 gdbm = gdbm_open(test_gdbm, 512, GDBM_WRITER|GDBM_NEWDB|GDBM_FAST, 251 gdbm = gdbm_open(test_gdbm, 512, GDBM_WRITER|GDBM_NEWDB|GDBM_FAST, 252 252 0600, NULL); 253 253 -
vendor/current/lib/tdb/tools/tdbtool.c
r986 r988 1 /* 1 /* 2 2 Unix SMB/CIFS implementation. 3 3 Samba database functions … … 11 11 the Free Software Foundation; either version 3 of the License, or 12 12 (at your option) any later version. 13 13 14 14 This program is distributed in the hope that it will be useful, 15 15 but WITHOUT ANY WARRANTY; without even the implied warranty of 16 16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 17 GNU General Public License for more details. 18 18 19 19 You should have received a copy of the GNU General Public License 20 20 along with this program. If not, see <http://www.gnu.org/licenses/>. … … 37 37 char cmdline[1024]; 38 38 static int disable_mmap; 39 static int disable_lock; 39 40 40 41 enum commands { … … 55 56 CMD_LIST_HASH_FREE, 56 57 CMD_LIST_FREE, 58 CMD_FREELIST_SIZE, 57 59 CMD_INFO, 58 60 CMD_MMAP, … … 62 64 CMD_SYSTEM, 63 65 CMD_CHECK, 66 CMD_REPACK, 64 67 CMD_QUIT, 65 68 CMD_HELP … … 88 91 {"list", CMD_LIST_HASH_FREE}, 89 92 {"free", CMD_LIST_FREE}, 93 {"freelist_size", CMD_FREELIST_SIZE}, 90 94 {"info", CMD_INFO}, 91 95 {"speed", CMD_SPEED}, … … 99 103 {"q", CMD_QUIT}, 100 104 {"!", CMD_SYSTEM}, 105 {"repack", CMD_REPACK}, 101 106 {NULL, CMD_HELP} 102 107 }; … … 112 117 { 113 118 gettimeofday(&tp2,NULL); 114 return((tp2.tv_sec - tp1.tv_sec) + 119 return((tp2.tv_sec - tp1.tv_sec) + 115 120 (tp2.tv_usec - tp1.tv_usec)*1.0e-6); 121 } 122 123 #ifdef PRINTF_ATTRIBUTE 124 static void tdb_log_open(struct tdb_context *tdb, enum tdb_debug_level level, 125 const char *format, ...) PRINTF_ATTRIBUTE(3,4); 126 #endif 127 static void tdb_log_open(struct tdb_context *tdb, enum tdb_debug_level level, 128 const char *format, ...) 129 { 130 const char *mutex_msg = 131 "Can use mutexes only with MUTEX_LOCKING or NOLOCK\n"; 132 char *p; 133 va_list ap; 134 135 p = strstr(format, mutex_msg); 136 if (p != NULL) { 137 /* 138 * Yes, this is a hack, but we don't want to see this 139 * message on first open, but we want to see 140 * everything else. 141 */ 142 return; 143 } 144 145 va_start(ap, format); 146 vfprintf(stderr, format, ap); 147 va_end(ap); 116 148 } 117 149 … … 159 191 i++; 160 192 if (i%8 == 0) printf(" "); 161 if (i%16 == 0) { 193 if (i%16 == 0) { 162 194 print_asc(&buf[i-16],8); printf(" "); 163 195 print_asc(&buf[i-8],8); printf("\n"); … … 167 199 if (i%16) { 168 200 int n; 169 201 170 202 n = 16 - (i%16); 171 203 printf(" "); 172 204 if (n>8) printf(" "); 173 205 while (n--) printf(" "); 174 206 175 207 n = i%16; 176 208 if (n > 8) n = 8; 177 209 print_asc(&buf[i-(i%16)],n); printf(" "); 178 210 n = (i%16) - n; 179 if (n>0) print_asc(&buf[i-n],n); 180 printf("\n"); 211 if (n>0) print_asc(&buf[i-n],n); 212 printf("\n"); 181 213 } 182 214 } … … 203 235 " list : print the database hash table and freelist\n" 204 236 " free : print the database freelist\n" 237 " freelist_size : print the number of records in the freelist\n" 205 238 " check : check the integrity of an opened database\n" 239 " repack : repack the database\n" 206 240 " speed : perform speed tests on the database\n" 207 241 " ! command : execute system command\n" … … 220 254 static void create_tdb(const char *tdbname) 221 255 { 222 struct tdb_logging_context log_ctx ;256 struct tdb_logging_context log_ctx = { NULL, NULL}; 223 257 log_ctx.log_fn = tdb_log; 224 258 225 259 if (tdb) tdb_close(tdb); 226 tdb = tdb_open_ex(tdbname, 0, TDB_CLEAR_IF_FIRST | (disable_mmap?TDB_NOMMAP:0), 260 tdb = tdb_open_ex(tdbname, 0, 261 TDB_CLEAR_IF_FIRST | 262 (disable_mmap?TDB_NOMMAP:0) | 263 (disable_lock?TDB_NOLOCK:0), 227 264 O_RDWR | O_CREAT | O_TRUNC, 0600, &log_ctx, NULL); 228 265 if (!tdb) { … … 233 270 static void open_tdb(const char *tdbname) 234 271 { 235 struct tdb_logging_context log_ctx; 272 struct tdb_logging_context log_ctx = { NULL, NULL }; 273 log_ctx.log_fn = tdb_log_open; 274 275 if (tdb) tdb_close(tdb); 276 tdb = tdb_open_ex(tdbname, 0, 277 (disable_mmap?TDB_NOMMAP:0) | 278 (disable_lock?TDB_NOLOCK:0), 279 O_RDWR, 0600, 280 &log_ctx, NULL); 281 236 282 log_ctx.log_fn = tdb_log; 237 238 if (tdb) tdb_close(tdb); 239 tdb = tdb_open_ex(tdbname, 0, disable_mmap?TDB_NOMMAP:0, O_RDWR, 0600, 240 &log_ctx, NULL); 283 if (tdb != NULL) { 284 tdb_set_logging_function(tdb, &log_ctx); 285 } 286 287 if ((tdb == NULL) && (errno == EINVAL)) { 288 /* 289 * Retry NOLOCK and readonly. There we want to see all 290 * error messages. 291 */ 292 tdb = tdb_open_ex(tdbname, 0, 293 (disable_mmap?TDB_NOMMAP:0) |TDB_NOLOCK, 294 O_RDONLY, 0600, 295 &log_ctx, NULL); 296 } 297 241 298 if (!tdb) { 242 299 printf("Could not open %s: %s\n", tdbname, strerror(errno)); … … 258 315 dbuf.dsize = datalen; 259 316 260 if (tdb_store(tdb, key, dbuf, TDB_INSERT) == -1) {317 if (tdb_store(tdb, key, dbuf, TDB_INSERT) != 0) { 261 318 terror("insert failed"); 262 319 } … … 285 342 print_rec(tdb, key, dbuf, NULL); 286 343 287 if (tdb_store(tdb, key, dbuf, TDB_REPLACE) == -1) {344 if (tdb_store(tdb, key, dbuf, TDB_REPLACE) != 0) { 288 345 terror("store failed"); 289 346 } … … 307 364 return; 308 365 } 309 366 310 367 print_rec(tdb, key, dbuf, NULL); 311 368 312 369 free( dbuf.dptr ); 313 370 314 371 return; 315 372 } … … 355 412 return; 356 413 } 357 414 358 415 print_rec(tdb, key, dbuf, NULL); 359 416 360 417 dst_tdb = tdb_open(tdbname, 0, 0, O_RDWR, 0600); 361 418 if ( !dst_tdb ) { … … 363 420 return; 364 421 } 365 366 if ( tdb_store( dst_tdb, key, dbuf, TDB_REPLACE ) == -1) {422 423 if (tdb_store( dst_tdb, key, dbuf, TDB_REPLACE ) != 0) { 367 424 terror("failed to move record"); 368 425 } 369 426 else 370 427 printf("record moved\n"); 371 428 372 429 tdb_close( dst_tdb ); 373 430 374 431 return; 375 432 } … … 448 505 _start_timer(); 449 506 do { 450 long int r = random(); 451 TDB_DATA key, dbuf; 507 TDB_DATA key; 452 508 key.dptr = discard_const_p(uint8_t, str); 453 509 key.dsize = strlen((char *)key.dptr); 454 dbuf.dptr = (uint8_t *) &r;455 dbuf.dsize = sizeof(r);456 510 tdb_fetch(tdb, key); 457 511 t = _end_timer(); … … 521 575 TDB_DATA dbuf; 522 576 *pkey = tdb_firstkey(the_tdb); 523 577 524 578 dbuf = tdb_fetch(the_tdb, *pkey); 525 579 if (!dbuf.dptr) terror("fetch failed"); … … 533 587 TDB_DATA dbuf; 534 588 *pkey = tdb_nextkey(the_tdb, *pkey); 535 589 536 590 dbuf = tdb_fetch(the_tdb, *pkey); 537 if (!dbuf.dptr) 591 if (!dbuf.dptr) 538 592 terror("fetch failed"); 539 593 else … … 612 666 tdb_transaction_commit(tdb); 613 667 return 0; 668 case CMD_REPACK: 669 bIterate = 0; 670 tdb_repack(tdb); 671 return 0; 614 672 case CMD_TRANSACTION_CANCEL: 615 673 bIterate = 0; … … 656 714 tdb_printfreelist(tdb); 657 715 return 0; 716 case CMD_FREELIST_SIZE: { 717 int size; 718 719 size = tdb_freelist_size(tdb); 720 if (size < 0) { 721 printf("Error getting freelist size.\n"); 722 } else { 723 printf("freelist size: %d\n", size); 724 } 725 726 return 0; 727 } 658 728 case CMD_INFO: 659 729 info_tdb(); … … 694 764 } 695 765 696 static char * convert_string(char *instring, size_t *sizep)766 static char *tdb_convert_string(char *instring, size_t *sizep) 697 767 { 698 768 size_t length = 0; … … 732 802 arg2 = NULL; 733 803 arg2len = 0; 804 805 if (argv[1] && (strcmp(argv[1], "-l") == 0)) { 806 disable_lock = 1; 807 argv[1] = argv[0]; 808 argv += 1; 809 argc -= 1; 810 } 734 811 735 812 if (argv[1]) { … … 760 837 } 761 838 } 762 if (arg1) arg1 = convert_string(arg1,&arg1len);763 if (arg2) arg2 = convert_string(arg2,&arg2len);839 if (arg1) arg1 = tdb_convert_string(arg1,&arg1len); 840 if (arg2) arg2 = tdb_convert_string(arg2,&arg2len); 764 841 if (do_command()) break; 765 842 } 766 843 break; 767 844 case 5: 768 arg2 = convert_string(argv[4],&arg2len);845 arg2 = tdb_convert_string(argv[4],&arg2len); 769 846 case 4: 770 arg1 = convert_string(argv[3],&arg1len);847 arg1 = tdb_convert_string(argv[3],&arg1len); 771 848 case 3: 772 849 cmdname = argv[2]; -
vendor/current/lib/tdb/tools/tdbtorture.c
r986 r988 1 1 /* this tests tdb by doing lots of ops from several simultaneous 2 writers - that stresses the locking code. 2 writers - that stresses the locking code. 3 3 */ 4 4 … … 34 34 static int loopnum; 35 35 static int count_pipe; 36 static bool mutex = false; 36 37 static struct tdb_logging_context log_ctx; 37 38 … … 60 61 free(ptr); 61 62 } 62 #endif 63 #endif 63 64 } 64 65 … … 217 218 static void usage(void) 218 219 { 219 printf("Usage: tdbtorture [-t] [-k] [- n NUM_PROCS] [-l NUM_LOOPS] [-s SEED] [-H HASH_SIZE]\n");220 printf("Usage: tdbtorture [-t] [-k] [-m] [-n NUM_PROCS] [-l NUM_LOOPS] [-s SEED] [-H HASH_SIZE]\n"); 220 221 exit(0); 221 222 } … … 231 232 static int run_child(const char *filename, int i, int seed, unsigned num_loops, unsigned start) 232 233 { 233 db = tdb_open_ex(filename, hash_size, TDB_DEFAULT, 234 int tdb_flags = TDB_DEFAULT|TDB_CLEAR_IF_FIRST|TDB_INCOMPATIBLE_HASH; 235 236 if (mutex) { 237 tdb_flags |= TDB_MUTEX_LOCKING; 238 } 239 240 db = tdb_open_ex(filename, hash_size, tdb_flags, 234 241 O_RDWR | O_CREAT, 0600, &log_ctx, NULL); 235 242 if (!db) { … … 303 310 log_ctx.log_fn = tdb_log; 304 311 305 while ((c = getopt(argc, argv, "n:l:s:H:thk ")) != -1) {312 while ((c = getopt(argc, argv, "n:l:s:H:thkm")) != -1) { 306 313 switch (c) { 307 314 case 'n': … … 323 330 kill_random = 1; 324 331 break; 332 case 'm': 333 mutex = tdb_runtime_check_for_robust_mutexes(); 334 if (!mutex) { 335 printf("tdb_runtime_check_for_robust_mutexes() returned false\n"); 336 exit(1); 337 } 338 break; 325 339 default: 326 340 usage(); … … 335 349 seed = (getpid() + time(NULL)) & 0x7FFFFFFF; 336 350 } 351 352 printf("Testing with %d processes, %d loops, %d hash_size, seed=%d%s\n", 353 num_procs, num_loops, hash_size, seed, 354 (always_transaction ? " (all within transactions)" : "")); 337 355 338 356 if (num_procs == 1 && !kill_random) { … … 343 361 344 362 pids = (pid_t *)calloc(sizeof(pid_t), num_procs); 363 if (pids == NULL) { 364 perror("Unable to allocate memory for pids"); 365 exit(1); 366 } 345 367 done = (int *)calloc(sizeof(int), num_procs); 368 if (done == NULL) { 369 perror("Unable to allocate memory for done"); 370 exit(1); 371 } 346 372 347 373 if (pipe(pfds) != 0) { … … 354 380 if ((pids[i]=fork()) == 0) { 355 381 close(pfds[0]); 356 if (i == 0) {357 printf("Testing with %d processes, %d loops, %d hash_size, seed=%d%s\n",358 num_procs, num_loops, hash_size, seed, always_transaction ? " (all within transactions)" : "");359 }360 382 exit(run_child(test_tdb, i, seed, num_loops, 0)); 361 383 } … … 436 458 done: 437 459 if (error_count == 0) { 438 db = tdb_open_ex(test_tdb, hash_size, TDB_DEFAULT, 460 int tdb_flags = TDB_DEFAULT; 461 462 if (mutex) { 463 tdb_flags |= TDB_NOLOCK; 464 } 465 466 db = tdb_open_ex(test_tdb, hash_size, tdb_flags, 439 467 O_RDWR, 0, &log_ctx, NULL); 440 468 if (!db) { 441 fatal("db open failed"); 469 fatal("db open failed\n"); 470 exit(1); 442 471 } 443 472 if (tdb_check(db, NULL, NULL) == -1) { 444 printf("db check failed ");473 printf("db check failed\n"); 445 474 exit(1); 446 475 }
Note:
See TracChangeset
for help on using the changeset viewer.