… | |
… | |
6 | |
6 | |
7 | #include "EXTERN.h" |
7 | #include "EXTERN.h" |
8 | #include "perl.h" |
8 | #include "perl.h" |
9 | #include "XSUB.h" |
9 | #include "XSUB.h" |
10 | |
10 | |
|
|
11 | #include "schmorp.h" |
|
|
12 | |
11 | // perl stupidly defines these as macros, breaking |
13 | // perl stupidly defines these as argument-less macros, breaking |
12 | // lots and lots of code. |
14 | // lots and lots of code. |
13 | #undef open |
15 | #undef open |
14 | #undef close |
16 | #undef close |
15 | #undef abort |
17 | #undef abort |
16 | #undef malloc |
18 | #undef malloc |
… | |
… | |
149 | |
151 | |
150 | enum { |
152 | enum { |
151 | REQ_QUIT, |
153 | REQ_QUIT, |
152 | REQ_ENV_OPEN, REQ_ENV_CLOSE, REQ_ENV_TXN_CHECKPOINT, REQ_ENV_LOCK_DETECT, |
154 | REQ_ENV_OPEN, REQ_ENV_CLOSE, REQ_ENV_TXN_CHECKPOINT, REQ_ENV_LOCK_DETECT, |
153 | REQ_ENV_MEMP_SYNC, REQ_ENV_MEMP_TRICKLE, REQ_ENV_DBREMOVE, REQ_ENV_DBRENAME, |
155 | REQ_ENV_MEMP_SYNC, REQ_ENV_MEMP_TRICKLE, REQ_ENV_DBREMOVE, REQ_ENV_DBRENAME, |
|
|
156 | REQ_ENV_LOG_ARCHIVE, |
154 | REQ_DB_OPEN, REQ_DB_CLOSE, REQ_DB_COMPACT, REQ_DB_SYNC, REQ_DB_UPGRADE, |
157 | REQ_DB_OPEN, REQ_DB_CLOSE, REQ_DB_COMPACT, REQ_DB_SYNC, REQ_DB_VERIFY, REQ_DB_UPGRADE, |
155 | REQ_DB_PUT, REQ_DB_EXISTS, REQ_DB_GET, REQ_DB_PGET, REQ_DB_DEL, REQ_DB_KEY_RANGE, |
158 | REQ_DB_PUT, REQ_DB_EXISTS, REQ_DB_GET, REQ_DB_PGET, REQ_DB_DEL, REQ_DB_KEY_RANGE, |
156 | REQ_TXN_COMMIT, REQ_TXN_ABORT, REQ_TXN_FINISH, |
159 | REQ_TXN_COMMIT, REQ_TXN_ABORT, REQ_TXN_FINISH, |
157 | REQ_C_CLOSE, REQ_C_COUNT, REQ_C_PUT, REQ_C_GET, REQ_C_PGET, REQ_C_DEL, |
160 | REQ_C_CLOSE, REQ_C_COUNT, REQ_C_PUT, REQ_C_GET, REQ_C_PGET, REQ_C_DEL, |
158 | REQ_SEQ_OPEN, REQ_SEQ_CLOSE, REQ_SEQ_GET, REQ_SEQ_REMOVE, |
161 | REQ_SEQ_OPEN, REQ_SEQ_CLOSE, REQ_SEQ_GET, REQ_SEQ_REMOVE, |
159 | }; |
162 | }; |
… | |
… | |
244 | } |
247 | } |
245 | |
248 | |
246 | static volatile unsigned int nreqs, nready, npending; |
249 | static volatile unsigned int nreqs, nready, npending; |
247 | static volatile unsigned int max_idle = 4; |
250 | static volatile unsigned int max_idle = 4; |
248 | static volatile unsigned int max_outstanding = 0xffffffff; |
251 | static volatile unsigned int max_outstanding = 0xffffffff; |
249 | static int respipe_osf [2], respipe [2] = { -1, -1 }; |
252 | static s_epipe respipe; |
250 | |
253 | |
251 | static mutex_t reslock = X_MUTEX_INIT; |
254 | static mutex_t reslock = X_MUTEX_INIT; |
252 | static mutex_t reqlock = X_MUTEX_INIT; |
255 | static mutex_t reqlock = X_MUTEX_INIT; |
253 | static cond_t reqwait = X_COND_INIT; |
256 | static cond_t reqwait = X_COND_INIT; |
254 | |
257 | |
… | |
… | |
377 | |
380 | |
378 | av_push (av, newSVnv (req->key_range.less)); |
381 | av_push (av, newSVnv (req->key_range.less)); |
379 | av_push (av, newSVnv (req->key_range.equal)); |
382 | av_push (av, newSVnv (req->key_range.equal)); |
380 | av_push (av, newSVnv (req->key_range.greater)); |
383 | av_push (av, newSVnv (req->key_range.greater)); |
381 | |
384 | |
|
|
385 | av = (AV *)newRV_noinc ((SV *)av); |
|
|
386 | |
382 | SvREADONLY_off (req->sv1); |
387 | SvREADONLY_off (req->sv1); |
383 | sv_setsv_mg (req->sv1, newRV_noinc ((SV *)av)); |
388 | sv_setsv_mg (req->sv1, newRV_noinc ((SV *)av)); |
|
|
389 | SvREFCNT_dec (av); |
384 | SvREFCNT_dec (req->sv1); |
390 | SvREFCNT_dec (req->sv1); |
385 | } |
391 | } |
386 | break; |
392 | break; |
387 | |
393 | |
388 | #if DB_VERSION_MINOR >= 3 |
394 | #if DB_VERSION_MINOR >= 3 |
… | |
… | |
395 | sv_setnv_mg (req->sv1, (NV)req->seq_t); |
401 | sv_setnv_mg (req->sv1, (NV)req->seq_t); |
396 | |
402 | |
397 | SvREFCNT_dec (req->sv1); |
403 | SvREFCNT_dec (req->sv1); |
398 | break; |
404 | break; |
399 | #endif |
405 | #endif |
|
|
406 | |
|
|
407 | case REQ_ENV_LOG_ARCHIVE: |
|
|
408 | { |
|
|
409 | AV *av = newAV (); |
|
|
410 | char **listp = (char **)req->buf1; |
|
|
411 | |
|
|
412 | if (listp) |
|
|
413 | while (*listp) |
|
|
414 | av_push (av, newSVpv (*listp, 0)), ++listp; |
|
|
415 | |
|
|
416 | av = (AV *)newRV_noinc ((SV *)av); |
|
|
417 | |
|
|
418 | SvREADONLY_off (req->sv1); |
|
|
419 | sv_setsv_mg (req->sv1, (SV *)av); |
|
|
420 | SvREFCNT_dec (av); |
|
|
421 | SvREFCNT_dec (req->sv1); |
|
|
422 | } |
|
|
423 | break; |
400 | } |
424 | } |
401 | |
425 | |
402 | errno = req->result; |
426 | errno = req->result; |
403 | |
427 | |
404 | if (req->callback) |
428 | if (req->callback) |
… | |
… | |
434 | free (req->buf3); |
458 | free (req->buf3); |
435 | |
459 | |
436 | Safefree (req); |
460 | Safefree (req); |
437 | } |
461 | } |
438 | |
462 | |
439 | #ifdef USE_SOCKETS_AS_HANDLES |
|
|
440 | # define TO_SOCKET(x) (win32_get_osfhandle (x)) |
|
|
441 | #else |
|
|
442 | # define TO_SOCKET(x) (x) |
|
|
443 | #endif |
|
|
444 | |
|
|
445 | static void |
463 | static void |
446 | create_respipe (void) |
464 | create_respipe (void) |
447 | { |
465 | { |
448 | #ifdef _WIN32 |
|
|
449 | int arg; /* argg */ |
|
|
450 | #endif |
|
|
451 | int old_readfd = respipe [0]; |
|
|
452 | |
|
|
453 | if (respipe [1] >= 0) |
|
|
454 | respipe_close (TO_SOCKET (respipe [1])); |
|
|
455 | |
|
|
456 | #ifdef _WIN32 |
|
|
457 | if (PerlSock_socketpair (AF_UNIX, SOCK_STREAM, 0, respipe)) |
|
|
458 | #else |
|
|
459 | if (pipe (respipe)) |
466 | if (s_epipe_renew (&respipe)) |
460 | #endif |
467 | croak ("BDB: unable to create event pipe"); |
461 | croak ("unable to initialize result pipe"); |
|
|
462 | |
|
|
463 | if (old_readfd >= 0) |
|
|
464 | { |
|
|
465 | if (dup2 (TO_SOCKET (respipe [0]), TO_SOCKET (old_readfd)) < 0) |
|
|
466 | croak ("unable to initialize result pipe(2)"); |
|
|
467 | |
|
|
468 | respipe_close (respipe [0]); |
|
|
469 | respipe [0] = old_readfd; |
|
|
470 | } |
|
|
471 | |
|
|
472 | #ifdef _WIN32 |
|
|
473 | arg = 1; |
|
|
474 | if (ioctlsocket (TO_SOCKET (respipe [0]), FIONBIO, &arg) |
|
|
475 | || ioctlsocket (TO_SOCKET (respipe [1]), FIONBIO, &arg)) |
|
|
476 | #else |
|
|
477 | if (fcntl (respipe [0], F_SETFL, O_NONBLOCK) |
|
|
478 | || fcntl (respipe [1], F_SETFL, O_NONBLOCK)) |
|
|
479 | #endif |
|
|
480 | croak ("unable to initialize result pipe(3)"); |
|
|
481 | |
|
|
482 | respipe_osf [0] = TO_SOCKET (respipe [0]); |
|
|
483 | respipe_osf [1] = TO_SOCKET (respipe [1]); |
|
|
484 | } |
468 | } |
485 | |
469 | |
486 | static void bdb_request (bdb_req req); |
470 | static void bdb_request (bdb_req req); |
487 | X_THREAD_PROC (bdb_proc); |
471 | X_THREAD_PROC (bdb_proc); |
488 | |
472 | |
… | |
… | |
638 | if (size) |
622 | if (size) |
639 | return; |
623 | return; |
640 | |
624 | |
641 | maybe_start_thread (); |
625 | maybe_start_thread (); |
642 | |
626 | |
643 | FD_ZERO (&rfd); |
627 | s_epipe_wait (&respipe); |
644 | FD_SET (respipe [0], &rfd); |
|
|
645 | |
|
|
646 | PerlSock_select (respipe [0] + 1, &rfd, 0, 0, 0); |
|
|
647 | } |
628 | } |
648 | } |
629 | } |
649 | |
630 | |
650 | static int poll_cb (void) |
631 | static int poll_cb (void) |
651 | { |
632 | { |
… | |
… | |
671 | if (req) |
652 | if (req) |
672 | { |
653 | { |
673 | --npending; |
654 | --npending; |
674 | |
655 | |
675 | if (!res_queue.size) |
656 | if (!res_queue.size) |
676 | { |
|
|
677 | /* read any signals sent by the worker threads */ |
657 | /* read any signals sent by the worker threads */ |
678 | char buf [4]; |
658 | s_epipe_drain (&respipe); |
679 | while (respipe_read (respipe [0], buf, 4) == 4) |
|
|
680 | ; |
|
|
681 | } |
|
|
682 | } |
659 | } |
683 | |
660 | |
684 | X_UNLOCK (reslock); |
661 | X_UNLOCK (reslock); |
685 | |
662 | |
686 | if (!req) |
663 | if (!req) |
… | |
… | |
768 | req->result = req->db->close (req->db, req->uint1); |
745 | req->result = req->db->close (req->db, req->uint1); |
769 | break; |
746 | break; |
770 | |
747 | |
771 | #if DB_VERSION_MINOR >= 4 |
748 | #if DB_VERSION_MINOR >= 4 |
772 | case REQ_DB_COMPACT: |
749 | case REQ_DB_COMPACT: |
773 | req->result = req->db->compact (req->db, req->txn, &req->dbt1, &req->dbt2, 0, req->uint1, 0); |
750 | req->result = req->db->compact (req->db, req->txn, req->dbt1.data ? &req->dbt1 : 0, req->dbt2.data ? &req->dbt2 : 0, 0, req->uint1, 0); |
774 | break; |
751 | break; |
775 | #endif |
752 | #endif |
776 | |
753 | |
777 | case REQ_DB_SYNC: |
754 | case REQ_DB_SYNC: |
778 | req->result = req->db->sync (req->db, req->uint1); |
755 | req->result = req->db->sync (req->db, req->uint1); |
|
|
756 | break; |
|
|
757 | |
|
|
758 | case REQ_DB_VERIFY: |
|
|
759 | req->result = req->db->verify (req->db, req->buf1, req->buf2, 0, req->uint1); |
779 | break; |
760 | break; |
780 | |
761 | |
781 | case REQ_DB_UPGRADE: |
762 | case REQ_DB_UPGRADE: |
782 | req->result = req->db->upgrade (req->db, req->buf1, req->uint1); |
763 | req->result = req->db->upgrade (req->db, req->buf1, req->uint1); |
783 | break; |
764 | break; |
… | |
… | |
870 | case REQ_SEQ_REMOVE: |
851 | case REQ_SEQ_REMOVE: |
871 | req->result = req->seq->remove (req->seq, req->txn, req->uint1); |
852 | req->result = req->seq->remove (req->seq, req->txn, req->uint1); |
872 | break; |
853 | break; |
873 | #endif |
854 | #endif |
874 | |
855 | |
|
|
856 | case REQ_ENV_LOG_ARCHIVE: |
|
|
857 | { |
|
|
858 | char **listp = 0; /* DB_ARCH_REMOVE does not touch listp, contrary to docs */ |
|
|
859 | req->result = req->env->log_archive (req->env, &listp, req->uint1); |
|
|
860 | req->buf1 = (char *)listp; |
|
|
861 | } |
|
|
862 | break; |
|
|
863 | |
875 | default: |
864 | default: |
876 | req->result = ENOSYS; |
865 | req->result = ENOSYS; |
877 | break; |
866 | break; |
878 | } |
867 | } |
879 | |
868 | |
… | |
… | |
890 | /* try to distribute timeouts somewhat evenly */ |
879 | /* try to distribute timeouts somewhat evenly */ |
891 | ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL); |
880 | ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL); |
892 | |
881 | |
893 | for (;;) |
882 | for (;;) |
894 | { |
883 | { |
895 | ts.tv_sec = time (0) + IDLE_TIMEOUT; |
884 | ts.tv_sec = time (0) + IDLE_TIMEOUT; |
896 | |
885 | |
897 | X_LOCK (reqlock); |
886 | X_LOCK (reqlock); |
898 | |
887 | |
899 | for (;;) |
888 | for (;;) |
900 | { |
889 | { |
… | |
… | |
945 | X_LOCK (reslock); |
934 | X_LOCK (reslock); |
946 | |
935 | |
947 | ++npending; |
936 | ++npending; |
948 | |
937 | |
949 | if (!reqq_push (&res_queue, req)) |
938 | if (!reqq_push (&res_queue, req)) |
950 | /* write a dummy byte to the pipe so fh becomes ready */ |
939 | s_epipe_signal (&respipe); |
951 | respipe_write (respipe_osf [1], (const void *)&respipe_osf, 1); |
|
|
952 | |
940 | |
953 | self->req = 0; |
941 | self->req = 0; |
954 | worker_clear (self); |
942 | worker_clear (self); |
955 | |
943 | |
956 | X_UNLOCK (reslock); |
944 | X_UNLOCK (reslock); |
… | |
… | |
1132 | } |
1120 | } |
1133 | } |
1121 | } |
1134 | |
1122 | |
1135 | return 0; |
1123 | return 0; |
1136 | } |
1124 | } |
|
|
1125 | |
|
|
1126 | /*****************************************************************************/ |
|
|
1127 | |
|
|
1128 | #if 0 |
|
|
1129 | static int |
|
|
1130 | bt_pfxc_compare (DB *db, const DBT *dbt1, const DBT *dbt2) |
|
|
1131 | { |
|
|
1132 | ssize_t size1 = dbt1->size; |
|
|
1133 | ssize_t size2 = dbt2->size; |
|
|
1134 | int res = memcmp ((void *)dbt1->data, (void *)dbt2->data, |
|
|
1135 | size1 <= size2 ? size1 : size2); |
|
|
1136 | |
|
|
1137 | if (res) |
|
|
1138 | return res; |
|
|
1139 | else if (size1 - size2) |
|
|
1140 | return size1 - size2; |
|
|
1141 | else |
|
|
1142 | return 0; |
|
|
1143 | } |
|
|
1144 | |
|
|
1145 | static size_t |
|
|
1146 | bt_pfxc_prefix_x (DB *db, const DBT *dbt1, const DBT *dbt2) |
|
|
1147 | { |
|
|
1148 | ssize_t size1 = dbt1->size; |
|
|
1149 | ssize_t size2 = dbt2->size; |
|
|
1150 | u_int8_t *p1 = (u_int8_t *)dbt1->data; |
|
|
1151 | u_int8_t *p2 = (u_int8_t *)dbt2->data; |
|
|
1152 | u_int8_t *pe = p1 + (size1 <= size2 ? size1 : size2); |
|
|
1153 | |
|
|
1154 | while (p1 < pe) |
|
|
1155 | if (*p1++ != *p2++) |
|
|
1156 | return p1 - (u_int8_t *)dbt1->data - 1; |
|
|
1157 | |
|
|
1158 | if (size1 < size2) return size1 + 1; |
|
|
1159 | if (size1 > size2) return size2 + 1; |
|
|
1160 | |
|
|
1161 | return size1; |
|
|
1162 | } |
|
|
1163 | #endif |
|
|
1164 | |
|
|
1165 | /*****************************************************************************/ |
1137 | |
1166 | |
1138 | /* stupid windows defines CALLBACK as well */ |
1167 | /* stupid windows defines CALLBACK as well */ |
1139 | #undef CALLBACK |
1168 | #undef CALLBACK |
1140 | #define CALLBACK SV *cb = pop_callback (&items, ST (items - 1)); |
1169 | #define CALLBACK SV *cb = pop_callback (&items, ST (items - 1)); |
1141 | |
1170 | |
… | |
… | |
1278 | const_iv (REP_UNAVAIL) |
1307 | const_iv (REP_UNAVAIL) |
1279 | const_iv (RUNRECOVERY) |
1308 | const_iv (RUNRECOVERY) |
1280 | const_iv (SECONDARY_BAD) |
1309 | const_iv (SECONDARY_BAD) |
1281 | const_iv (VERIFY_BAD) |
1310 | const_iv (VERIFY_BAD) |
1282 | |
1311 | |
|
|
1312 | const_iv (SALVAGE) |
|
|
1313 | const_iv (AGGRESSIVE) |
|
|
1314 | const_iv (PRINTABLE) |
|
|
1315 | const_iv (NOORDERCHK) |
|
|
1316 | const_iv (ORDERCHKONLY) |
|
|
1317 | |
|
|
1318 | const_iv (ARCH_ABS) |
|
|
1319 | const_iv (ARCH_DATA) |
|
|
1320 | const_iv (ARCH_LOG) |
|
|
1321 | const_iv (ARCH_REMOVE) |
|
|
1322 | |
1283 | const_iv (VERB_DEADLOCK) |
1323 | const_iv (VERB_DEADLOCK) |
1284 | const_iv (VERB_RECOVERY) |
1324 | const_iv (VERB_RECOVERY) |
1285 | const_iv (VERB_REPLICATION) |
1325 | const_iv (VERB_REPLICATION) |
1286 | const_iv (VERB_WAITSFOR) |
1326 | const_iv (VERB_WAITSFOR) |
1287 | |
1327 | |
… | |
… | |
1320 | const_iv (PRIORITY_VERY_LOW) |
1360 | const_iv (PRIORITY_VERY_LOW) |
1321 | const_iv (PRIORITY_LOW) |
1361 | const_iv (PRIORITY_LOW) |
1322 | const_iv (PRIORITY_DEFAULT) |
1362 | const_iv (PRIORITY_DEFAULT) |
1323 | const_iv (PRIORITY_HIGH) |
1363 | const_iv (PRIORITY_HIGH) |
1324 | const_iv (PRIORITY_VERY_HIGH) |
1364 | const_iv (PRIORITY_VERY_HIGH) |
|
|
1365 | const_iv (IGNORE_LEASE) |
1325 | #endif |
1366 | #endif |
1326 | #if DB_VERSION_MINOR >= 7 |
1367 | #if DB_VERSION_MINOR >= 7 |
1327 | const_iv (IGNORE_LEASE) |
|
|
1328 | //const_iv (MULTIPLE_KEY) |
1368 | //const_iv (MULTIPLE_KEY) |
1329 | const_iv (LOG_DIRECT) |
1369 | const_iv (LOG_DIRECT) |
1330 | const_iv (LOG_DSYNC) |
1370 | const_iv (LOG_DSYNC) |
1331 | const_iv (LOG_AUTO_REMOVE) |
1371 | const_iv (LOG_AUTO_REMOVE) |
1332 | const_iv (LOG_IN_MEMORY) |
1372 | const_iv (LOG_IN_MEMORY) |
… | |
… | |
1439 | |
1479 | |
1440 | int |
1480 | int |
1441 | poll_fileno () |
1481 | poll_fileno () |
1442 | PROTOTYPE: |
1482 | PROTOTYPE: |
1443 | CODE: |
1483 | CODE: |
1444 | RETVAL = respipe [0]; |
1484 | RETVAL = s_epipe_fd (&respipe); |
1445 | OUTPUT: |
1485 | OUTPUT: |
1446 | RETVAL |
1486 | RETVAL |
1447 | |
1487 | |
1448 | int |
1488 | int |
1449 | poll_cb (...) |
1489 | poll_cb (...) |
… | |
… | |
1633 | dREQ (REQ_ENV_DBRENAME, 2); |
1673 | dREQ (REQ_ENV_DBRENAME, 2); |
1634 | req->env = env; |
1674 | req->env = env; |
1635 | req->buf1 = strdup_ornull (file); |
1675 | req->buf1 = strdup_ornull (file); |
1636 | req->buf2 = strdup_ornull (database); |
1676 | req->buf2 = strdup_ornull (database); |
1637 | req->buf3 = strdup_ornull (newname); |
1677 | req->buf3 = strdup_ornull (newname); |
|
|
1678 | req->uint1 = flags; |
|
|
1679 | REQ_SEND; |
|
|
1680 | } |
|
|
1681 | |
|
|
1682 | void |
|
|
1683 | db_env_log_archive (DB_ENV *env, SV_mutable *listp, U32 flags = 0, SV *callback = 0) |
|
|
1684 | PREINIT: |
|
|
1685 | CALLBACK |
|
|
1686 | CODE: |
|
|
1687 | { |
|
|
1688 | dREQ (REQ_ENV_LOG_ARCHIVE, 1); |
|
|
1689 | req->sv1 = SvREFCNT_inc (listp); |
|
|
1690 | req->env = env; |
1638 | req->uint1 = flags; |
1691 | req->uint1 = flags; |
1639 | REQ_SEND; |
1692 | REQ_SEND; |
1640 | } |
1693 | } |
1641 | |
1694 | |
1642 | DB * |
1695 | DB * |
… | |
… | |
1693 | CODE: |
1746 | CODE: |
1694 | { |
1747 | { |
1695 | dREQ (REQ_DB_COMPACT, 2); |
1748 | dREQ (REQ_DB_COMPACT, 2); |
1696 | req->db = db; |
1749 | req->db = db; |
1697 | req->txn = txn; |
1750 | req->txn = txn; |
1698 | sv_to_dbt (&req->dbt1, start); |
1751 | if (start) sv_to_dbt (&req->dbt1, start); |
1699 | sv_to_dbt (&req->dbt2, stop); |
1752 | if (stop ) sv_to_dbt (&req->dbt2, stop ); |
1700 | req->uint1 = flags; |
1753 | req->uint1 = flags; |
1701 | REQ_SEND; |
1754 | REQ_SEND; |
1702 | } |
1755 | } |
1703 | |
1756 | |
1704 | #endif |
1757 | #endif |
… | |
… | |
1714 | req->uint1 = flags; |
1767 | req->uint1 = flags; |
1715 | REQ_SEND; |
1768 | REQ_SEND; |
1716 | } |
1769 | } |
1717 | |
1770 | |
1718 | void |
1771 | void |
|
|
1772 | db_verify (DB *db, bdb_filename file, bdb_filename database = 0, SV *dummy = 0, U32 flags = 0, SV *callback = 0) |
|
|
1773 | PREINIT: |
|
|
1774 | CALLBACK |
|
|
1775 | CODE: |
|
|
1776 | { |
|
|
1777 | dREQ (REQ_DB_VERIFY, 1); |
|
|
1778 | ptr_nuke (ST (0)); /* verify destroys the database handle, hopefully it is freed as well */ |
|
|
1779 | req->db = db; |
|
|
1780 | req->buf1 = strdup (file); |
|
|
1781 | req->buf2 = strdup_ornull (database); |
|
|
1782 | req->uint1 = flags; |
|
|
1783 | REQ_SEND; |
|
|
1784 | } |
|
|
1785 | |
|
|
1786 | void |
1719 | db_upgrade (DB *db, bdb_filename file, U32 flags = 0, SV *callback = 0) |
1787 | db_upgrade (DB *db, bdb_filename file, U32 flags = 0, SV *callback = 0) |
1720 | PREINIT: |
1788 | PREINIT: |
1721 | CALLBACK |
1789 | CALLBACK |
1722 | CODE: |
1790 | CODE: |
1723 | { |
1791 | { |
1724 | dREQ (REQ_DB_SYNC, 1); |
1792 | dREQ (REQ_DB_UPGRADE, 1); |
1725 | req->db = db; |
1793 | req->db = db; |
1726 | req->buf1 = strdup (file); |
1794 | req->buf1 = strdup (file); |
1727 | req->uint1 = flags; |
1795 | req->uint1 = flags; |
1728 | REQ_SEND; |
1796 | REQ_SEND; |
1729 | } |
1797 | } |