If we've gotten by this long without mmap, I think we can keep going a little longer. Enabling this code would requre more testing than it's worth.
Index: btree/btree.h =================================================================== RCS file: /cvs/src/lib/libc/db/btree/btree.h,v retrieving revision 1.6 diff -u -p -r1.6 btree.h --- btree/btree.h 2 Jun 2003 20:18:33 -0000 1.6 +++ btree/btree.h 5 Apr 2015 14:40:39 -0000 @@ -367,7 +367,6 @@ typedef struct _btree { #define R_CLOSEFP 0x00040 /* opened a file pointer */ #define R_EOF 0x00100 /* end of input file reached. */ #define R_FIXLEN 0x00200 /* fixed length records */ -#define R_MEMMAPPED 0x00400 /* memory mapped file. */ #define R_INMEM 0x00800 /* in-memory file */ #define R_MODIFIED 0x01000 /* modified file */ #define R_RDONLY 0x02000 /* read-only file */ Index: recno/rec_close.c =================================================================== RCS file: /cvs/src/lib/libc/db/recno/rec_close.c,v retrieving revision 1.11 diff -u -p -r1.11 rec_close.c --- recno/rec_close.c 5 Aug 2005 13:03:00 -0000 1.11 +++ recno/rec_close.c 5 Apr 2015 14:40:25 -0000 @@ -69,8 +69,6 @@ __rec_close(DB *dbp) /* Committed to closing. */ status = RET_SUCCESS; - if (F_ISSET(t, R_MEMMAPPED) && munmap(t->bt_smap, t->bt_msize)) - status = RET_ERROR; if (!F_ISSET(t, R_INMEM)) { if (F_ISSET(t, R_CLOSEFP)) { Index: recno/rec_open.c =================================================================== RCS file: /cvs/src/lib/libc/db/recno/rec_open.c,v retrieving revision 1.11 diff -u -p -r1.11 rec_open.c --- recno/rec_open.c 5 Aug 2005 13:03:00 -0000 1.11 +++ recno/rec_open.c 5 Apr 2015 14:40:04 -0000 @@ -138,39 +138,10 @@ slow: if ((t->bt_rfp = fdopen(rfd, "r" if (fstat(rfd, &sb)) goto err; - /* - * Kluge -- we'd like to test to see if the file is too - * big to mmap. Since, we don't know what size or type - * off_t's or size_t's are, what the largest unsigned - * integral type is, or what random insanity the local - * C compiler will perpetrate, doing the comparison in - * a portable way is flatly impossible. Hope that mmap - * fails if the file is too large. - */ if (sb.st_size == 0) F_SET(t, R_EOF); else { -#ifdef MMAP_NOT_AVAILABLE - /* - * XXX - * Mmap doesn't work correctly on many current - * systems. In particular, it can fail subtly, - * with cache coherency problems. Don't use it - * for now. - */ - t->bt_msize = sb.st_size; - if ((t->bt_smap = mmap(NULL, t->bt_msize, - PROT_READ, MAP_FILE | MAP_PRIVATE, rfd, - (off_t)0)) == MAP_FAILED) - goto slow; - t->bt_cmap = t->bt_smap; - t->bt_emap = t->bt_smap + sb.st_size; - t->bt_irec = F_ISSET(t, R_FIXLEN) ? - __rec_fmap : __rec_vmap; - F_SET(t, R_MEMMAPPED); -#else goto slow; -#endif } } }