1 --- db.1.85/btree/bt_delete.c.jj Thu Jul 28 16:30:03 1994
2 +++ db.1.85/btree/bt_delete.c Wed Apr 19 17:56:12 2000
3 @@ -154,7 +154,7 @@ __bt_stkacq(t, hp, c)
5 recno_t nextpg, prevpg;
10 * Find the first occurrence of the key in the tree. Toss the
11 * currently locked page so we don't hit an already-locked page.
12 @@ -270,7 +270,7 @@ __bt_stkacq(t, hp, c)
13 if ((h = mpool_get(t->bt_mp, prevpg, 0)) == NULL)
19 ret: mpool_put(t->bt_mp, h, 0);
20 return ((*hp = mpool_get(t->bt_mp, c->pg.pgno, 0)) == NULL);
21 @@ -402,7 +402,7 @@ __bt_pdelete(t, h)
22 /* Get the parent page. */
23 if ((pg = mpool_get(t->bt_mp, parent->pgno, 0)) == NULL)
27 index = parent->index;
28 bi = GETBINTERNAL(pg, index);
30 @@ -418,7 +418,7 @@ __bt_pdelete(t, h)
31 * root page. If it's the rootpage, turn it back into an empty
34 - if (NEXTINDEX(pg) == 1)
35 + if (NEXTINDEX(pg) == 1) {
36 if (pg->pgno == P_ROOT) {
37 pg->lower = BTDATAOFF;
38 pg->upper = t->bt_psize;
39 @@ -428,7 +428,7 @@ __bt_pdelete(t, h)
45 /* Pack remaining key items at the end of the page. */
46 nksize = NBINTERNAL(bi->ksize);
47 from = (char *)pg + pg->upper;
48 @@ -571,7 +571,7 @@ __bt_curdel(t, key, h, index)
51 /* Check previous key, if not at the beginning of the page. */
56 if (__bt_cmp(t, key, &e) == 0) {
57 --- db.1.85/btree/bt_open.c.jj Thu Aug 18 15:30:42 1994
58 +++ db.1.85/btree/bt_open.c Wed Apr 19 17:56:12 2000
59 @@ -125,7 +125,7 @@ __bt_open(fname, flags, mode, openinfo,
62 (b.psize < MINPSIZE || b.psize > MAX_PAGE_OFFSET + 1 ||
63 - b.psize & sizeof(indx_t) - 1))
64 + b.psize & (sizeof(indx_t) - 1)))
67 /* Minimum number of keys per page; absolute minimum is 2. */
68 @@ -200,7 +200,7 @@ __bt_open(fname, flags, mode, openinfo,
74 if ((t->bt_fd = open(fname, flags, mode)) < 0)
77 @@ -245,7 +245,7 @@ __bt_open(fname, flags, mode, openinfo,
78 if (m.magic != BTREEMAGIC || m.version != BTREEVERSION)
80 if (m.psize < MINPSIZE || m.psize > MAX_PAGE_OFFSET + 1 ||
81 - m.psize & sizeof(indx_t) - 1)
82 + m.psize & (sizeof(indx_t) - 1))
84 if (m.flags & ~SAVEMETA)
86 @@ -259,7 +259,9 @@ __bt_open(fname, flags, mode, openinfo,
87 * Don't overflow the page offset type.
90 +#ifdef _STATBUF_ST_BLKSIZE
91 b.psize = sb.st_blksize;
93 if (b.psize < MINPSIZE)
95 if (b.psize > MAX_PAGE_OFFSET + 1)
96 @@ -278,8 +280,8 @@ __bt_open(fname, flags, mode, openinfo,
97 t->bt_psize = b.psize;
99 /* Set the cache size; must be a multiple of the page size. */
100 - if (b.cachesize && b.cachesize & b.psize - 1)
101 - b.cachesize += (~b.cachesize & b.psize - 1) + 1;
102 + if (b.cachesize && b.cachesize & (b.psize - 1))
103 + b.cachesize += (~b.cachesize & (b.psize - 1)) + 1;
104 if (b.cachesize < b.psize * MINCACHE)
105 b.cachesize = b.psize * MINCACHE;
107 @@ -388,18 +390,30 @@ tmp()
112 - char path[MAXPATHLEN];
113 + const char *envtmp;
115 + static const char fmt[] = "%s/bt.XXXXXX";
118 envtmp = getenv("TMPDIR");
119 - (void)snprintf(path,
120 - sizeof(path), "%s/bt.XXXXXX", envtmp ? envtmp : "/tmp");
123 + n = strlen (envtmp) + sizeof fmt;
125 + path = __builtin_alloca(n);
129 + (void)snprintf(path, n, fmt, envtmp ? envtmp : "/tmp");
131 (void)sigfillset(&set);
132 (void)sigprocmask(SIG_BLOCK, &set, &oset);
133 if ((fd = mkstemp(path)) != -1)
135 (void)sigprocmask(SIG_SETMASK, &oset, NULL);
142 --- db.1.85/btree/bt_page.c.jj Thu Jul 14 03:29:02 1994
143 +++ db.1.85/btree/bt_page.c Wed Apr 19 17:56:12 2000
144 @@ -65,6 +65,7 @@ __bt_free(t, h)
145 h->prevpg = P_INVALID;
146 h->nextpg = t->bt_free;
147 t->bt_free = h->pgno;
148 + F_SET(t, B_METADIRTY);
150 /* Make sure the page gets written back. */
151 return (mpool_put(t->bt_mp, h, MPOOL_DIRTY));
152 @@ -92,6 +93,7 @@ __bt_new(t, npg)
153 (h = mpool_get(t->bt_mp, t->bt_free, 0)) != NULL) {
155 t->bt_free = h->nextpg;
156 + F_SET(t, B_METADIRTY);
159 return (mpool_new(t->bt_mp, npg));
160 --- db.1.85/btree/bt_put.c.jj Tue Jul 26 20:56:14 1994
161 +++ db.1.85/btree/bt_put.c Wed Apr 19 17:56:12 2000
162 @@ -201,7 +201,7 @@ delete: if (__bt_dleaf(t, key, h, index
163 * into the offset array, shift the pointers up.
165 nbytes = NBLEAFDBT(key->size, data->size);
166 - if (h->upper - h->lower < nbytes + sizeof(indx_t)) {
167 + if ((u_int32_t) (h->upper - h->lower) < nbytes + sizeof(indx_t)) {
168 if ((status = __bt_split(t, h, key,
169 data, dflags, nbytes, index)) != RET_SUCCESS)
171 @@ -223,7 +223,7 @@ delete: if (__bt_dleaf(t, key, h, index
172 t->bt_cursor.pg.pgno == h->pgno && t->bt_cursor.pg.index >= index)
173 ++t->bt_cursor.pg.index;
175 - if (t->bt_order == NOT)
176 + if (t->bt_order == NOT) {
177 if (h->nextpg == P_INVALID) {
178 if (index == NEXTINDEX(h) - 1) {
179 t->bt_order = FORWARD;
180 @@ -237,6 +237,7 @@ delete: if (__bt_dleaf(t, key, h, index
181 t->bt_last.pgno = h->pgno;
186 mpool_put(t->bt_mp, h, MPOOL_DIRTY);
188 @@ -284,7 +285,7 @@ bt_fast(t, key, data, exactp)
189 * have to search to get split stack.
191 nbytes = NBLEAFDBT(key->size, data->size);
192 - if (h->upper - h->lower < nbytes + sizeof(indx_t))
193 + if ((u_int32_t) (h->upper - h->lower) < nbytes + sizeof(indx_t))
196 if (t->bt_order == FORWARD) {
197 --- db.1.85/btree/bt_seq.c.jj Tue Jul 26 18:57:24 1994
198 +++ db.1.85/btree/bt_seq.c Wed Apr 19 17:56:12 2000
199 @@ -92,7 +92,7 @@ __bt_seq(dbp, key, data, flags)
203 - * If scan unitialized as yet, or starting at a specific record, set
204 + * If scan uninitialized as yet, or starting at a specific record, set
205 * the scan to a specific key. Both __bt_seqset and __bt_seqadv pin
206 * the page the cursor references if they're successful.
208 @@ -358,13 +358,13 @@ __bt_first(t, key, erval, exactp)
209 * page) and return it.
211 if ((ep = __bt_search(t, key, exactp)) == NULL)
213 + return (RET_SPECIAL);
215 if (F_ISSET(t, B_NODUPS)) {
217 return (RET_SUCCESS);
222 * Walk backwards, as long as the entry matches and there are
223 * keys left in the tree. Save a copy of each match in case
224 --- db.1.85/btree/bt_split.c.jj Tue Jul 26 20:22:02 1994
225 +++ db.1.85/btree/bt_split.c Wed Apr 19 17:56:12 2000
226 @@ -215,7 +215,8 @@ __bt_split(t, sp, key, data, flags, ilen
229 /* Split the parent page if necessary or shift the indices. */
230 - if (h->upper - h->lower < nbytes + sizeof(indx_t)) {
231 + if ((u_int32_t) (h->upper - h->lower)
232 + < nbytes + sizeof(indx_t)) {
234 h = h->pgno == P_ROOT ?
235 bt_root(t, h, &l, &r, &skip, nbytes) :
236 @@ -673,7 +674,8 @@ bt_psplit(t, h, l, r, pskip, ilen)
237 * where we decide to try and copy too much onto the left page.
238 * Make sure that doesn't happen.
240 - if (skip <= off && used + nbytes >= full) {
241 + if ((skip <= off && used + nbytes + sizeof(indx_t) >= full)
242 + || nxt == top - 1) {
246 @@ -686,7 +688,7 @@ bt_psplit(t, h, l, r, pskip, ilen)
247 memmove((char *)l + l->upper, src, nbytes);
251 + used += nbytes + sizeof(indx_t);
253 if (!isbigkey || bigkeycnt == 3)
255 --- db.1.85/btree/bt_utils.c.jj Wed Jul 20 17:06:53 1994
256 +++ db.1.85/btree/bt_utils.c Wed Apr 19 17:56:12 2000
257 @@ -76,7 +76,7 @@ __bt_ret(t, e, key, rkey, data, rdata, c
258 bl = GETBLEAF(e->page, e->index);
261 - * We must copy big keys/data to make them contigous. Otherwise,
262 + * We must copy big keys/data to make them contiguous. Otherwise,
263 * leave the page pinned and don't copy unless the user specified
266 --- db.1.85/btree/btree.h.jj Thu Aug 18 15:30:43 1994
267 +++ db.1.85/btree/btree.h Wed Apr 19 17:58:46 2000
272 +#define mpool_open __mpool_open
273 +#define mpool_filter __mpool_filter
274 +#define mpool_new __mpool_new
275 +#define mpool_get __mpool_get
276 +#define mpool_put __mpool_put
277 +#define mpool_sync __mpool_sync
278 +#define mpool_close __mpool_close
280 #define DEFMINKEYPAGE (2) /* Minimum keys per page */
281 #define MINCACHE (5) /* Minimum cached pages */
282 #define MINPSIZE (512) /* Minimum page size */
283 @@ -161,7 +169,7 @@ typedef struct _rinternal {
285 LALIGN(sizeof(recno_t) + sizeof(pgno_t))
287 -/* Copy a RINTERAL entry to the page. */
288 +/* Copy a RINTERNAL entry to the page. */
289 #define WR_RINTERNAL(p, nrecs, pgno) { \
290 *(recno_t *)p = nrecs; \
291 p += sizeof(recno_t); \
292 --- db.1.85/hash/extern.h.jj Thu Jun 16 22:30:14 1994
293 +++ db.1.85/hash/extern.h Wed Apr 19 17:56:12 2000
294 @@ -52,7 +52,7 @@ void __free_ovflpage __P((HTAB *, BUFHE
295 BUFHEAD *__get_buf __P((HTAB *, u_int32_t, BUFHEAD *, int));
296 int __get_page __P((HTAB *, char *, u_int32_t, int, int, int));
297 int __ibitmap __P((HTAB *, int, int, int));
298 -u_int32_t __log2 __P((u_int32_t));
299 +u_int32_t __hash_log2 __P((u_int32_t));
300 int __put_page __P((HTAB *, char *, u_int32_t, int, int));
301 void __reclaim_buf __P((HTAB *, BUFHEAD *));
302 int __split_page __P((HTAB *, u_int32_t, u_int32_t));
303 --- db.1.85/hash/hash.c.jj Fri Jun 24 17:12:29 1994
304 +++ db.1.85/hash/hash.c Wed Apr 19 17:56:12 2000
305 @@ -157,7 +157,8 @@ __hash_open(file, flags, mode, info, dfl
306 if (hashp->VERSION != HASHVERSION &&
307 hashp->VERSION != OLDHASHVERSION)
308 RETURN_ERROR(EFTYPE, error1);
309 - if (hashp->hash(CHARKEY, sizeof(CHARKEY)) != hashp->H_CHARKEY)
310 + if (hashp->hash(CHARKEY, sizeof(CHARKEY))
311 + != (u_int32_t) hashp->H_CHARKEY)
312 RETURN_ERROR(EFTYPE, error1);
314 * Figure out how many segments we need. Max_Bucket is the
315 @@ -189,7 +190,7 @@ __hash_open(file, flags, mode, info, dfl
316 __buf_init(hashp, DEF_BUFSIZE);
318 hashp->new_file = new_table;
319 - hashp->save_file = file && (hashp->flags & O_RDWR);
320 + hashp->save_file = file && (hashp->flags & O_ACCMODE) != O_RDONLY;
322 if (!(dbp = (DB *)malloc(sizeof(DB)))) {
324 @@ -281,7 +282,9 @@ init_hash(hashp, file, info)
328 +#ifdef _STATBUF_ST_BLKSIZE
334 @@ -298,17 +301,19 @@ init_hash(hashp, file, info)
335 memset(hashp->BITMAPS, 0, sizeof (hashp->BITMAPS));
337 /* Fix bucket size to be optimal for file system */
338 +#ifdef _STATBUF_ST_BLKSIZE
340 if (stat(file, &statbuf))
342 hashp->BSIZE = statbuf.st_blksize;
343 - hashp->BSHIFT = __log2(hashp->BSIZE);
344 + hashp->BSHIFT = __hash_log2(hashp->BSIZE);
350 /* Round pagesize up to power of 2 */
351 - hashp->BSHIFT = __log2(info->bsize);
352 + hashp->BSHIFT = __hash_log2(info->bsize);
353 hashp->BSIZE = 1 << hashp->BSHIFT;
354 if (hashp->BSIZE > MAX_BSIZE) {
356 @@ -357,7 +362,7 @@ init_htab(hashp, nelem)
358 nelem = (nelem - 1) / hashp->FFACTOR + 1;
360 - l2 = __log2(MAX(nelem, 2));
361 + l2 = __hash_log2(MAX(nelem, 2));
364 hashp->SPARES[l2] = l2 + 1;
365 @@ -375,7 +380,7 @@ init_htab(hashp, nelem)
368 nsegs = (nbuckets - 1) / hashp->SGSIZE + 1;
369 - nsegs = 1 << __log2(nsegs);
370 + nsegs = 1 << __hash_log2(nsegs);
372 if (nsegs > hashp->DSIZE)
373 hashp->DSIZE = nsegs;
374 @@ -505,7 +510,7 @@ flush_meta(hashp)
376 if (wsize != sizeof(HASHHDR)) {
378 - hashp->errno = errno;
379 + hashp->errnum = errno;
382 for (i = 0; i < NCACHED; i++)
383 @@ -536,7 +541,7 @@ hash_get(dbp, key, data, flag)
385 hashp = (HTAB *)dbp->internal;
387 - hashp->errno = errno = EINVAL;
388 + hashp->errnum = errno = EINVAL;
391 return (hash_access(hashp, HASH_GET, (DBT *)key, data));
392 @@ -553,11 +558,11 @@ hash_put(dbp, key, data, flag)
394 hashp = (HTAB *)dbp->internal;
395 if (flag && flag != R_NOOVERWRITE) {
396 - hashp->errno = errno = EINVAL;
397 + hashp->errnum = errno = EINVAL;
400 if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
401 - hashp->errno = errno = EPERM;
402 + hashp->errnum = errno = EPERM;
405 return (hash_access(hashp, flag == R_NOOVERWRITE ?
406 @@ -574,11 +579,11 @@ hash_delete(dbp, key, flag)
408 hashp = (HTAB *)dbp->internal;
409 if (flag && flag != R_CURSOR) {
410 - hashp->errno = errno = EINVAL;
411 + hashp->errnum = errno = EINVAL;
414 if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
415 - hashp->errno = errno = EPERM;
416 + hashp->errnum = errno = EPERM;
419 return (hash_access(hashp, HASH_DELETE, (DBT *)key, NULL));
420 @@ -729,7 +734,7 @@ hash_seq(dbp, key, data, flag)
422 hashp = (HTAB *)dbp->internal;
423 if (flag && flag != R_FIRST && flag != R_NEXT) {
424 - hashp->errno = errno = EINVAL;
425 + hashp->errnum = errno = EINVAL;
428 #ifdef HASH_STATISTICS
429 @@ -744,7 +749,7 @@ hash_seq(dbp, key, data, flag)
430 for (bp = NULL; !bp || !bp[0]; ) {
431 if (!(bufp = hashp->cpage)) {
432 for (bucket = hashp->cbucket;
433 - bucket <= hashp->MAX_BUCKET;
434 + bucket <= (u_int32_t) hashp->MAX_BUCKET;
435 bucket++, hashp->cndx = 1) {
436 bufp = __get_buf(hashp, bucket, NULL, 0);
438 @@ -842,13 +847,13 @@ __expand_table(hashp)
439 * * increases), we need to copy the current contents of the spare
440 * split bucket to the next bucket.
442 - spare_ndx = __log2(hashp->MAX_BUCKET + 1);
443 + spare_ndx = __hash_log2(hashp->MAX_BUCKET + 1);
444 if (spare_ndx > hashp->OVFL_POINT) {
445 hashp->SPARES[spare_ndx] = hashp->SPARES[hashp->OVFL_POINT];
446 hashp->OVFL_POINT = spare_ndx;
449 - if (new_bucket > hashp->HIGH_MASK) {
450 + if (new_bucket > (u_int32_t) hashp->HIGH_MASK) {
451 /* Starting a new doubling */
452 hashp->LOW_MASK = hashp->HIGH_MASK;
453 hashp->HIGH_MASK = new_bucket | hashp->LOW_MASK;
454 @@ -868,7 +873,7 @@ hash_realloc(p_ptr, oldsize, newsize)
458 - if (p = malloc(newsize)) {
459 + if ((p = malloc(newsize))) {
460 memmove(p, *p_ptr, oldsize);
461 memset((char *)p + oldsize, 0, newsize - oldsize);
463 --- db.1.85/hash/hash.h.jj Fri Jun 24 17:12:29 1994
464 +++ db.1.85/hash/hash.h Wed Apr 19 17:56:12 2000
465 @@ -71,28 +71,28 @@ typedef struct hashhdr { /* Disk reside
466 int dsize; /* Directory Size */
467 int ssize; /* Segment Size */
468 int sshift; /* Segment shift */
469 - int ovfl_point; /* Where overflow pages are being
470 + int ovfl_point; /* Where overflow pages are being
472 int last_freed; /* Last overflow page freed */
473 int max_bucket; /* ID of Maximum bucket in use */
474 int high_mask; /* Mask to modulo into entire table */
475 - int low_mask; /* Mask to modulo into lower half of
476 + int low_mask; /* Mask to modulo into lower half of
478 int ffactor; /* Fill factor */
479 int nkeys; /* Number of keys in hash table */
480 int hdrpages; /* Size of table header */
481 int h_charkey; /* value of hash(CHARKEY) */
482 -#define NCACHED 32 /* number of bit maps and spare
483 +#define NCACHED 32 /* number of bit maps and spare
485 int spares[NCACHED];/* spare pages for overflow */
486 - u_int16_t bitmaps[NCACHED]; /* address of overflow page
487 + u_int16_t bitmaps[NCACHED]; /* address of overflow page
491 typedef struct htab { /* Memory resident data structure */
492 HASHHDR hdr; /* Header */
493 int nsegs; /* Number of allocated segments */
494 - int exsegs; /* Number of extra allocated
495 + int exsegs; /* Number of extra allocated
497 u_int32_t /* Hash function */
498 (*hash)__P((const void *, size_t));
499 @@ -103,16 +103,16 @@ typedef struct htab { /* Memory reside
500 BUFHEAD *cpage; /* Current page */
501 int cbucket; /* Current bucket */
502 int cndx; /* Index of next item on cpage */
503 - int errno; /* Error Number -- for DBM
505 - int new_file; /* Indicates if fd is backing store
506 + int errnum; /* Error Number -- for DBM
508 + int new_file; /* Indicates if fd is backing store
510 - int save_file; /* Indicates whether we need to flush
511 + int save_file; /* Indicates whether we need to flush
514 u_int32_t *mapp[NCACHED]; /* Pointers to page maps */
515 int nmaps; /* Initial number of bitmaps */
516 - int nbufs; /* Number of buffers left to
517 + int nbufs; /* Number of buffers left to
519 BUFHEAD bufhead; /* Header of buffer lru list */
520 SEGMENT *dir; /* Hash Bucket directory */
521 @@ -170,7 +170,7 @@ typedef struct htab { /* Memory reside
522 #define OADDR_OF(S,O) ((u_int32_t)((u_int32_t)(S) << SPLITSHIFT) + (O))
524 #define BUCKET_TO_PAGE(B) \
525 - (B) + hashp->HDRPAGES + ((B) ? hashp->SPARES[__log2((B)+1)-1] : 0)
526 + (B) + hashp->HDRPAGES + ((B) ? hashp->SPARES[__hash_log2((B)+1)-1] : 0)
527 #define OADDR_TO_PAGE(B) \
528 BUCKET_TO_PAGE ( (1 << SPLITNUM((B))) -1 ) + OPAGENUM((B));
530 @@ -194,7 +194,7 @@ typedef struct htab { /* Memory reside
531 * so it starts on this page and continues on the next.
532 * The format of the page is:
533 * KEY_OFF PARTIAL_KEY OVFL_PAGENO OVFLPAGE
536 * KEY_OFF -- offset of the beginning of the key
538 * OVFL_PAGENO - page number of the next overflow page
539 @@ -229,7 +229,7 @@ typedef struct htab { /* Memory reside
540 * OVFL_PAGENO - page number of the next overflow page
545 * This must be the first key/data pair on the page.
546 * There are two cases:
548 --- db.1.85/hash/hash_bigkey.c.jj Fri Jun 24 17:12:30 1994
549 +++ db.1.85/hash/hash_bigkey.c Wed Apr 19 17:56:12 2000
550 @@ -121,7 +121,7 @@ __big_insert(hashp, bufp, key, val)
557 move_bytes = MIN(FREESPACE(p), val_size);
558 off = OFFSET(p) - move_bytes;
559 @@ -134,6 +134,7 @@ __big_insert(hashp, bufp, key, val)
564 p = (u_int16_t *)bufp->page;
566 bufp->flags |= BUF_MOD;
567 @@ -147,7 +148,7 @@ __big_insert(hashp, bufp, key, val)
568 * Here's the hack to make sure that if the data ends on the
569 * same page as the key ends, FREESPACE is at least one.
571 - if (space == val_size && val_size == val->size)
572 + if ((int) space == val_size && (size_t) val_size == val->size)
574 off = OFFSET(p) - move_bytes;
575 memmove(cp + off, val_data, move_bytes);
576 @@ -249,7 +250,7 @@ __big_delete(hashp, bufp)
577 bufp->flags |= BUF_MOD;
579 __free_ovflpage(hashp, rbufp);
580 - if (last_bfp != rbufp)
581 + if (last_bfp && last_bfp != rbufp)
582 __free_ovflpage(hashp, last_bfp);
585 @@ -431,7 +432,7 @@ __big_return(hashp, bufp, ndx, val, set_
588 val->size = collect_data(hashp, bufp, (int)len, set_current);
589 - if (val->size == -1)
590 + if (val->size == (size_t) -1)
592 if (save_p->addr != save_addr) {
593 /* We are pretty short on buffers. */
594 @@ -510,7 +511,7 @@ __big_keydata(hashp, bufp, key, val, set
597 key->size = collect_key(hashp, bufp, 0, val, set);
598 - if (key->size == -1)
599 + if (key->size == (size_t) -1)
601 key->data = (u_char *)hashp->tmp_key;
603 @@ -590,7 +591,7 @@ __big_split(hashp, op, np, big_keyp, add
605 change = (__call_hash(hashp, key.data, key.size) != obucket);
607 - if (ret->next_addr = __find_last_page(hashp, &big_keyp)) {
608 + if ((ret->next_addr = __find_last_page(hashp, &big_keyp))) {
610 __get_buf(hashp, ret->next_addr, big_keyp, 0)))
612 --- db.1.85/hash/hash_log2.c.jj Tue May 31 22:56:53 1994
613 +++ db.1.85/hash/hash_log2.c Wed Apr 19 17:56:12 2000
614 @@ -42,8 +42,10 @@ static char sccsid[] = "@(#)hash_log2.c
618 +u_int32_t __hash_log2 __P((u_int32_t));
625 register u_int32_t i, limit;
626 --- db.1.85/hash/ndbm.c.jj Thu Jul 21 20:02:40 1994
627 +++ db.1.85/hash/ndbm.c Wed Apr 19 17:56:12 2000
628 @@ -47,6 +47,7 @@ static char sccsid[] = "@(#)ndbm.c 8.4 (
636 @@ -61,8 +62,16 @@ dbm_open(file, flags, mode)
642 - char path[MAXPATHLEN];
643 + const size_t len = strlen(file) + sizeof (DBM_SUFFIX);
647 + char *path = malloc(len);
654 @@ -72,7 +81,11 @@ dbm_open(file, flags, mode)
656 (void)strcpy(path, file);
657 (void)strcat(path, DBM_SUFFIX);
658 - return ((DBM *)__hash_open(path, flags, mode, &info, 0));
659 + db = (DBM *)__hash_open(path, flags, mode, &info, 0);
667 @@ -180,7 +193,7 @@ dbm_error(db)
670 hp = (HTAB *)db->internal;
671 - return (hp->errno);
672 + return (hp->errnum);
676 @@ -190,7 +203,7 @@ dbm_clearerr(db)
679 hp = (HTAB *)db->internal;
685 --- db.1.85/recno/rec_close.c.jj Thu Aug 18 17:23:29 1994
686 +++ db.1.85/recno/rec_close.c Wed Apr 19 17:56:12 2000
687 @@ -79,13 +79,14 @@ __rec_close(dbp)
688 if (F_ISSET(t, R_MEMMAPPED) && munmap(t->bt_smap, t->bt_msize))
691 - if (!F_ISSET(t, R_INMEM))
692 + if (!F_ISSET(t, R_INMEM)) {
693 if (F_ISSET(t, R_CLOSEFP)) {
694 if (fclose(t->bt_rfp))
697 if (close(t->bt_rfd))
701 if (__bt_close(dbp) == RET_ERROR)
703 @@ -150,7 +151,7 @@ __rec_sync(dbp, flags)
705 status = (dbp->seq)(dbp, &key, &data, R_FIRST);
706 while (status == RET_SUCCESS) {
707 - if (write(t->bt_rfd, data.data, data.size) != data.size)
708 + if ((size_t) write(t->bt_rfd, data.data, data.size) != data.size)
710 status = (dbp->seq)(dbp, &key, &data, R_NEXT);
712 @@ -162,7 +163,7 @@ __rec_sync(dbp, flags)
713 while (status == RET_SUCCESS) {
714 iov[0].iov_base = data.data;
715 iov[0].iov_len = data.size;
716 - if (writev(t->bt_rfd, iov, 2) != data.size + 1)
717 + if ((size_t) writev(t->bt_rfd, iov, 2) != data.size + 1)
719 status = (dbp->seq)(dbp, &key, &data, R_NEXT);
721 --- db.1.85/recno/rec_put.c.jj Thu Aug 18 17:24:16 1994
722 +++ db.1.85/recno/rec_put.c Wed Apr 19 17:56:12 2000
723 @@ -170,7 +170,7 @@ einval: errno = EINVAL;
725 if (flags == R_SETCURSOR)
726 t->bt_cursor.rcursor = nrec;
729 F_SET(t, R_MODIFIED);
730 return (__rec_ret(t, NULL, nrec, key, NULL));
732 @@ -256,7 +256,7 @@ __rec_iput(t, nrec, data, flags)
733 * the offset array, shift the pointers up.
735 nbytes = NRLEAFDBT(data->size);
736 - if (h->upper - h->lower < nbytes + sizeof(indx_t)) {
737 + if ((u_int32_t) (h->upper - h->lower) < nbytes + sizeof(indx_t)) {
738 status = __bt_split(t, h, NULL, data, dflags, nbytes, index);
739 if (status == RET_SUCCESS)
741 --- db.1.85/recno/rec_seq.c.jj Thu Jul 14 03:35:40 1994
742 +++ db.1.85/recno/rec_seq.c Wed Apr 19 17:56:12 2000
748 +#if defined(LIBC_SCCS) && !defined(lint)
749 static char sccsid[] = "@(#)rec_seq.c 8.3 (Berkeley) 7/14/94";
750 #endif /* not lint */
752 --- db.1.85/recno/rec_utils.c.jj Sat Jul 16 16:55:08 1994
753 +++ db.1.85/recno/rec_utils.c Wed Apr 19 17:56:12 2000
754 @@ -90,7 +90,7 @@ dataonly:
755 return (RET_SUCCESS);
758 - * We must copy big keys/data to make them contigous. Otherwise,
759 + * We must copy big keys/data to make them contiguous. Otherwise,
760 * leave the page pinned and don't copy unless the user specified
763 --- db.1.85/mpool/mpool.c.jj Tue Jul 26 21:19:35 1994
764 +++ db.1.85/mpool/mpool.c Wed Apr 19 18:06:21 2000
765 @@ -50,6 +50,14 @@ static char sccsid[] = "@(#)mpool.c 8.5
766 #define __MPOOLINTERFACE_PRIVATE
769 +#define mpool_open __mpool_open
770 +#define mpool_filter __mpool_filter
771 +#define mpool_new __mpool_new
772 +#define mpool_get __mpool_get
773 +#define mpool_put __mpool_put
774 +#define mpool_sync __mpool_sync
775 +#define mpool_close __mpool_close
777 static BKT *mpool_bkt __P((MPOOL *));
778 static BKT *mpool_look __P((MPOOL *, pgno_t));
779 static int mpool_write __P((MPOOL *, BKT *));
780 @@ -109,7 +117,7 @@ mpool_filter(mp, pgin, pgout, pgcookie)
782 mp->pgcookie = pgcookie;
788 * Get a new page of memory.
789 @@ -205,7 +213,8 @@ mpool_get(mp, pgno, flags)
790 off = mp->pagesize * pgno;
791 if (lseek(mp->fd, off, SEEK_SET) != off)
793 - if ((nr = read(mp->fd, bp->page, mp->pagesize)) != mp->pagesize) {
794 + if ((u_long) (nr = read(mp->fd, bp->page, mp->pagesize))
799 @@ -300,6 +309,23 @@ mpool_sync(mp)
800 return (fsync(mp->fd) ? RET_ERROR : RET_SUCCESS);
810 +#define weak_alias(original, alias) \
811 + asm (".weak " #alias "\n" #alias " = " #original);
812 +weak_alias (__mpool_open, mpool_open)
813 +weak_alias (__mpool_filter, mpool_filter)
814 +weak_alias (__mpool_new, mpool_new)
815 +weak_alias (__mpool_get, mpool_get)
816 +weak_alias (__mpool_put, mpool_put)
817 +weak_alias (__mpool_close, mpool_close)
818 +weak_alias (__mpool_sync, mpool_sync)
822 * Get a page from the cache (or create one).
823 @@ -380,7 +406,7 @@ mpool_write(mp, bp)
824 off = mp->pagesize * bp->pgno;
825 if (lseek(mp->fd, off, SEEK_SET) != off)
827 - if (write(mp->fd, bp->page, mp->pagesize) != mp->pagesize)
828 + if ((u_long) write(mp->fd, bp->page, mp->pagesize) != mp->pagesize)
831 bp->flags &= ~MPOOL_DIRTY;
832 @@ -436,7 +462,7 @@ mpool_stat(mp)
833 mp->pagealloc, mp->pageflush);
834 if (mp->cachehit + mp->cachemiss)
835 (void)fprintf(stderr,
836 - "%.0f%% cache hit rate (%lu hits, %lu misses)\n",
837 + "%.0f%% cache hit rate (%lu hits, %lu misses)\n",
838 ((double)mp->cachehit / (mp->cachehit + mp->cachemiss))
839 * 100, mp->cachehit, mp->cachemiss);
840 (void)fprintf(stderr, "%lu page reads, %lu page writes\n",
841 @@ -456,7 +482,7 @@ mpool_stat(mp)
848 (void)fprintf(stderr, "\n");
850 --- db.1.85/db/db.c.jj Tue Feb 22 00:07:47 1994
851 +++ db.1.85/db/db.c Wed Apr 19 18:06:46 2000
852 @@ -44,6 +44,8 @@ static char sccsid[] = "@(#)db.c 8.4 (Be
856 +#define dbopen __dbopen
859 dbopen(fname, flags, mode, type, openinfo)
861 @@ -72,9 +74,13 @@ dbopen(fname, flags, mode, type, openinf
866 +#define weak_alias(original, alias) \
867 + asm (".weak " #alias "\n" #alias " = " #original);
868 +weak_alias (__dbopen, dbopen)
876 @@ -90,10 +96,14 @@ __dbpanic(dbp)
879 /* The only thing that can succeed is a close. */
880 - dbp->del = (int (*)())__dberr;
881 - dbp->fd = (int (*)())__dberr;
882 - dbp->get = (int (*)())__dberr;
883 - dbp->put = (int (*)())__dberr;
884 - dbp->seq = (int (*)())__dberr;
885 - dbp->sync = (int (*)())__dberr;
886 + dbp->del = (int (*)__P((const struct __db *,
887 + const DBT *, u_int))) __dberr;
888 + dbp->get = (int (*)__P((const struct __db *,
889 + const DBT *, DBT *, u_int))) __dberr;
890 + dbp->put = (int (*)__P((const struct __db *,
891 + DBT *, const DBT *, u_int))) __dberr;
892 + dbp->seq = (int (*)__P((const struct __db *,
893 + DBT *, DBT *, u_int))) __dberr;
894 + dbp->sync = (int (*)__P((const struct __db *, u_int))) __dberr;
895 + dbp->fd = (int (*)__P((const struct __db *))) __dberr;
897 --- db.1.85/PORT/include/ndbm.h.jj Thu Jun 3 05:32:29 1993
898 +++ db.1.85/PORT/include/ndbm.h Wed Apr 19 17:56:12 2000
900 * @(#)ndbm.h 8.1 (Berkeley) 6/2/93
910 @@ -72,6 +72,8 @@ datum dbm_nextkey __P((DBM *));
911 DBM *dbm_open __P((const char *, int, int));
912 int dbm_store __P((DBM *, datum, datum, int));
913 int dbm_dirfno __P((DBM *));
914 +int dbm_error __P((DBM *));
915 +int dbm_clearerr __P((DBM *));
918 -#endif /* !_NDBM_H_ */
920 --- db.1.85/PORT/linux/include/compat.h.jj Tue Jun 21 00:13:19 1994
921 +++ db.1.85/PORT/linux/include/compat.h Wed Apr 19 17:56:12 2000
924 - * Copyright (c) 1991, 1993
925 - * The Regents of the University of California. All rights reserved.
927 - * Redistribution and use in source and binary forms, with or without
928 - * modification, are permitted provided that the following conditions
930 - * 1. Redistributions of source code must retain the above copyright
931 - * notice, this list of conditions and the following disclaimer.
932 - * 2. Redistributions in binary form must reproduce the above copyright
933 - * notice, this list of conditions and the following disclaimer in the
934 - * documentation and/or other materials provided with the distribution.
935 - * 3. All advertising materials mentioning features or use of this software
936 - * must display the following acknowledgement:
937 - * This product includes software developed by the University of
938 - * California, Berkeley and its contributors.
939 - * 4. Neither the name of the University nor the names of its contributors
940 - * may be used to endorse or promote products derived from this software
941 - * without specific prior written permission.
943 - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
944 - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
945 - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
946 - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
947 - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
948 - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
949 - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
950 - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
951 - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
952 - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
955 - * @(#)compat.h 8.13 (Berkeley) 2/21/94
960 +/* Values for building 4.4 BSD db routines in the GNU C library. */
962 -#include <sys/types.h>
967 - * If your system doesn't typedef u_long, u_short, or u_char, change
971 -typedef unsigned char u_char; /* 4.[34]BSD names. */
972 -typedef unsigned int u_int;
973 -typedef unsigned long u_long;
974 -typedef unsigned short u_short;
977 -/* If your system doesn't typedef size_t, change the 0 to a 1. */
979 -typedef unsigned int size_t; /* POSIX, 4.[34]BSD names. */
982 -/* If your system doesn't typedef ssize_t, change the 0 to a 1. */
984 -typedef int ssize_t; /* POSIX names. */
988 - * If your system doesn't have the POSIX type for a signal mask,
989 - * change the 0 to a 1.
991 -#if 0 /* POSIX 1003.1 signal mask type. */
992 -typedef unsigned int sigset_t;
996 - * If your system's vsprintf returns a char *, not an int,
997 - * change the 0 to a 1.
1000 -#define VSPRINTF_CHARSTAR
1004 - * If you don't have POSIX 1003.1 signals, the signal code surrounding the
1005 - * temporary file creation is intended to block all of the possible signals
1006 - * long enough to create the file and unlink it. All of this stuff is
1007 - * intended to use old-style BSD calls to fake POSIX 1003.1 calls.
1009 -#ifdef NO_POSIX_SIGNALS
1010 -#define sigemptyset(set) (*(set) = 0)
1011 -#define sigfillset(set) (*(set) = ~(sigset_t)0, 0)
1012 -#define sigaddset(set,signo) (*(set) |= sigmask(signo), 0)
1013 -#define sigdelset(set,signo) (*(set) &= ~sigmask(signo), 0)
1014 -#define sigismember(set,signo) ((*(set) & sigmask(signo)) != 0)
1016 -#define SIG_BLOCK 1
1017 -#define SIG_UNBLOCK 2
1018 -#define SIG_SETMASK 3
1020 -static int __sigtemp; /* For the use of sigprocmask */
1022 -/* Repeated test of oset != NULL is to avoid "*0". */
1023 -#define sigprocmask(how, set, oset) \
1025 - (((how) == SIG_BLOCK) ? \
1026 - sigblock(0) | *(set) : \
1027 - (((how) == SIG_UNBLOCK) ? \
1028 - sigblock(0) & ~(*(set)) : \
1029 - ((how) == SIG_SETMASK ? \
1030 - *(set) : sigblock(0))))), \
1031 - ((oset) ? (*(oset ? oset : set) = sigsetmask(__sigtemp)) : \
1032 - sigsetmask(__sigtemp)), 0)
1036 - * If your system doesn't have an include file with the appropriate
1037 - * byte order set, make sure you specify the correct one.
1040 -#define LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
1041 -#define BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
1042 -#define BYTE_ORDER LITTLE_ENDIAN /* Set for your system. */
1045 -#if defined(SYSV) || defined(SYSTEM5)
1046 -#define index(a, b) strchr(a, b)
1047 -#define rindex(a, b) strrchr(a, b)
1048 -#define bzero(a, b) memset(a, 0, b)
1049 -#define bcmp(a, b, n) memcmp(a, b, n)
1050 -#define bcopy(a, b, n) memmove(b, a, n)
1053 -#if defined(BSD) || defined(BSD4_3)
1054 -#define strchr(a, b) index(a, b)
1055 -#define strrchr(a, b) rindex(a, b)
1056 -#define memcmp(a, b, n) bcmp(a, b, n)
1057 -#define memmove(a, b, n) bcopy(b, a, n)
1061 - * 32-bit machine. The db routines are theoretically independent of
1062 - * the size of u_shorts and u_longs, but I don't know that anyone has
1063 - * ever actually tried it. At a minimum, change the following #define's
1064 - * if you are trying to compile on a different type of system.
1067 -#define USHRT_MAX 0xFFFF
1068 -#define ULONG_MAX 0xFFFFFFFF
1071 -#ifndef O_ACCMODE /* POSIX 1003.1 access mode mask. */
1072 -#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
1075 -#ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 RE limit. */
1076 -#define _POSIX2_RE_DUP_MAX 255
1081 * If you can't provide lock values in the open(2) call. Note, this
1082 @@ -163,41 +17,26 @@ static int __sigtemp; /* For the use of
1089 #define EFTYPE EINVAL /* POSIX 1003.1 format errno. */
1092 -#ifndef WCOREDUMP /* 4.4BSD extension */
1093 -#define WCOREDUMP(a) 0
1096 -#ifndef STDERR_FILENO
1097 -#define STDIN_FILENO 0 /* ANSI C #defines */
1098 -#define STDOUT_FILENO 1
1099 -#define STDERR_FILENO 2
1103 -#define SEEK_SET 0 /* POSIX 1003.1 seek values */
1107 +#include <unistd.h>
1108 +#include <limits.h>
1110 #ifndef _POSIX_VDISABLE /* POSIX 1003.1 disabling char. */
1111 #define _POSIX_VDISABLE 0 /* Some systems used 0. */
1114 +#include <termios.h>
1116 #ifndef TCSASOFT /* 4.4BSD extension. */
1120 -#ifndef _POSIX2_RE_DUP_MAX /* POSIX 1003.2 values. */
1121 -#define _POSIX2_RE_DUP_MAX 255
1124 -#ifndef NULL /* ANSI C #defines NULL everywhere. */
1127 +#include <sys/param.h>
1129 #ifndef MAX /* Usually found in <sys/param.h>. */
1130 #define MAX(_a,_b) ((_a)<(_b)?(_b):(_a))
1131 @@ -206,26 +45,5 @@ static int __sigtemp; /* For the use of
1132 #define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))
1135 -/* Default file permissions. */
1136 -#ifndef DEFFILEMODE /* 4.4BSD extension. */
1137 -#define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
1140 -#ifndef S_ISDIR /* POSIX 1003.1 file type tests. */
1141 -#define S_ISDIR(m) ((m & 0170000) == 0040000) /* directory */
1142 -#define S_ISCHR(m) ((m & 0170000) == 0020000) /* char special */
1143 -#define S_ISBLK(m) ((m & 0170000) == 0060000) /* block special */
1144 -#define S_ISREG(m) ((m & 0170000) == 0100000) /* regular file */
1145 -#define S_ISFIFO(m) ((m & 0170000) == 0010000) /* fifo */
1147 -#ifndef S_ISLNK /* BSD POSIX 1003.1 extensions */
1148 -#define S_ISLNK(m) ((m & 0170000) == 0120000) /* symbolic link */
1149 -#define S_ISSOCK(m) ((m & 0170000) == 0140000) /* socket */
1152 -/* The type of a va_list. */
1153 -#ifndef _BSD_VA_LIST_ /* 4.4BSD #define. */
1154 -#define _BSD_VA_LIST_ char *
1157 -#endif /* !_COMPAT_H_ */
1158 +#endif /* compat.h */
1159 --- db.1.85/PORT/linux/Makefile.jj Thu Jul 14 03:43:16 1994
1160 +++ db.1.85/PORT/linux/Makefile Thu Apr 20 08:54:43 2000
1162 # @(#)Makefile 8.9 (Berkeley) 7/14/94
1165 +ARCH=$(shell uname -m)
1166 +ifeq ($(ARCH),alpha)
1171 +LIBDBSO=libdb.so.$(SOVER)
1173 OBJ1= hash.o hash_bigkey.o hash_buf.o hash_func.o hash_log2.o hash_page.o \
1176 OBJ2= bt_close.o bt_conv.o bt_debug.o bt_delete.o bt_get.o bt_open.o \
1177 bt_overflow.o bt_page.o bt_put.o bt_search.o bt_seq.o bt_split.o \
1179 @@ -10,93 +18,49 @@ OBJ3= db.o
1181 OBJ5= rec_close.o rec_delete.o rec_get.o rec_open.o rec_put.o rec_search.o \
1182 rec_seq.o rec_utils.o
1184 +OBJS= $(OBJ1) $(OBJ2) $(OBJ3) $(OBJ4) $(OBJ5) $(MISC)
1185 +SHOBJS= $(patsubst %.o,%.os,$(OBJS))
1188 +all: $(LIBDB) $(LIBDBSO) $(PROG)
1190 -${LIBDB}: ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC}
1194 - `lorder ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC} | tsort`
1199 - rm -f ${LIBDB} ${OBJ1} ${OBJ2} ${OBJ3} ${OBJ4} ${OBJ5} ${MISC}
1200 +$(LIBDBSO): $(SHOBJS)
1201 + $(CC) -Wl,-O1 -Wl,--version-script=libdb.map -Wl,-soname=$(LIBDBSO) -shared -o $@ $^
1202 + ln -sf $@ libdb.so
1205 -CL= ${CC} -c -D__DBINTERFACE_PRIVATE ${OORG} -I. -Iinclude
1206 +$(PROG): db_dump185.o $(LIBDBSO)
1207 + $(CC) -o $@ db_dump185.o -L. -ldb
1209 -hash.o: ../../hash/hash.c
1210 - ${CL} -I../../hash ../../hash/hash.c
1211 -hash_bigkey.o: ../../hash/hash_bigkey.c
1212 - ${CL} -I../../hash ../../hash/hash_bigkey.c
1213 -hash_buf.o: ../../hash/hash_buf.c
1214 - ${CL} -I../../hash ../../hash/hash_buf.c
1215 -hash_func.o: ../../hash/hash_func.c
1216 - ${CL} -I../../hash ../../hash/hash_func.c
1217 -hash_log2.o: ../../hash/hash_log2.c
1218 - ${CL} -I../../hash ../../hash/hash_log2.c
1219 -hash_page.o: ../../hash/hash_page.c
1220 - ${CL} -I../../hash ../../hash/hash_page.c
1221 -hsearch.o: ../../hash/hsearch.c
1222 - ${CL} -I../../hash ../../hash/hsearch.c
1223 -ndbm.o: ../../hash/ndbm.c
1224 - ${CL} -I../../hash ../../hash/ndbm.c
1226 -bt_close.o: ../../btree/bt_close.c
1227 - ${CL} -I../../btree ../../btree/bt_close.c
1228 -bt_conv.o: ../../btree/bt_conv.c
1229 - ${CL} -I../../btree ../../btree/bt_conv.c
1230 -bt_debug.o: ../../btree/bt_debug.c
1231 - ${CL} -I../../btree ../../btree/bt_debug.c
1232 -bt_delete.o: ../../btree/bt_delete.c
1233 - ${CL} -I../../btree ../../btree/bt_delete.c
1234 -bt_get.o: ../../btree/bt_get.c
1235 - ${CL} -I../../btree ../../btree/bt_get.c
1236 -bt_open.o: ../../btree/bt_open.c
1237 - ${CL} -I../../btree ../../btree/bt_open.c
1238 -bt_overflow.o: ../../btree/bt_overflow.c
1239 - ${CL} -I../../btree ../../btree/bt_overflow.c
1240 -bt_page.o: ../../btree/bt_page.c
1241 - ${CL} -I../../btree ../../btree/bt_page.c
1242 -bt_put.o: ../../btree/bt_put.c
1243 - ${CL} -I../../btree ../../btree/bt_put.c
1244 -bt_search.o: ../../btree/bt_search.c
1245 - ${CL} -I../../btree ../../btree/bt_search.c
1246 -bt_seq.o: ../../btree/bt_seq.c
1247 - ${CL} -I../../btree ../../btree/bt_seq.c
1248 -bt_split.o: ../../btree/bt_split.c
1249 - ${CL} -I../../btree ../../btree/bt_split.c
1250 -bt_stack.o: ../../btree/bt_stack.c
1251 - ${CL} -I../../btree ../../btree/bt_stack.c
1252 -bt_utils.o: ../../btree/bt_utils.c
1253 - ${CL} -I../../btree ../../btree/bt_utils.c
1255 + rm -f $(LIBDB) $(LIBDBSO) $(OBJS) $(SHOBJS)
1257 -db.o: ../../db/db.c
1258 - ${CL} ../../db/db.c
1260 +CL= $(CC) -c -D__DBINTERFACE_PRIVATE $(OORG) -I. -Iinclude
1262 +db_dump185.o: db_dump185.c
1264 +%.o: ../../hash/%.c
1265 + $(CL) -I../../hash -o $@ $<
1266 +%.os: ../../hash/%.c
1267 + $(CL) -I../../hash -fpic -o $@ $<
1268 +%.o: ../../btree/%.c
1269 + $(CL) -I../../btree -o $@ $<
1270 +%.os: ../../btree/%.c
1271 + $(CL) -I../../btree -fpic -o $@ $<
1272 +db.o: ../../db/db.c
1274 +db.os: ../../db/db.c
1275 + $(CL) -fpic -o $@ $<
1276 mpool.o: ../../mpool/mpool.c
1277 - ${CL} -I../../mpool ../../mpool/mpool.c
1279 -rec_close.o: ../../recno/rec_close.c
1280 - ${CL} -I../../recno ../../recno/rec_close.c
1281 -rec_delete.o: ../../recno/rec_delete.c
1282 - ${CL} -I../../recno ../../recno/rec_delete.c
1283 -rec_get.o: ../../recno/rec_get.c
1284 - ${CL} -I../../recno ../../recno/rec_get.c
1285 -rec_open.o: ../../recno/rec_open.c
1286 - ${CL} -I../../recno ../../recno/rec_open.c
1287 -rec_put.o: ../../recno/rec_put.c
1288 - ${CL} -I../../recno ../../recno/rec_put.c
1289 -rec_search.o: ../../recno/rec_search.c
1290 - ${CL} -I../../recno ../../recno/rec_search.c
1291 -rec_seq.o: ../../recno/rec_seq.c
1292 - ${CL} -I../../recno ../../recno/rec_seq.c
1293 -rec_utils.o: ../../recno/rec_utils.c
1294 - ${CL} -I../../recno ../../recno/rec_utils.c
1297 - ${CC} -DMEMMOVE -c -O -I. -Iinclude clib/memmove.c
1299 - ${CC} -c -O -I. -Iinclude clib/mktemp.c
1301 - ${CC} -c -O -I. -Iinclude clib/snprintf.c
1303 +mpool.os: ../../mpool/mpool.c
1304 + $(CL) -fpic -o $@ $<
1305 +%.o: ../../recno/%.c
1306 + $(CL) -I../../recno -o $@ $<
1307 +%.os: ../../recno/%.c
1308 + $(CL) -I../../recno -fpic -o $@ $<
1309 --- db.1.85/PORT/linux/libdb.map.jj Wed Apr 19 17:56:12 2000
1310 +++ db.1.85/PORT/linux/libdb.map Wed Apr 19 17:56:12 2000
1314 + # the real DB entry point.
1317 + # The compatibility functions.
1318 + dbm_clearerr; dbm_close; dbm_delete; dbm_dirfno; dbm_error;
1319 + dbm_fetch; dbm_firstkey; dbm_nextkey; dbm_open; dbm_store;
1323 --- db.1.85/PORT/linux/db_dump185.c.jj Thu Apr 20 08:49:24 2000
1324 +++ db.1.85/PORT/linux/db_dump185.c Thu Apr 20 08:50:25 2000
1327 + * See the file LICENSE for redistribution information.
1329 + * Copyright (c) 1996, 1997, 1998
1330 + * Sleepycat Software. All rights reserved.
1334 +static const char copyright[] =
1335 +"@(#) Copyright (c) 1996, 1997, 1998\n\
1336 + Sleepycat Software Inc. All rights reserved.\n";
1337 +static const char sccsid[] = "@(#)db_dump185.c 10.10 (Sleepycat) 4/10/98";
1340 +#ifndef NO_SYSTEM_INCLUDES
1341 +#include <sys/types.h>
1346 +#include <stdlib.h>
1348 +#include <string.h>
1349 +#include <unistd.h>
1354 +/* Hash Table Information */
1355 +typedef struct hashhdr185 { /* Disk resident portion */
1356 + int magic; /* Magic NO for hash tables */
1357 + int version; /* Version ID */
1358 + u_int32_t lorder; /* Byte Order */
1359 + int bsize; /* Bucket/Page Size */
1360 + int bshift; /* Bucket shift */
1361 + int dsize; /* Directory Size */
1362 + int ssize; /* Segment Size */
1363 + int sshift; /* Segment shift */
1364 + int ovfl_point; /* Where overflow pages are being
1366 + int last_freed; /* Last overflow page freed */
1367 + int max_bucket; /* ID of Maximum bucket in use */
1368 + int high_mask; /* Mask to modulo into entire table */
1369 + int low_mask; /* Mask to modulo into lower half of
1371 + int ffactor; /* Fill factor */
1372 + int nkeys; /* Number of keys in hash table */
1374 +typedef struct htab185 { /* Memory resident data structure */
1375 + HASHHDR185 hdr; /* Header */
1378 +/* Hash Table Information */
1379 +typedef struct hashhdr186 { /* Disk resident portion */
1380 + int32_t magic; /* Magic NO for hash tables */
1381 + int32_t version; /* Version ID */
1382 + int32_t lorder; /* Byte Order */
1383 + int32_t bsize; /* Bucket/Page Size */
1384 + int32_t bshift; /* Bucket shift */
1385 + int32_t ovfl_point; /* Where overflow pages are being allocated */
1386 + int32_t last_freed; /* Last overflow page freed */
1387 + int32_t max_bucket; /* ID of Maximum bucket in use */
1388 + int32_t high_mask; /* Mask to modulo into entire table */
1389 + int32_t low_mask; /* Mask to modulo into lower half of table */
1390 + int32_t ffactor; /* Fill factor */
1391 + int32_t nkeys; /* Number of keys in hash table */
1392 + int32_t hdrpages; /* Size of table header */
1393 + int32_t h_charkey; /* value of hash(CHARKEY) */
1394 +#define NCACHED 32 /* number of bit maps and spare points */
1395 + int32_t spares[NCACHED];/* spare pages for overflow */
1396 + u_int16_t bitmaps[NCACHED]; /* address of overflow page bitmaps */
1398 +typedef struct htab186 { /* Memory resident data structure */
1399 + HASHHDR186 hdr; /* Header */
1402 +typedef struct _epgno {
1403 + u_int32_t pgno; /* the page number */
1404 + u_int16_t index; /* the index on the page */
1407 +typedef struct _epg {
1408 + void *page; /* the (pinned) page */
1409 + u_int16_t index; /* the index on the page */
1412 +typedef struct _cursor {
1413 + EPGNO pg; /* B: Saved tree reference. */
1414 + DBT key; /* B: Saved key, or key.data == NULL. */
1415 + u_int32_t rcursor; /* R: recno cursor (1-based) */
1417 +#define CURS_ACQUIRE 0x01 /* B: Cursor needs to be reacquired. */
1418 +#define CURS_AFTER 0x02 /* B: Unreturned cursor after key. */
1419 +#define CURS_BEFORE 0x04 /* B: Unreturned cursor before key. */
1420 +#define CURS_INIT 0x08 /* RB: Cursor initialized. */
1424 +/* The in-memory btree/recno data structure. */
1425 +typedef struct _btree {
1426 + void *bt_mp; /* memory pool cookie */
1428 + void *bt_dbp; /* pointer to enclosing DB */
1430 + EPG bt_cur; /* current (pinned) page */
1431 + void *bt_pinned; /* page pinned across calls */
1433 + CURSOR bt_cursor; /* cursor */
1435 + EPGNO bt_stack[50]; /* stack of parent pages */
1436 + EPGNO *bt_sp; /* current stack pointer */
1438 + DBT bt_rkey; /* returned key */
1439 + DBT bt_rdata; /* returned data */
1441 + int bt_fd; /* tree file descriptor */
1443 + u_int32_t bt_free; /* next free page */
1444 + u_int32_t bt_psize; /* page size */
1445 + u_int16_t bt_ovflsize; /* cut-off for key/data overflow */
1446 + int bt_lorder; /* byte order */
1447 + /* sorted order */
1448 + enum { NOT, BACK, FORWARD } bt_order;
1449 + EPGNO bt_last; /* last insert */
1451 + /* B: key comparison function */
1452 + int (*bt_cmp) __P((const DBT *, const DBT *));
1453 + /* B: prefix comparison function */
1454 + size_t (*bt_pfx) __P((const DBT *, const DBT *));
1455 + /* R: recno input function */
1456 + int (*bt_irec) __P((struct _btree *, u_int32_t));
1458 + FILE *bt_rfp; /* R: record FILE pointer */
1459 + int bt_rfd; /* R: record file descriptor */
1461 + void *bt_cmap; /* R: current point in mapped space */
1462 + void *bt_smap; /* R: start of mapped space */
1463 + void *bt_emap; /* R: end of mapped space */
1464 + size_t bt_msize; /* R: size of mapped region. */
1466 + u_int32_t bt_nrecs; /* R: number of records */
1467 + size_t bt_reclen; /* R: fixed record length */
1468 + u_char bt_bval; /* R: delimiting byte/pad character */
1472 + * B_NODUPS and R_RECNO are stored on disk, and may not be changed.
1474 +#define B_INMEM 0x00001 /* in-memory tree */
1475 +#define B_METADIRTY 0x00002 /* need to write metadata */
1476 +#define B_MODIFIED 0x00004 /* tree modified */
1477 +#define B_NEEDSWAP 0x00008 /* if byte order requires swapping */
1478 +#define B_RDONLY 0x00010 /* read-only tree */
1480 +#define B_NODUPS 0x00020 /* no duplicate keys permitted */
1481 +#define R_RECNO 0x00080 /* record oriented tree */
1483 +#define R_CLOSEFP 0x00040 /* opened a file pointer */
1484 +#define R_EOF 0x00100 /* end of input file reached. */
1485 +#define R_FIXLEN 0x00200 /* fixed length records */
1486 +#define R_MEMMAPPED 0x00400 /* memory mapped file. */
1487 +#define R_INMEM 0x00800 /* in-memory file */
1488 +#define R_MODIFIED 0x01000 /* modified file */
1489 +#define R_RDONLY 0x02000 /* read-only file */
1491 +#define B_DB_LOCK 0x04000 /* DB_LOCK specified. */
1492 +#define B_DB_SHMEM 0x08000 /* DB_SHMEM specified. */
1493 +#define B_DB_TXN 0x10000 /* DB_TXN specified. */
1497 +void db_btree __P((DB *, int));
1498 +void db_hash __P((DB *, int));
1499 +void dbt_dump __P((DBT *));
1500 +void dbt_print __P((DBT *));
1501 +int main __P((int, char *[]));
1502 +void usage __P((void));
1505 + *progname = "db_dump185"; /* Program name. */
1512 + extern char *optarg;
1513 + extern int optind;
1516 + int ch, pflag, rval;
1519 + while ((ch = getopt(argc, argv, "f:p")) != EOF)
1522 + if (freopen(optarg, "w", stdout) == NULL)
1523 + err(1, "%s", optarg);
1538 + if ((dbp = dbopen(argv[0], O_RDONLY, 0, DB_BTREE, NULL)) == NULL) {
1539 + if ((dbp = dbopen(argv[0], O_RDONLY, 0, DB_HASH, NULL)) == NULL)
1540 + err(1, "%s", argv[0]);
1541 + db_hash(dbp, pflag);
1543 + db_btree(dbp, pflag);
1547 + * DB 1.85 DBTs are a subset of DB 2.0 DBTs, so we just use the
1548 + * new dump/print routines.
1551 + while (!(rval = dbp->seq(dbp, &key, &data, R_NEXT))) {
1556 + while (!(rval = dbp->seq(dbp, &key, &data, R_NEXT))) {
1568 + * Dump out hash header information.
1571 +db_hash(dbp, pflag)
1575 + HTAB185 *hash185p;
1576 + HTAB186 *hash186p;
1578 + printf("format=%s\n", pflag ? "print" : "bytevalue");
1579 + printf("type=hash\n");
1581 + /* DB 1.85 was version 2, DB 1.86 was version 3. */
1582 + hash185p = dbp->internal;
1583 + if (hash185p->hdr.version > 2) {
1584 + hash186p = dbp->internal;
1585 + printf("h_ffactor=%lu\n", (u_long)hash186p->hdr.ffactor);
1586 + if (hash186p->hdr.lorder != 0)
1587 + printf("db_lorder=%lu\n", (u_long)hash186p->hdr.lorder);
1588 + printf("db_pagesize=%lu\n", (u_long)hash186p->hdr.bsize);
1590 + printf("h_ffactor=%lu\n", (u_long)hash185p->hdr.ffactor);
1591 + if (hash185p->hdr.lorder != 0)
1592 + printf("db_lorder=%lu\n", (u_long)hash185p->hdr.lorder);
1593 + printf("db_pagesize=%lu\n", (u_long)hash185p->hdr.bsize);
1595 + printf("HEADER=END\n");
1600 + * Dump out btree header information.
1603 +db_btree(dbp, pflag)
1609 + btp = dbp->internal;
1611 + printf("format=%s\n", pflag ? "print" : "bytevalue");
1612 + printf("type=btree\n");
1613 +#ifdef NOT_AVAILABLE_IN_185
1614 + printf("bt_minkey=%lu\n", (u_long)XXX);
1615 + printf("bt_maxkey=%lu\n", (u_long)XXX);
1617 + if (btp->bt_lorder != 0)
1618 + printf("db_lorder=%lu\n", (u_long)btp->bt_lorder);
1619 + printf("db_pagesize=%lu\n", (u_long)btp->bt_psize);
1620 + if (!(btp->flags & B_NODUPS))
1621 + printf("duplicates=1\n");
1622 + printf("HEADER=END\n");
1625 +static char hex[] = "0123456789abcdef";
1629 + * Write out a key or data item using byte values.
1638 + for (len = dbtp->size, p = dbtp->data; len--; ++p)
1639 + (void)printf("%c%c",
1640 + hex[(*p & 0xf0) >> 4], hex[*p & 0x0f]);
1646 + * Write out a key or data item using printable characters.
1655 + for (len = dbtp->size, p = dbtp->data; len--; ++p)
1656 + if (isprint(*p)) {
1658 + (void)printf("\\");
1659 + (void)printf("%c", *p);
1661 + (void)printf("\\%c%c",
1662 + hex[(*p & 0xf0) >> 4], hex[*p & 0x0f]);
1668 + * Display the usage message.
1673 + (void)fprintf(stderr, "usage: db_dump185 [-p] [-f file] db_file\n");
1676 --- db.1.85/include/mpool.h.jj Thu Jul 14 03:33:26 1994
1677 +++ db.1.85/include/mpool.h Wed Apr 19 17:56:12 2000
1679 * @(#)mpool.h 8.2 (Berkeley) 7/14/94
1685 #include <sys/queue.h>
1688 @@ -67,9 +70,9 @@ typedef struct MPOOL {
1689 u_long pagesize; /* file page size */
1690 int fd; /* file descriptor */
1691 /* page in conversion routine */
1692 - void (*pgin) __P((void *, pgno_t, void *));
1693 + void (*pgin) __PMT((void *, pgno_t, void *));
1694 /* page out conversion routine */
1695 - void (*pgout) __P((void *, pgno_t, void *));
1696 + void (*pgout) __PMT((void *, pgno_t, void *));
1697 void *pgcookie; /* cookie for page in/out routines */
1700 @@ -85,15 +88,25 @@ typedef struct MPOOL {
1704 +MPOOL *__mpool_open __P((void *, int, pgno_t, pgno_t));
1705 MPOOL *mpool_open __P((void *, int, pgno_t, pgno_t));
1706 +void __mpool_filter __P((MPOOL *, void (*)(void *, pgno_t, void *),
1707 + void (*)(void *, pgno_t, void *), void *));
1708 void mpool_filter __P((MPOOL *, void (*)(void *, pgno_t, void *),
1709 void (*)(void *, pgno_t, void *), void *));
1710 +void *__mpool_new __P((MPOOL *, pgno_t *));
1711 void *mpool_new __P((MPOOL *, pgno_t *));
1712 +void *__mpool_get __P((MPOOL *, pgno_t, u_int));
1713 void *mpool_get __P((MPOOL *, pgno_t, u_int));
1714 +int __mpool_put __P((MPOOL *, void *, u_int));
1715 int mpool_put __P((MPOOL *, void *, u_int));
1716 +int __mpool_sync __P((MPOOL *));
1717 int mpool_sync __P((MPOOL *));
1718 +int __mpool_close __P((MPOOL *));
1719 int mpool_close __P((MPOOL *));
1721 void mpool_stat __P((MPOOL *));
1725 +#endif /* mpool.h */
1726 --- db.1.85/include/db.h.jj Tue Jun 21 21:59:28 1994
1727 +++ db.1.85/include/db.h Wed Apr 19 17:56:12 2000
1729 * @(#)db.h 8.7 (Berkeley) 6/16/94
1737 #include <sys/types.h>
1738 #include <sys/cdefs.h>
1739 @@ -117,14 +117,14 @@ typedef enum { DB_BTREE, DB_HASH, DB_REC
1740 /* Access method description structure. */
1741 typedef struct __db {
1742 DBTYPE type; /* Underlying db type. */
1743 - int (*close) __P((struct __db *));
1744 - int (*del) __P((const struct __db *, const DBT *, u_int));
1745 - int (*get) __P((const struct __db *, const DBT *, DBT *, u_int));
1746 - int (*put) __P((const struct __db *, DBT *, const DBT *, u_int));
1747 - int (*seq) __P((const struct __db *, DBT *, DBT *, u_int));
1748 - int (*sync) __P((const struct __db *, u_int));
1749 + int (*close) __PMT((struct __db *));
1750 + int (*del) __PMT((const struct __db *, const DBT *, u_int));
1751 + int (*get) __PMT((const struct __db *, const DBT *, DBT *, u_int));
1752 + int (*put) __PMT((const struct __db *, DBT *, const DBT *, u_int));
1753 + int (*seq) __PMT((const struct __db *, DBT *, DBT *, u_int));
1754 + int (*sync) __PMT((const struct __db *, u_int));
1755 void *internal; /* Access method private. */
1756 - int (*fd) __P((const struct __db *));
1757 + int (*fd) __PMT((const struct __db *));
1760 #define BTREEMAGIC 0x053162
1761 @@ -139,9 +139,9 @@ typedef struct {
1762 int minkeypage; /* minimum keys per page */
1763 u_int psize; /* page size */
1764 int (*compare) /* comparison function */
1765 - __P((const DBT *, const DBT *));
1766 + __PMT((const DBT *, const DBT *));
1767 size_t (*prefix) /* prefix function */
1768 - __P((const DBT *, const DBT *));
1769 + __PMT((const DBT *, const DBT *));
1770 int lorder; /* byte order */
1773 @@ -155,7 +155,7 @@ typedef struct {
1774 u_int nelem; /* number of elements */
1775 u_int cachesize; /* bytes to cache */
1776 u_int32_t /* hash function */
1777 - (*hash) __P((const void *, size_t));
1778 + (*hash) __PMT((const void *, size_t));
1779 int lorder; /* byte order */
1782 @@ -224,6 +224,7 @@ typedef struct {
1786 +DB *__dbopen __P((const char *, int, int, DBTYPE, const void *));
1787 DB *dbopen __P((const char *, int, int, DBTYPE, const void *));
1789 #ifdef __DBINTERFACE_PRIVATE
1790 @@ -233,4 +234,5 @@ DB *__rec_open __P((const char *, int, i
1791 void __dbpanic __P((DB *dbp));
1794 -#endif /* !_DB_H_ */