… | |
… | |
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 |
… | |
… | |
29 | # include <unistd.h> |
31 | # include <unistd.h> |
30 | #endif |
32 | #endif |
31 | |
33 | |
32 | #include <db.h> |
34 | #include <db.h> |
33 | |
35 | |
34 | #if DB_VERSION_MAJOR != 4 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR < 3) |
36 | #define DBVER DB_VERSION_MAJOR * 100 + DB_VERSION_MINOR |
|
|
37 | |
|
|
38 | #if DBVER < 403 |
35 | # error you need Berkeley DB 4.3 or a newer 4.x version installed |
39 | # error you need Berkeley DB 4.3 or a newer version installed |
36 | #endif |
40 | #endif |
37 | |
41 | |
38 | /* number of seconds after which idle threads exit */ |
42 | /* number of seconds after which idle threads exit */ |
39 | #define IDLE_TIMEOUT 10 |
43 | #define IDLE_TIMEOUT 10 |
40 | |
44 | |
… | |
… | |
48 | typedef DB_ENV DB_ENV_ornuked; |
52 | typedef DB_ENV DB_ENV_ornuked; |
49 | typedef DB_TXN DB_TXN_ornuked; |
53 | typedef DB_TXN DB_TXN_ornuked; |
50 | typedef DBC DBC_ornuked; |
54 | typedef DBC DBC_ornuked; |
51 | typedef DB DB_ornuked; |
55 | typedef DB DB_ornuked; |
52 | |
56 | |
53 | #if DB_VERSION_MINOR >= 3 |
57 | #if DBVER >= 403 |
54 | typedef DB_SEQUENCE DB_SEQUENCE_ornull; |
58 | typedef DB_SEQUENCE DB_SEQUENCE_ornull; |
55 | typedef DB_SEQUENCE DB_SEQUENCE_ornuked; |
59 | typedef DB_SEQUENCE DB_SEQUENCE_ornuked; |
56 | #endif |
60 | #endif |
57 | |
61 | |
58 | typedef char *bdb_filename; |
62 | typedef char *bdb_filename; |
59 | |
63 | |
60 | static SV *prepare_cb; |
64 | static SV *prepare_cb; |
61 | |
65 | |
62 | #if DB_VERSION_MINOR >= 6 |
66 | static HV |
|
|
67 | *bdb_stash, |
|
|
68 | *bdb_env_stash, |
|
|
69 | *bdb_txn_stash, |
|
|
70 | *bdb_cursor_stash, |
|
|
71 | *bdb_db_stash, |
|
|
72 | *bdb_sequence_stash; |
|
|
73 | |
|
|
74 | #if DBVER >= 406 |
63 | # define c_close close |
75 | # define c_close close |
64 | # define c_count count |
76 | # define c_count count |
65 | # define c_del del |
77 | # define c_del del |
66 | # define c_dup dup |
78 | # define c_dup dup |
67 | # define c_get get |
79 | # define c_get get |
… | |
… | |
149 | |
161 | |
150 | enum { |
162 | enum { |
151 | REQ_QUIT, |
163 | REQ_QUIT, |
152 | REQ_ENV_OPEN, REQ_ENV_CLOSE, REQ_ENV_TXN_CHECKPOINT, REQ_ENV_LOCK_DETECT, |
164 | 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, |
165 | REQ_ENV_MEMP_SYNC, REQ_ENV_MEMP_TRICKLE, REQ_ENV_DBREMOVE, REQ_ENV_DBRENAME, |
154 | REQ_ENV_LOG_ARCHIVE, |
166 | REQ_ENV_LOG_ARCHIVE, REQ_ENV_LSN_RESET, REQ_ENV_FILEID_RESET, |
155 | REQ_DB_OPEN, REQ_DB_CLOSE, REQ_DB_COMPACT, REQ_DB_SYNC, REQ_DB_UPGRADE, |
167 | REQ_DB_OPEN, REQ_DB_CLOSE, REQ_DB_COMPACT, REQ_DB_SYNC, REQ_DB_VERIFY, REQ_DB_UPGRADE, |
156 | REQ_DB_PUT, REQ_DB_EXISTS, REQ_DB_GET, REQ_DB_PGET, REQ_DB_DEL, REQ_DB_KEY_RANGE, |
168 | REQ_DB_PUT, REQ_DB_EXISTS, REQ_DB_GET, REQ_DB_PGET, REQ_DB_DEL, REQ_DB_KEY_RANGE, |
157 | REQ_TXN_COMMIT, REQ_TXN_ABORT, REQ_TXN_FINISH, |
169 | REQ_TXN_COMMIT, REQ_TXN_ABORT, REQ_TXN_FINISH, |
158 | REQ_C_CLOSE, REQ_C_COUNT, REQ_C_PUT, REQ_C_GET, REQ_C_PGET, REQ_C_DEL, |
170 | REQ_C_CLOSE, REQ_C_COUNT, REQ_C_PUT, REQ_C_GET, REQ_C_PGET, REQ_C_DEL, |
159 | REQ_SEQ_OPEN, REQ_SEQ_CLOSE, REQ_SEQ_GET, REQ_SEQ_REMOVE, |
171 | REQ_SEQ_OPEN, REQ_SEQ_CLOSE, REQ_SEQ_GET, REQ_SEQ_REMOVE, |
160 | }; |
172 | }; |
… | |
… | |
176 | char *buf1, *buf2, *buf3; |
188 | char *buf1, *buf2, *buf3; |
177 | SV *sv1, *sv2, *sv3; |
189 | SV *sv1, *sv2, *sv3; |
178 | |
190 | |
179 | DBT dbt1, dbt2, dbt3; |
191 | DBT dbt1, dbt2, dbt3; |
180 | DB_KEY_RANGE key_range; |
192 | DB_KEY_RANGE key_range; |
181 | #if DB_VERSION_MINOR >= 3 |
193 | #if DBVER >= 403 |
182 | DB_SEQUENCE *seq; |
194 | DB_SEQUENCE *seq; |
183 | db_seq_t seq_t; |
195 | db_seq_t seq_t; |
184 | #endif |
196 | #endif |
185 | |
197 | |
186 | SV *rsv1, *rsv2; // keep some request objects alive |
198 | SV *rsv1, *rsv2; // keep some request objects alive |
… | |
… | |
214 | static int next_pri = DEFAULT_PRI + PRI_BIAS; |
226 | static int next_pri = DEFAULT_PRI + PRI_BIAS; |
215 | |
227 | |
216 | static unsigned int started, idle, wanted; |
228 | static unsigned int started, idle, wanted; |
217 | |
229 | |
218 | /* worker threads management */ |
230 | /* worker threads management */ |
219 | static mutex_t wrklock = X_MUTEX_INIT; |
231 | static xmutex_t wrklock = X_MUTEX_INIT; |
220 | |
232 | |
221 | typedef struct worker { |
233 | typedef struct worker { |
222 | /* locked by wrklock */ |
234 | /* locked by wrklock */ |
223 | struct worker *prev, *next; |
235 | struct worker *prev, *next; |
224 | |
236 | |
225 | thread_t tid; |
237 | xthread_t tid; |
226 | |
238 | |
227 | /* locked by reslock, reqlock or wrklock */ |
239 | /* locked by reslock, reqlock or wrklock */ |
228 | bdb_req req; /* currently processed request */ |
240 | bdb_req req; /* currently processed request */ |
229 | void *dbuf; |
241 | void *dbuf; |
230 | DIR *dirp; |
242 | DIR *dirp; |
… | |
… | |
245 | } |
257 | } |
246 | |
258 | |
247 | static volatile unsigned int nreqs, nready, npending; |
259 | static volatile unsigned int nreqs, nready, npending; |
248 | static volatile unsigned int max_idle = 4; |
260 | static volatile unsigned int max_idle = 4; |
249 | static volatile unsigned int max_outstanding = 0xffffffff; |
261 | static volatile unsigned int max_outstanding = 0xffffffff; |
250 | static int respipe_osf [2], respipe [2] = { -1, -1 }; |
262 | static s_epipe respipe; |
251 | |
263 | |
252 | static mutex_t reslock = X_MUTEX_INIT; |
264 | static xmutex_t reslock = X_MUTEX_INIT; |
253 | static mutex_t reqlock = X_MUTEX_INIT; |
265 | static xmutex_t reqlock = X_MUTEX_INIT; |
254 | static cond_t reqwait = X_COND_INIT; |
266 | static xcond_t reqwait = X_COND_INIT; |
255 | |
267 | |
256 | #if WORDACCESS_UNSAFE |
268 | #if WORDACCESS_UNSAFE |
257 | |
269 | |
258 | static unsigned int get_nready (void) |
270 | static unsigned int get_nready (void) |
259 | { |
271 | { |
… | |
… | |
387 | SvREFCNT_dec (av); |
399 | SvREFCNT_dec (av); |
388 | SvREFCNT_dec (req->sv1); |
400 | SvREFCNT_dec (req->sv1); |
389 | } |
401 | } |
390 | break; |
402 | break; |
391 | |
403 | |
392 | #if DB_VERSION_MINOR >= 3 |
404 | #if DBVER >= 403 |
393 | case REQ_SEQ_GET: |
405 | case REQ_SEQ_GET: |
394 | SvREADONLY_off (req->sv1); |
406 | SvREADONLY_off (req->sv1); |
395 | |
407 | |
396 | if (sizeof (IV) > 4) |
408 | if (sizeof (IV) > 4) |
397 | sv_setiv_mg (req->sv1, (IV)req->seq_t); |
409 | sv_setiv_mg (req->sv1, (IV)req->seq_t); |
… | |
… | |
456 | free (req->buf3); |
468 | free (req->buf3); |
457 | |
469 | |
458 | Safefree (req); |
470 | Safefree (req); |
459 | } |
471 | } |
460 | |
472 | |
461 | #ifdef USE_SOCKETS_AS_HANDLES |
|
|
462 | # define TO_SOCKET(x) (win32_get_osfhandle (x)) |
|
|
463 | #else |
|
|
464 | # define TO_SOCKET(x) (x) |
|
|
465 | #endif |
|
|
466 | |
|
|
467 | static void |
473 | static void |
468 | create_respipe (void) |
474 | create_respipe (void) |
469 | { |
475 | { |
470 | #ifdef _WIN32 |
|
|
471 | int arg; /* argg */ |
|
|
472 | #endif |
|
|
473 | int old_readfd = respipe [0]; |
|
|
474 | |
|
|
475 | if (respipe [1] >= 0) |
|
|
476 | respipe_close (TO_SOCKET (respipe [1])); |
|
|
477 | |
|
|
478 | #ifdef _WIN32 |
|
|
479 | if (PerlSock_socketpair (AF_UNIX, SOCK_STREAM, 0, respipe)) |
|
|
480 | #else |
|
|
481 | if (pipe (respipe)) |
476 | if (s_epipe_renew (&respipe)) |
482 | #endif |
477 | croak ("BDB: unable to create event pipe"); |
483 | croak ("unable to initialize result pipe"); |
|
|
484 | |
|
|
485 | if (old_readfd >= 0) |
|
|
486 | { |
|
|
487 | if (dup2 (TO_SOCKET (respipe [0]), TO_SOCKET (old_readfd)) < 0) |
|
|
488 | croak ("unable to initialize result pipe(2)"); |
|
|
489 | |
|
|
490 | respipe_close (respipe [0]); |
|
|
491 | respipe [0] = old_readfd; |
|
|
492 | } |
|
|
493 | |
|
|
494 | #ifdef _WIN32 |
|
|
495 | arg = 1; |
|
|
496 | if (ioctlsocket (TO_SOCKET (respipe [0]), FIONBIO, &arg) |
|
|
497 | || ioctlsocket (TO_SOCKET (respipe [1]), FIONBIO, &arg)) |
|
|
498 | #else |
|
|
499 | if (fcntl (respipe [0], F_SETFL, O_NONBLOCK) |
|
|
500 | || fcntl (respipe [1], F_SETFL, O_NONBLOCK)) |
|
|
501 | #endif |
|
|
502 | croak ("unable to initialize result pipe(3)"); |
|
|
503 | |
|
|
504 | respipe_osf [0] = TO_SOCKET (respipe [0]); |
|
|
505 | respipe_osf [1] = TO_SOCKET (respipe [1]); |
|
|
506 | } |
478 | } |
507 | |
479 | |
508 | static void bdb_request (bdb_req req); |
480 | static void bdb_request (bdb_req req); |
509 | X_THREAD_PROC (bdb_proc); |
481 | X_THREAD_PROC (bdb_proc); |
510 | |
482 | |
… | |
… | |
514 | |
486 | |
515 | if (!wrk) |
487 | if (!wrk) |
516 | croak ("unable to allocate worker thread data"); |
488 | croak ("unable to allocate worker thread data"); |
517 | |
489 | |
518 | X_LOCK (wrklock); |
490 | X_LOCK (wrklock); |
519 | if (thread_create (&wrk->tid, bdb_proc, (void *)wrk)) |
491 | if (xthread_create (&wrk->tid, bdb_proc, (void *)wrk)) |
520 | { |
492 | { |
521 | wrk->prev = &wrk_first; |
493 | wrk->prev = &wrk_first; |
522 | wrk->next = wrk_first.next; |
494 | wrk->next = wrk_first.next; |
523 | wrk_first.next->prev = wrk; |
495 | wrk_first.next->prev = wrk; |
524 | wrk_first.next = wrk; |
496 | wrk_first.next = wrk; |
… | |
… | |
646 | end_thread (); |
618 | end_thread (); |
647 | } |
619 | } |
648 | |
620 | |
649 | static void poll_wait (void) |
621 | static void poll_wait (void) |
650 | { |
622 | { |
651 | fd_set rfd; |
|
|
652 | |
|
|
653 | while (nreqs) |
623 | while (nreqs) |
654 | { |
624 | { |
655 | int size; |
625 | int size; |
656 | if (WORDACCESS_UNSAFE) X_LOCK (reslock); |
626 | if (WORDACCESS_UNSAFE) X_LOCK (reslock); |
657 | size = res_queue.size; |
627 | size = res_queue.size; |
… | |
… | |
660 | if (size) |
630 | if (size) |
661 | return; |
631 | return; |
662 | |
632 | |
663 | maybe_start_thread (); |
633 | maybe_start_thread (); |
664 | |
634 | |
665 | FD_ZERO (&rfd); |
635 | s_epipe_wait (&respipe); |
666 | FD_SET (respipe [0], &rfd); |
|
|
667 | |
|
|
668 | PerlSock_select (respipe [0] + 1, &rfd, 0, 0, 0); |
|
|
669 | } |
636 | } |
670 | } |
637 | } |
671 | |
638 | |
672 | static int poll_cb (void) |
639 | static int poll_cb (void) |
673 | { |
640 | { |
… | |
… | |
693 | if (req) |
660 | if (req) |
694 | { |
661 | { |
695 | --npending; |
662 | --npending; |
696 | |
663 | |
697 | if (!res_queue.size) |
664 | if (!res_queue.size) |
698 | { |
|
|
699 | /* read any signals sent by the worker threads */ |
665 | /* read any signals sent by the worker threads */ |
700 | char buf [4]; |
666 | s_epipe_drain (&respipe); |
701 | while (respipe_read (respipe [0], buf, 4) == 4) |
|
|
702 | ; |
|
|
703 | } |
|
|
704 | } |
667 | } |
705 | |
668 | |
706 | X_UNLOCK (reslock); |
669 | X_UNLOCK (reslock); |
707 | |
670 | |
708 | if (!req) |
671 | if (!req) |
… | |
… | |
788 | |
751 | |
789 | case REQ_DB_CLOSE: |
752 | case REQ_DB_CLOSE: |
790 | req->result = req->db->close (req->db, req->uint1); |
753 | req->result = req->db->close (req->db, req->uint1); |
791 | break; |
754 | break; |
792 | |
755 | |
793 | #if DB_VERSION_MINOR >= 4 |
756 | #if DBVER >= 404 |
794 | case REQ_DB_COMPACT: |
757 | case REQ_DB_COMPACT: |
795 | 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); |
758 | 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); |
796 | break; |
759 | break; |
797 | #endif |
760 | #endif |
798 | |
761 | |
799 | case REQ_DB_SYNC: |
762 | case REQ_DB_SYNC: |
800 | req->result = req->db->sync (req->db, req->uint1); |
763 | req->result = req->db->sync (req->db, req->uint1); |
801 | break; |
764 | break; |
802 | |
765 | |
|
|
766 | case REQ_DB_VERIFY: |
|
|
767 | req->result = req->db->verify (req->db, req->buf1, req->buf2, 0, req->uint1); |
|
|
768 | break; |
|
|
769 | |
803 | case REQ_DB_UPGRADE: |
770 | case REQ_DB_UPGRADE: |
804 | req->result = req->db->upgrade (req->db, req->buf1, req->uint1); |
771 | req->result = req->db->upgrade (req->db, req->buf1, req->uint1); |
805 | break; |
772 | break; |
806 | |
773 | |
807 | case REQ_DB_PUT: |
774 | case REQ_DB_PUT: |
808 | req->result = req->db->put (req->db, req->txn, &req->dbt1, &req->dbt2, req->uint1); |
775 | req->result = req->db->put (req->db, req->txn, &req->dbt1, &req->dbt2, req->uint1); |
809 | break; |
776 | break; |
810 | |
777 | |
811 | #if DB_VERSION_MINOR >= 6 |
778 | #if DBVER >= 406 |
812 | case REQ_DB_EXISTS: |
779 | case REQ_DB_EXISTS: |
813 | req->result = req->db->exists (req->db, req->txn, &req->dbt1, req->uint1); |
780 | req->result = req->db->exists (req->db, req->txn, &req->dbt1, req->uint1); |
814 | break; |
781 | break; |
815 | #endif |
782 | #endif |
816 | case REQ_DB_GET: |
783 | case REQ_DB_GET: |
… | |
… | |
874 | |
841 | |
875 | case REQ_C_DEL: |
842 | case REQ_C_DEL: |
876 | req->result = req->dbc->c_del (req->dbc, req->uint1); |
843 | req->result = req->dbc->c_del (req->dbc, req->uint1); |
877 | break; |
844 | break; |
878 | |
845 | |
879 | #if DB_VERSION_MINOR >= 3 |
846 | #if DBVER >= 403 |
880 | case REQ_SEQ_OPEN: |
847 | case REQ_SEQ_OPEN: |
881 | req->result = req->seq->open (req->seq, req->txn, &req->dbt1, req->uint1); |
848 | req->result = req->seq->open (req->seq, req->txn, &req->dbt1, req->uint1); |
882 | break; |
849 | break; |
883 | |
850 | |
884 | case REQ_SEQ_CLOSE: |
851 | case REQ_SEQ_CLOSE: |
… | |
… | |
889 | req->result = req->seq->get (req->seq, req->txn, req->int1, &req->seq_t, req->uint1); |
856 | req->result = req->seq->get (req->seq, req->txn, req->int1, &req->seq_t, req->uint1); |
890 | break; |
857 | break; |
891 | |
858 | |
892 | case REQ_SEQ_REMOVE: |
859 | case REQ_SEQ_REMOVE: |
893 | req->result = req->seq->remove (req->seq, req->txn, req->uint1); |
860 | req->result = req->seq->remove (req->seq, req->txn, req->uint1); |
|
|
861 | break; |
|
|
862 | #endif |
|
|
863 | |
|
|
864 | #if DBVER >= 407 |
|
|
865 | case REQ_ENV_LSN_RESET: |
|
|
866 | req->result = req->env->lsn_reset (req->env, req->buf1, req->uint1); |
|
|
867 | break; |
|
|
868 | |
|
|
869 | case REQ_ENV_FILEID_RESET: |
|
|
870 | req->result = req->env->fileid_reset (req->env, req->buf1, req->uint1); |
894 | break; |
871 | break; |
895 | #endif |
872 | #endif |
896 | |
873 | |
897 | case REQ_ENV_LOG_ARCHIVE: |
874 | case REQ_ENV_LOG_ARCHIVE: |
898 | { |
875 | { |
… | |
… | |
920 | /* try to distribute timeouts somewhat evenly */ |
897 | /* try to distribute timeouts somewhat evenly */ |
921 | ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL); |
898 | ts.tv_nsec = ((unsigned long)self & 1023UL) * (1000000000UL / 1024UL); |
922 | |
899 | |
923 | for (;;) |
900 | for (;;) |
924 | { |
901 | { |
925 | ts.tv_sec = time (0) + IDLE_TIMEOUT; |
902 | ts.tv_sec = time (0) + IDLE_TIMEOUT; |
926 | |
903 | |
927 | X_LOCK (reqlock); |
904 | X_LOCK (reqlock); |
928 | |
905 | |
929 | for (;;) |
906 | for (;;) |
930 | { |
907 | { |
… | |
… | |
975 | X_LOCK (reslock); |
952 | X_LOCK (reslock); |
976 | |
953 | |
977 | ++npending; |
954 | ++npending; |
978 | |
955 | |
979 | if (!reqq_push (&res_queue, req)) |
956 | if (!reqq_push (&res_queue, req)) |
980 | /* write a dummy byte to the pipe so fh becomes ready */ |
957 | s_epipe_signal (&respipe); |
981 | respipe_write (respipe_osf [1], (const void *)&respipe_osf, 1); |
|
|
982 | |
958 | |
983 | self->req = 0; |
959 | self->req = 0; |
984 | worker_clear (self); |
960 | worker_clear (self); |
985 | |
961 | |
986 | X_UNLOCK (reslock); |
962 | X_UNLOCK (reslock); |
… | |
… | |
1048 | next_pri = DEFAULT_PRI + PRI_BIAS; \ |
1024 | next_pri = DEFAULT_PRI + PRI_BIAS; \ |
1049 | \ |
1025 | \ |
1050 | if (callback && SvOK (callback)) \ |
1026 | if (callback && SvOK (callback)) \ |
1051 | croak ("callback has illegal type or extra arguments"); \ |
1027 | croak ("callback has illegal type or extra arguments"); \ |
1052 | \ |
1028 | \ |
1053 | Newz (0, req, 1, bdb_cb); \ |
1029 | Newz (0, req, 1, bdb_cb); \ |
1054 | if (!req) \ |
1030 | if (!req) \ |
1055 | croak ("out of memory during bdb_req allocation"); \ |
1031 | croak ("out of memory during bdb_req allocation"); \ |
1056 | \ |
1032 | \ |
1057 | req->callback = SvREFCNT_inc (cb); \ |
1033 | req->callback = SvREFCNT_inc (cb); \ |
1058 | req->type = (reqtype); \ |
1034 | req->type = (reqtype); \ |
1059 | req->pri = req_pri; \ |
1035 | req->pri = req_pri; \ |
1060 | if (rsvcnt >= 1) req->rsv1 = SvREFCNT_inc (ST (0)); \ |
1036 | if (rsvcnt >= 1) req->rsv1 = SvREFCNT_inc (ST (0)); \ |
1061 | if (rsvcnt >= 2) req->rsv2 = SvREFCNT_inc (ST (1)); \ |
1037 | if (rsvcnt >= 2) req->rsv2 = SvREFCNT_inc (ST (1)); \ |
1062 | (void)0; |
1038 | (void)0; |
1063 | |
1039 | |
1064 | #define REQ_SEND \ |
1040 | #define REQ_SEND \ |
1065 | req_send (req) |
1041 | req_send (req) |
1066 | |
1042 | |
1067 | #define SvPTR(var, arg, type, class, nullok) \ |
1043 | #define SvPTR(var, arg, type, stash, class, nullok) \ |
1068 | if (!SvOK (arg)) \ |
1044 | if (!SvOK (arg)) \ |
1069 | { \ |
1045 | { \ |
1070 | if (nullok != 1) \ |
1046 | if (nullok != 1) \ |
1071 | croak (# var " must be a " # class " object, not undef"); \ |
1047 | croak (# var " must be a " # class " object, not undef"); \ |
1072 | \ |
1048 | \ |
1073 | (var) = 0; \ |
1049 | (var) = 0; \ |
1074 | } \ |
1050 | } \ |
1075 | else if (sv_derived_from ((arg), # class)) \ |
1051 | else if (SvSTASH (SvRV (arg)) == stash || sv_derived_from ((arg), # class)) \ |
1076 | { \ |
1052 | { \ |
1077 | IV tmp = SvIV ((SV*) SvRV (arg)); \ |
1053 | IV tmp = SvIV ((SV*) SvRV (arg)); \ |
1078 | (var) = INT2PTR (type, tmp); \ |
1054 | (var) = INT2PTR (type, tmp); \ |
1079 | if (!var && nullok != 2) \ |
1055 | if (!var && nullok != 2) \ |
1080 | croak (# var " is not a valid " # class " object anymore"); \ |
1056 | croak (# var " is not a valid " # class " object anymore"); \ |
… | |
… | |
1083 | croak (# var " is not of type " # class); |
1059 | croak (# var " is not of type " # class); |
1084 | |
1060 | |
1085 | #define ARG_MUTABLE(name) \ |
1061 | #define ARG_MUTABLE(name) \ |
1086 | if (SvREADONLY (name)) \ |
1062 | if (SvREADONLY (name)) \ |
1087 | croak ("argument " #name " is read-only/constant, but the request requires it to be mutable"); |
1063 | croak ("argument " #name " is read-only/constant, but the request requires it to be mutable"); |
|
|
1064 | |
|
|
1065 | static SV * |
|
|
1066 | newSVptr (void *ptr, HV *stash) |
|
|
1067 | { |
|
|
1068 | SV *rv = NEWSV (0, 0); |
|
|
1069 | sv_upgrade (rv, SVt_PVMG); |
|
|
1070 | sv_setiv (rv, PTR2IV (ptr)); |
|
|
1071 | |
|
|
1072 | return sv_bless (newRV_noinc (rv), stash); |
|
|
1073 | } |
1088 | |
1074 | |
1089 | static void |
1075 | static void |
1090 | ptr_nuke (SV *sv) |
1076 | ptr_nuke (SV *sv) |
1091 | { |
1077 | { |
1092 | assert (SvROK (sv)); |
1078 | assert (SvROK (sv)); |
… | |
… | |
1214 | |
1200 | |
1215 | PROTOTYPES: ENABLE |
1201 | PROTOTYPES: ENABLE |
1216 | |
1202 | |
1217 | BOOT: |
1203 | BOOT: |
1218 | { |
1204 | { |
1219 | HV *stash = gv_stashpv ("BDB", 1); |
|
|
1220 | |
|
|
1221 | static const struct { |
1205 | static const struct { |
1222 | const char *name; |
1206 | const char *name; |
1223 | IV iv; |
1207 | IV iv; |
1224 | } *civ, const_iv[] = { |
1208 | } *civ, const_iv[] = { |
1225 | #define const_iv(name) { # name, (IV)DB_ ## name }, |
1209 | #define const_iv(name) { # name, (IV)DB_ ## name }, |
|
|
1210 | #if DBVER <= 408 |
1226 | const_iv (RPCCLIENT) |
1211 | const_iv (RPCCLIENT) |
|
|
1212 | #endif |
1227 | const_iv (INIT_CDB) |
1213 | const_iv (INIT_CDB) |
1228 | const_iv (INIT_LOCK) |
1214 | const_iv (INIT_LOCK) |
1229 | const_iv (INIT_LOG) |
1215 | const_iv (INIT_LOG) |
1230 | const_iv (INIT_MPOOL) |
1216 | const_iv (INIT_MPOOL) |
1231 | const_iv (INIT_REP) |
1217 | const_iv (INIT_REP) |
… | |
… | |
1254 | const_iv (TXN_NOT_DURABLE) |
1240 | const_iv (TXN_NOT_DURABLE) |
1255 | const_iv (TXN_WRITE_NOSYNC) |
1241 | const_iv (TXN_WRITE_NOSYNC) |
1256 | const_iv (WRITECURSOR) |
1242 | const_iv (WRITECURSOR) |
1257 | const_iv (YIELDCPU) |
1243 | const_iv (YIELDCPU) |
1258 | const_iv (ENCRYPT_AES) |
1244 | const_iv (ENCRYPT_AES) |
|
|
1245 | #if DBVER < 408 |
1259 | const_iv (XA_CREATE) |
1246 | const_iv (XA_CREATE) |
|
|
1247 | #endif |
1260 | const_iv (BTREE) |
1248 | const_iv (BTREE) |
1261 | const_iv (HASH) |
1249 | const_iv (HASH) |
1262 | const_iv (QUEUE) |
1250 | const_iv (QUEUE) |
1263 | const_iv (RECNO) |
1251 | const_iv (RECNO) |
1264 | const_iv (UNKNOWN) |
1252 | const_iv (UNKNOWN) |
… | |
… | |
1328 | const_iv (LOCK_OLDEST) |
1316 | const_iv (LOCK_OLDEST) |
1329 | const_iv (LOCK_RANDOM) |
1317 | const_iv (LOCK_RANDOM) |
1330 | const_iv (LOCK_YOUNGEST) |
1318 | const_iv (LOCK_YOUNGEST) |
1331 | |
1319 | |
1332 | const_iv (DONOTINDEX) |
1320 | const_iv (DONOTINDEX) |
1333 | const_iv (KEYEMPTY ) |
1321 | const_iv (KEYEMPTY) |
1334 | const_iv (KEYEXIST ) |
1322 | const_iv (KEYEXIST) |
1335 | const_iv (LOCK_DEADLOCK) |
1323 | const_iv (LOCK_DEADLOCK) |
1336 | const_iv (LOCK_NOTGRANTED) |
1324 | const_iv (LOCK_NOTGRANTED) |
1337 | const_iv (NOSERVER) |
1325 | const_iv (NOSERVER) |
|
|
1326 | #if DBVER < 502 |
1338 | const_iv (NOSERVER_HOME) |
1327 | const_iv (NOSERVER_HOME) |
1339 | const_iv (NOSERVER_ID) |
1328 | const_iv (NOSERVER_ID) |
|
|
1329 | #endif |
1340 | const_iv (NOTFOUND) |
1330 | const_iv (NOTFOUND) |
1341 | const_iv (PAGE_NOTFOUND) |
1331 | const_iv (PAGE_NOTFOUND) |
1342 | const_iv (REP_DUPMASTER) |
1332 | const_iv (REP_DUPMASTER) |
1343 | const_iv (REP_HANDLE_DEAD) |
1333 | const_iv (REP_HANDLE_DEAD) |
1344 | const_iv (REP_HOLDELECTION) |
1334 | const_iv (REP_HOLDELECTION) |
… | |
… | |
1349 | const_iv (REP_UNAVAIL) |
1339 | const_iv (REP_UNAVAIL) |
1350 | const_iv (RUNRECOVERY) |
1340 | const_iv (RUNRECOVERY) |
1351 | const_iv (SECONDARY_BAD) |
1341 | const_iv (SECONDARY_BAD) |
1352 | const_iv (VERIFY_BAD) |
1342 | const_iv (VERIFY_BAD) |
1353 | |
1343 | |
|
|
1344 | const_iv (SALVAGE) |
|
|
1345 | const_iv (AGGRESSIVE) |
|
|
1346 | const_iv (PRINTABLE) |
|
|
1347 | const_iv (NOORDERCHK) |
|
|
1348 | const_iv (ORDERCHKONLY) |
|
|
1349 | |
1354 | const_iv (ARCH_ABS) |
1350 | const_iv (ARCH_ABS) |
1355 | const_iv (ARCH_DATA) |
1351 | const_iv (ARCH_DATA) |
1356 | const_iv (ARCH_LOG) |
1352 | const_iv (ARCH_LOG) |
1357 | const_iv (ARCH_REMOVE) |
1353 | const_iv (ARCH_REMOVE) |
1358 | |
1354 | |
… | |
… | |
1362 | const_iv (VERB_WAITSFOR) |
1358 | const_iv (VERB_WAITSFOR) |
1363 | |
1359 | |
1364 | const_iv (VERSION_MAJOR) |
1360 | const_iv (VERSION_MAJOR) |
1365 | const_iv (VERSION_MINOR) |
1361 | const_iv (VERSION_MINOR) |
1366 | const_iv (VERSION_PATCH) |
1362 | const_iv (VERSION_PATCH) |
1367 | #if DB_VERSION_MINOR >= 3 |
1363 | const_iv (LOGVERSION) |
|
|
1364 | const_iv (LOGOLDVER) |
|
|
1365 | #if DBVER >= 403 |
1368 | const_iv (INORDER) |
1366 | const_iv (INORDER) |
1369 | const_iv (LOCK_MAXWRITE) |
1367 | const_iv (LOCK_MAXWRITE) |
1370 | const_iv (SEQ_DEC) |
1368 | const_iv (SEQ_DEC) |
1371 | const_iv (SEQ_INC) |
1369 | const_iv (SEQ_INC) |
1372 | const_iv (SEQ_WRAP) |
1370 | const_iv (SEQ_WRAP) |
1373 | const_iv (BUFFER_SMALL) |
1371 | const_iv (BUFFER_SMALL) |
1374 | const_iv (LOG_BUFFER_FULL) |
1372 | const_iv (LOG_BUFFER_FULL) |
1375 | const_iv (VERSION_MISMATCH) |
1373 | const_iv (VERSION_MISMATCH) |
1376 | #endif |
1374 | #endif |
1377 | #if DB_VERSION_MINOR >= 4 |
1375 | #if DBVER >= 404 |
1378 | const_iv (REGISTER) |
1376 | const_iv (REGISTER) |
1379 | const_iv (DSYNC_DB) |
1377 | const_iv (DSYNC_DB) |
1380 | const_iv (READ_COMMITTED) |
1378 | const_iv (READ_COMMITTED) |
1381 | const_iv (READ_UNCOMMITTED) |
1379 | const_iv (READ_UNCOMMITTED) |
1382 | const_iv (REP_IGNORE) |
1380 | const_iv (REP_IGNORE) |
… | |
… | |
1384 | const_iv (REP_JOIN_FAILURE) |
1382 | const_iv (REP_JOIN_FAILURE) |
1385 | const_iv (FREE_SPACE) |
1383 | const_iv (FREE_SPACE) |
1386 | const_iv (FREELIST_ONLY) |
1384 | const_iv (FREELIST_ONLY) |
1387 | const_iv (VERB_REGISTER) |
1385 | const_iv (VERB_REGISTER) |
1388 | #endif |
1386 | #endif |
1389 | #if DB_VERSION_MINOR >= 5 |
1387 | #if DBVER >= 405 |
1390 | const_iv (MULTIVERSION) |
1388 | const_iv (MULTIVERSION) |
1391 | const_iv (TXN_SNAPSHOT) |
1389 | const_iv (TXN_SNAPSHOT) |
1392 | #endif |
1390 | #endif |
1393 | #if DB_VERSION_MINOR >= 6 |
1391 | #if DBVER >= 406 |
1394 | const_iv (PREV_DUP) |
1392 | const_iv (PREV_DUP) |
1395 | const_iv (PRIORITY_UNCHANGED) |
1393 | const_iv (PRIORITY_UNCHANGED) |
1396 | const_iv (PRIORITY_VERY_LOW) |
1394 | const_iv (PRIORITY_VERY_LOW) |
1397 | const_iv (PRIORITY_LOW) |
1395 | const_iv (PRIORITY_LOW) |
1398 | const_iv (PRIORITY_DEFAULT) |
1396 | const_iv (PRIORITY_DEFAULT) |
1399 | const_iv (PRIORITY_HIGH) |
1397 | const_iv (PRIORITY_HIGH) |
1400 | const_iv (PRIORITY_VERY_HIGH) |
1398 | const_iv (PRIORITY_VERY_HIGH) |
1401 | const_iv (IGNORE_LEASE) |
1399 | const_iv (IGNORE_LEASE) |
1402 | #endif |
1400 | #endif |
1403 | #if DB_VERSION_MINOR >= 7 |
1401 | #if DBVER >= 407 |
1404 | //const_iv (MULTIPLE_KEY) |
1402 | //const_iv (MULTIPLE_KEY) |
1405 | const_iv (LOG_DIRECT) |
1403 | const_iv (LOG_DIRECT) |
1406 | const_iv (LOG_DSYNC) |
1404 | const_iv (LOG_DSYNC) |
1407 | const_iv (LOG_AUTO_REMOVE) |
1405 | const_iv (LOG_AUTO_REMOVE) |
1408 | const_iv (LOG_IN_MEMORY) |
1406 | const_iv (LOG_IN_MEMORY) |
1409 | const_iv (LOG_ZERO) |
1407 | const_iv (LOG_ZERO) |
1410 | #else |
1408 | #else |
1411 | const_iv (DIRECT_LOG) |
1409 | const_iv (DIRECT_LOG) |
1412 | const_iv (LOG_AUTOREMOVE) |
1410 | const_iv (LOG_AUTOREMOVE) |
1413 | # if DB_VERSION_MINOR >= 3 |
1411 | # if DBVER >= 403 |
1414 | const_iv (DSYNC_LOG) |
1412 | const_iv (DSYNC_LOG) |
1415 | const_iv (LOG_INMEMORY) |
1413 | const_iv (LOG_INMEMORY) |
1416 | # endif |
1414 | # endif |
|
|
1415 | #if DBVER >= 408 |
|
|
1416 | const_iv (LOGVERSION_LATCHING) |
|
|
1417 | #endif |
1417 | #endif |
1418 | #endif |
1418 | }; |
1419 | }; |
1419 | |
1420 | |
|
|
1421 | bdb_stash = gv_stashpv ("BDB" , 1); |
|
|
1422 | bdb_env_stash = gv_stashpv ("BDB::Env" , 1); |
|
|
1423 | bdb_txn_stash = gv_stashpv ("BDB::Txn" , 1); |
|
|
1424 | bdb_cursor_stash = gv_stashpv ("BDB::Cursor" , 1); |
|
|
1425 | bdb_db_stash = gv_stashpv ("BDB::Db" , 1); |
|
|
1426 | bdb_sequence_stash = gv_stashpv ("BDB::Sequence", 1); |
|
|
1427 | |
1420 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) |
1428 | for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ > const_iv; civ--) |
1421 | newCONSTSUB (stash, (char *)civ->name, newSViv (civ->iv)); |
1429 | newCONSTSUB (bdb_stash, (char *)civ[-1].name, newSViv (civ[-1].iv)); |
1422 | |
1430 | |
1423 | prepare_cb = &PL_sv_undef; |
1431 | prepare_cb = &PL_sv_undef; |
1424 | |
1432 | |
1425 | { |
1433 | { |
1426 | /* we currently only allow version, minor-version and patchlevel to go up to 255 */ |
1434 | /* we currently only allow version, minor-version and patchlevel to go up to 255 */ |
1427 | char vstring[3] = { DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH }; |
1435 | char vstring[3] = { DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH }; |
1428 | |
1436 | |
1429 | newCONSTSUB (stash, "VERSION_v", newSVpvn (vstring, 3)); |
1437 | newCONSTSUB (bdb_stash, "VERSION_v", newSVpvn (vstring, 3)); |
1430 | } |
1438 | } |
1431 | |
1439 | |
1432 | newCONSTSUB (stash, "VERSION_STRING", newSVpv (DB_VERSION_STRING, 0)); |
1440 | newCONSTSUB (bdb_stash, "VERSION_STRING", newSVpv (DB_VERSION_STRING, 0)); |
1433 | |
1441 | |
1434 | create_respipe (); |
1442 | create_respipe (); |
1435 | |
1443 | |
1436 | X_THREAD_ATFORK (atfork_prepare, atfork_parent, atfork_child); |
1444 | X_THREAD_ATFORK (atfork_prepare, atfork_parent, atfork_child); |
1437 | patch_errno (); |
1445 | patch_errno (); |
… | |
… | |
1515 | |
1523 | |
1516 | int |
1524 | int |
1517 | poll_fileno () |
1525 | poll_fileno () |
1518 | PROTOTYPE: |
1526 | PROTOTYPE: |
1519 | CODE: |
1527 | CODE: |
1520 | RETVAL = respipe [0]; |
1528 | RETVAL = s_epipe_fd (&respipe); |
1521 | OUTPUT: |
1529 | OUTPUT: |
1522 | RETVAL |
1530 | RETVAL |
1523 | |
1531 | |
1524 | int |
1532 | int |
1525 | poll_cb (...) |
1533 | poll_cb (...) |
… | |
… | |
1710 | req->env = env; |
1718 | req->env = env; |
1711 | req->buf1 = strdup_ornull (file); |
1719 | req->buf1 = strdup_ornull (file); |
1712 | req->buf2 = strdup_ornull (database); |
1720 | req->buf2 = strdup_ornull (database); |
1713 | req->buf3 = strdup_ornull (newname); |
1721 | req->buf3 = strdup_ornull (newname); |
1714 | req->uint1 = flags; |
1722 | req->uint1 = flags; |
|
|
1723 | REQ_SEND; |
|
|
1724 | } |
|
|
1725 | |
|
|
1726 | void |
|
|
1727 | db_env_lsn_reset (DB_ENV *env, bdb_filename db, U32 flags = 0, SV *callback = 0) |
|
|
1728 | ALIAS: |
|
|
1729 | db_env_fileid_reset = 1 |
|
|
1730 | PREINIT: |
|
|
1731 | CALLBACK |
|
|
1732 | CODE: |
|
|
1733 | { |
|
|
1734 | dREQ (ix ? REQ_ENV_FILEID_RESET : REQ_ENV_LSN_RESET, 1); |
|
|
1735 | req->env = env; |
|
|
1736 | req->uint1 = flags; |
|
|
1737 | req->buf1 = strdup_ornull (db); |
1715 | REQ_SEND; |
1738 | REQ_SEND; |
1716 | } |
1739 | } |
1717 | |
1740 | |
1718 | void |
1741 | void |
1719 | db_env_log_archive (DB_ENV *env, SV_mutable *listp, U32 flags = 0, SV *callback = 0) |
1742 | db_env_log_archive (DB_ENV *env, SV_mutable *listp, U32 flags = 0, SV *callback = 0) |
… | |
… | |
1771 | req->uint1 = flags; |
1794 | req->uint1 = flags; |
1772 | req->sv1 = (SV *)db->app_private; |
1795 | req->sv1 = (SV *)db->app_private; |
1773 | REQ_SEND; |
1796 | REQ_SEND; |
1774 | } |
1797 | } |
1775 | |
1798 | |
1776 | #if DB_VERSION_MINOR >= 4 |
1799 | #if DBVER >= 404 |
1777 | |
1800 | |
1778 | void |
1801 | void |
1779 | db_compact (DB *db, DB_TXN_ornull *txn = 0, SV *start = 0, SV *stop = 0, SV *unused1 = 0, U32 flags = DB_FREE_SPACE, SV *unused2 = 0, SV *callback = 0) |
1802 | db_compact (DB *db, DB_TXN_ornull *txn = 0, SV *start = 0, SV *stop = 0, SV *unused1 = 0, U32 flags = DB_FREE_SPACE, SV *unused2 = 0, SV *callback = 0) |
1780 | PREINIT: |
1803 | PREINIT: |
1781 | CALLBACK |
1804 | CALLBACK |
… | |
… | |
1803 | req->uint1 = flags; |
1826 | req->uint1 = flags; |
1804 | REQ_SEND; |
1827 | REQ_SEND; |
1805 | } |
1828 | } |
1806 | |
1829 | |
1807 | void |
1830 | void |
|
|
1831 | db_verify (DB *db, bdb_filename file, bdb_filename database = 0, SV *dummy = 0, U32 flags = 0, SV *callback = 0) |
|
|
1832 | PREINIT: |
|
|
1833 | CALLBACK |
|
|
1834 | CODE: |
|
|
1835 | { |
|
|
1836 | dREQ (REQ_DB_VERIFY, 1); |
|
|
1837 | ptr_nuke (ST (0)); /* verify destroys the database handle, hopefully it is freed as well */ |
|
|
1838 | req->db = db; |
|
|
1839 | req->buf1 = strdup (file); |
|
|
1840 | req->buf2 = strdup_ornull (database); |
|
|
1841 | req->uint1 = flags; |
|
|
1842 | REQ_SEND; |
|
|
1843 | } |
|
|
1844 | |
|
|
1845 | void |
1808 | db_upgrade (DB *db, bdb_filename file, U32 flags = 0, SV *callback = 0) |
1846 | db_upgrade (DB *db, bdb_filename file, U32 flags = 0, SV *callback = 0) |
1809 | PREINIT: |
1847 | PREINIT: |
1810 | CALLBACK |
1848 | CALLBACK |
1811 | CODE: |
1849 | CODE: |
1812 | { |
1850 | { |
1813 | dREQ (REQ_DB_SYNC, 1); |
1851 | dREQ (REQ_DB_UPGRADE, 1); |
1814 | req->db = db; |
1852 | req->db = db; |
1815 | req->buf1 = strdup (file); |
1853 | req->buf1 = strdup (file); |
1816 | req->uint1 = flags; |
1854 | req->uint1 = flags; |
1817 | REQ_SEND; |
1855 | REQ_SEND; |
1818 | } |
1856 | } |
… | |
… | |
1845 | sv_to_dbt (&req->dbt2, data); |
1883 | sv_to_dbt (&req->dbt2, data); |
1846 | req->uint1 = flags; |
1884 | req->uint1 = flags; |
1847 | REQ_SEND; |
1885 | REQ_SEND; |
1848 | } |
1886 | } |
1849 | |
1887 | |
1850 | #if DB_VERSION_MINOR >= 6 |
1888 | #if DBVER >= 406 |
1851 | |
1889 | |
1852 | void |
1890 | void |
1853 | db_exists (DB *db, DB_TXN_ornull *txn, SV *key, U32 flags = 0, SV *callback = 0) |
1891 | db_exists (DB *db, DB_TXN_ornull *txn, SV *key, U32 flags = 0, SV *callback = 0) |
1854 | PREINIT: |
1892 | PREINIT: |
1855 | CALLBACK |
1893 | CALLBACK |
… | |
… | |
2088 | req->uint1 = flags; |
2126 | req->uint1 = flags; |
2089 | REQ_SEND; |
2127 | REQ_SEND; |
2090 | } |
2128 | } |
2091 | |
2129 | |
2092 | |
2130 | |
2093 | #if DB_VERSION_MINOR >= 3 |
2131 | #if DBVER >= 403 |
2094 | |
2132 | |
2095 | void |
2133 | void |
2096 | db_sequence_open (DB_SEQUENCE *seq, DB_TXN_ornull *txnid, SV *key, U32 flags = 0, SV *callback = 0) |
2134 | db_sequence_open (DB_SEQUENCE *seq, DB_TXN_ornull *txnid, SV *key, U32 flags = 0, SV *callback = 0) |
2097 | PREINIT: |
2135 | PREINIT: |
2098 | CALLBACK |
2136 | CALLBACK |
… | |
… | |
2192 | CODE: |
2230 | CODE: |
2193 | RETVAL = env->set_flags (env, flags, onoff); |
2231 | RETVAL = env->set_flags (env, flags, onoff); |
2194 | OUTPUT: |
2232 | OUTPUT: |
2195 | RETVAL |
2233 | RETVAL |
2196 | |
2234 | |
2197 | #if DB_VERSION_MINOR >= 7 |
2235 | #if DBVER >= 407 |
2198 | |
2236 | |
2199 | int set_intermediate_dir_mode (DB_ENV *env, const char *mode) |
2237 | int set_intermediate_dir_mode (DB_ENV *env, const char *mode) |
2200 | CODE: |
2238 | CODE: |
2201 | RETVAL = env->set_intermediate_dir_mode (env, mode); |
2239 | RETVAL = env->set_intermediate_dir_mode (env, mode); |
2202 | OUTPUT: |
2240 | OUTPUT: |
… | |
… | |
2289 | CODE: |
2327 | CODE: |
2290 | RETVAL = env->set_lg_max (env, max); |
2328 | RETVAL = env->set_lg_max (env, max); |
2291 | OUTPUT: |
2329 | OUTPUT: |
2292 | RETVAL |
2330 | RETVAL |
2293 | |
2331 | |
2294 | #if DB_VERSION_MINOR >= 4 |
2332 | #if DBVER >= 404 |
2295 | |
2333 | |
2296 | int mutex_set_max (DB_ENV *env, U32 max) |
2334 | int mutex_set_max (DB_ENV *env, U32 max) |
2297 | CODE: |
2335 | CODE: |
2298 | RETVAL = env->mutex_set_max (env, max); |
2336 | RETVAL = env->mutex_set_max (env, max); |
2299 | OUTPUT: |
2337 | OUTPUT: |
… | |
… | |
2326 | if (errno) |
2364 | if (errno) |
2327 | croak ("DB_ENV->txn_begin: %s", db_strerror (errno)); |
2365 | croak ("DB_ENV->txn_begin: %s", db_strerror (errno)); |
2328 | OUTPUT: |
2366 | OUTPUT: |
2329 | RETVAL |
2367 | RETVAL |
2330 | |
2368 | |
2331 | #if DB_VERSION_MINOR >= 5 |
2369 | #if DBVER >= 405 |
2332 | |
2370 | |
2333 | DB_TXN * |
2371 | DB_TXN * |
2334 | cdsgroup_begin (DB_ENV *env) |
2372 | cdsgroup_begin (DB_ENV *env) |
2335 | CODE: |
2373 | CODE: |
2336 | errno = env->cdsgroup_begin (env, &RETVAL); |
2374 | errno = env->cdsgroup_begin (env, &RETVAL); |
… | |
… | |
2438 | if (errno) |
2476 | if (errno) |
2439 | croak ("DB->cursor: %s", db_strerror (errno)); |
2477 | croak ("DB->cursor: %s", db_strerror (errno)); |
2440 | OUTPUT: |
2478 | OUTPUT: |
2441 | RETVAL |
2479 | RETVAL |
2442 | |
2480 | |
2443 | #if DB_VERSION_MINOR >= 3 |
2481 | #if DBVER >= 403 |
2444 | |
2482 | |
2445 | DB_SEQUENCE * |
2483 | DB_SEQUENCE * |
2446 | sequence (DB *db, U32 flags = 0) |
2484 | sequence (DB *db, U32 flags = 0) |
2447 | CODE: |
2485 | CODE: |
2448 | { |
2486 | { |
… | |
… | |
2483 | DESTROY (DBC_ornuked *dbc) |
2521 | DESTROY (DBC_ornuked *dbc) |
2484 | CODE: |
2522 | CODE: |
2485 | if (dbc) |
2523 | if (dbc) |
2486 | dbc->c_close (dbc); |
2524 | dbc->c_close (dbc); |
2487 | |
2525 | |
2488 | #if DB_VERSION_MINOR >= 6 |
2526 | #if DBVER >= 406 |
2489 | |
2527 | |
2490 | int set_priority (DBC *dbc, int priority) |
2528 | int set_priority (DBC *dbc, int priority) |
2491 | CODE: |
2529 | CODE: |
2492 | dbc->set_priority (dbc, priority); |
2530 | dbc->set_priority (dbc, priority); |
2493 | |
2531 | |
2494 | #endif |
2532 | #endif |
2495 | |
2533 | |
2496 | #if DB_VERSION_MINOR >= 3 |
2534 | #if DBVER >= 403 |
2497 | |
2535 | |
2498 | MODULE = BDB PACKAGE = BDB::Sequence |
2536 | MODULE = BDB PACKAGE = BDB::Sequence |
2499 | |
2537 | |
2500 | void |
2538 | void |
2501 | DESTROY (DB_SEQUENCE_ornuked *seq) |
2539 | DESTROY (DB_SEQUENCE_ornuked *seq) |