summaryrefslogtreecommitdiffstats
path: root/lib/libc/db
Commit message (Collapse)AuthorAgeFilesLines
* MFC r306349:ngie2017-02-101-4/+9
| | | | | | | | | | | r306349 (by pfg): hash(3): protect in-memory page when using cross-endianness. When writing out pages in the "other endian" format, make a copy instead of trashing the in-memory one. Obtained from: NetBSD (CVS rev. 1.29)
* MFC r306332:pfg2016-10-191-1/+2
| | | | | | btree(3): don't shortcut closing if the metadata is dirty. Obtained from: NetBSD (from krb5 tree)
* Fix prototype of dbm_open().ed2016-05-312-2/+2
| | | | | | | | The last argument of dbm_open() should be a mode_t according to POSIX; not an int. Reviewed by: pfg, kib Differential Revision: https://reviews.freebsd.org/D6650
* Let dbm's datum::dptr use the right type.ed2016-05-301-2/+2
| | | | | | | | | According to POSIX, it should use void *, not char *. Unfortunately, the dsize field also has the wrong type. It should be size_t. I'm not going to change that, as that will break the ABI. Reviewed by: pfg Differential Revision: https://reviews.freebsd.org/D6647
* libc: make more use of the howmany() macro when available.pfg2016-04-262-3/+2
| | | | | We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read.
* libc: use our roundup2/rounddown2() macros when param.h is available.pfg2016-04-201-1/+1
| | | | | rounddown2 tends to produce longer lines than the original code but still it makes the code more readable.
* libc: do not include <sys/types.h> where <sys/param.h> was already includedavos2016-04-181-1/+0
| | | | | | According to style(9): > normally, include <sys/types.h> OR <sys/param.h>, but not both. (<sys/param.h> already includes <sys/types.h> when LOCORE is not defined).
* libc: replace 0 with NULL for pointers.pfg2016-04-102-3/+3
| | | | | | | | | While here also cleanup some surrounding code; particularly drop some malloc() casts. Found with devel/coccinelle. Reviewed by: bde (previous version - all new bugs are mine)
* Follow-up r295924: Only sync hash-based db files open for writing when closing.bdrewery2016-04-061-1/+2
| | | | | | | | | | | This fixes a major performance regression when reading db files such as the pw database during a 'pkg install'. MFC after: 1 week Tested by: bapt Reviewed by: bapt Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D5868
* libc: don't build compat functions if building WITHOUT_SYMVERemaste2016-03-151-1/+4
| | | | | | | WITHOUT_SYMVER necessarily implies building a system without symver backwards compatability. Sponsored by: The FreeBSD Foundation
* Allow O_CLOEXEC to be used in dbopen() flagslidl2016-03-061-1/+5
| | | | | | | | | There is also a small portability crutch, also present in NetBSD, to allow compiling on a system that doesn't define O_CLOEXEC. Approved by: rpaulo (mentor) Obtained from: NetBSD (r1.17, r1.18) Differential Revision: https://reviews.freebsd.org/D5549
* db(3): Fix aliasing warnings from modern GCC.pfg2016-02-241-3/+2
| | | | | | While here also drop a malloc cast. Obtained from: NetBSD (CVS Rev. 1.18 - 1.20)
* db(3): Fix aliasing warnings from modern GCC.pfg2016-02-241-6/+12
| | | | Obtained from: NetBSD (CVS Rev. 1.20)
* If we close or sync a hash-based db file, make sure to call fsync todwmalone2016-02-231-1/+5
| | | | | | | | | make sure the changes are on disk. The people at pfSense noticed that it didn't always make it to the disk soon enough with soft updates. Differential Revision: https://reviews.freebsd.org/D5186 Reviewed by: garga, vangyzen, bapt, se MFC after: 1 week
* Use intptr_t note ptrdiff_t when storing flags in the bottom bits ofbrooks2016-01-292-6/+6
| | | | | | | pointers. Obtained from: CheriBSD (e3a69027cc5a384431156d61c90d4304387a9b9d) Sponsored by: DARPA, AFRL
* Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.rodrigc2015-09-201-25/+10
|
* db/recno: Open with close-on-exec like btree and hash do.jilles2015-09-131-1/+1
|
* Switch libc from using _sig{procmask,action,suspend} symbols, whichkib2015-08-292-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | are aliases for the syscall stubs and are plt-interposed, to the libc-private aliases of internally interposed sigprocmask() etc. Since e.g. _sigaction is not interposed by libthr, calling signal() removes thr_sighandler() from the handler slot etc. The result was breaking signal semantic and rtld locking. The added __libc_sigprocmask and other symbols are hidden, they are not exported and cannot be called through PLT. The setjmp/longjmp functions for x86 were changed to use direct calls, and since PIC_PROLOGUE only needed for functional PLT indirection on i386, it is removed as well. The PowerPC bug of calling the syscall directly in the setjmp/longjmp implementation is kept as is. Reported by: Pete French <petefrench@ingresso.co.uk> Tested by: Michiel Boland <boland37@xs4all.nl> Reviewed by: jilles (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Drop some unnecessary casts.pfg2015-05-181-4/+3
| | | | | Reported by: Clang static analyzer Obtained from: NetBSD
* dbm_delete(3) correct man page to match current behaviour.pfg2015-02-201-4/+2
| | | | | | | | | | | | "The dbm_store() and dbm_delete() functions shall return 0 when they succeed and a negative value when they fail." Reference: http://pubs.opengroup.org/onlinepubs/9699919799/functions/dbm_clearerr.html PR: 42422 Suggested by: delphij MFC after: 3 days
* Let __bt_put() accept the R_SETCURSOR flag, as stated in the dbopen(3) manpage.jlh2014-03-061-1/+2
| | | | | | | While here, update the comment above with all the accepted flags. Reviewed by: silence on hackers@ MFC after: 2 weeks
* Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP}marcel2014-03-047-13/+13
| | | | | | | | | | | if not already defined. This allows building libc from outside of lib/libc using a reach-over makefile. A typical use-case is to build a standard ILP32 version and a COMPAT32 version in a single iteration by building the COMPAT32 version using a reach-over makefile. Obtained from: Juniper Networks, Inc.
* db: Use O_CLOEXEC instead of separate fcntl() call.jilles2013-08-132-8/+3
|
* db/hash: Use O_CLOEXEC instead of separate fcntl() call.jilles2013-08-111-2/+1
| | | | | | In particular, a hash db is used by getpwnam() and getpwuid(). MFC after: 1 week
* Globally replace u_int*_t from (non-contributed) man pages.ed2012-02-121-1/+1
| | | | | | | | | | | The reasoning behind this, is that if we are consistent in our documentation about the uint*_t stuff, people will be less tempted to write new code that uses the non-standard types. I am not going to bump the man page dates, as these changes can be considered style nits. The meaning of the man pages is unaffected. MFC after: 1 month
* Fix clang warnings.benl2011-06-181-3/+4
| | | | Approved by: philip (mentor)
* The flags argument of mpool_get() is meaningful, document it.delphij2011-06-181-2/+9
| | | | MFC after: 2 weeks
* Bump dates in dbopen(3) and cpuset_getaffinity(2) from r212441 andgjb2010-09-121-1/+1
| | | | | | | r212438, repectively. Approved by: keramida (mentor) MFC after: 1 week
* Note O_SYNC and O_NOFOLLOW flags in dbopen(3) since r190497.gjb2010-09-101-2/+2
| | | | | | | | PR: 150030 Submitted by: Janne Snabb snabb at epipe com Patch by: Janne Snabb Approved by: keramida (mentor) MFC after: 1 week
* libc/db/hash: cap auto-tuned block size with a value that actually worksavg2010-04-052-1/+3
| | | | | | | | | | | | | This fix mostly matters after r206129 that made it possible for st_blksize to be greater than 4K. For this reason, this change should be MFC-ed before r206129. Also, it seems that all FreeBSD uitlities that use db(3) hash databases and create new databases in files, specify their own block size value and thus do not depend on block size autotuning. PR: bin/144446 Submitted by: Peter Jeremy <peterjeremy@acm.org> MFC after: 5 days
* hash.3: fix a factual mistake in the man pageavg2010-04-051-1/+1
| | | | | | PR: bin/144446 Submitted by: Peter Jeremy <peterjeremy@acm.org> MFC after: 3 days
* Consider flag == 0 as the same of flag == R_NEXT. This change will restoredelphij2009-08-241-2/+2
| | | | | a historical behavior that has been changed by revision 190491, and has seen to break exim.
* Update SCCS IDs for Berkeley DB 1.86 merge.delphij2009-06-242-2/+2
|
* style: operators should appear at the line end if we have to wrap.delphij2009-06-241-2/+2
|
* Add some casts to silence compiler warning about signedness.delphij2009-03-282-3/+3
|
* Minor changes from Berkeley DB 1.86 and further improvements from OpenBSD.delphij2009-03-2810-115/+214
| | | | | | | | | | This does not include the new hash routines since they will cause problems when reading old hash files. Since mpool(3) has been changed, provide a compatibility shim for older binaries. Obtained from: OpenBSD
* Allow O_SYNC and O_NOFOLLOW flags in dbopen().delphij2009-03-281-2/+2
| | | | Obtained from: OpenBSD
* Plug memory leaks and a potential NULL dereference.delphij2009-03-281-4/+12
| | | | Obtained from: OpenBSD
* Simplify the logic when determining whether to zero out a db file to afterdelphij2009-03-281-15/+5
| | | | | | | | open(). The previous logic only initializes the database when O_CREAT is set, but as long as we can open and write the database, and the database is empty, we should initialize it anyway. Obtained from: OpenBSD
* - If (keysize+datasize)%(bsize=14)==0, insertion of a `big key' would causedelphij2009-03-281-6/+18
| | | | | | | | | | | | | | | an invariant (actually, an ugly hack) to fail, and all Hell would break loose. When deleting a big key, the offset of an empty page should be bsize, not bsize-1; otherwise an insertion into the empty page will cause the new key to be elongated by 1 byte. Make the packing more dense in a couple of cases. - fix NULL dereference exposed on big bsize values; Obtained from: NetBSD via OpenBSD
* Avoid NULL deference which causes DEBUG1 to crash, not to print usefuldelphij2009-03-281-1/+1
| | | | | | information. Obtained from: OpenBSD
* - Avoid overwriting the cursor page when the cursor page becomes thedelphij2009-03-281-1/+21
| | | | | | | LRU page. - Fix for sequential retrieval failure when using large key/data pairs. Obtained from: OpenBSD
* Fix a crash when iterating over a hash and removing its elements.delphij2009-03-282-11/+21
| | | | Obtained from: OpenBSD
* Only squeeze a short key/value pair onto a page with other complete key/valuedelphij2009-03-281-3/+9
| | | | | | pairs, not onto a page containing the end of a big pair. Obtained from: NetBSD via OpenBSD
* Diff reduce against OpenBSD, no functional change.delphij2009-03-282-12/+6
|
* Return meaningful errno in overflow case; print error message to stderrdelphij2009-03-281-1/+7
| | | | | | in one more case. Obtained from: NetBSD via OpenBSD
* Use pread(2) and pwrite(2) instead of lseek(2) + read(2) / write(2).delphij2009-03-282-6/+3
| | | | Obtained from: NetBSD via OpenBSD
* db/btree/bt_open.c: check return value of snprintf() and return valuedelphij2009-03-282-6/+21
| | | | | | | | | if the result is truncated. db/hash/hash_page.c: use the same way to create temporary file as bt_open.c; check snprintf() return value. Obtained from: OpenBSD
* Several signed/unsigned warning fixes.delphij2009-03-288-16/+18
|
* When allocating memory, zero out them if we don't intend to overwrite themdelphij2009-03-285-28/+11
| | | | | | | | | | | | all; before freeing memory, zero out them before we release it as free heap. This will eliminate some potential information leak issue. While there, remove the PURIFY option. There is a slight difference between the new behavior and the old -DPURIFY behavior, with the latter initializes memory with 0xff's. The difference between old and new approach does not generate observable difference. Obtained from: OpenBSD (partly).
OpenPOWER on IntegriCloud