aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/db/hash
Commit message (Collapse)AuthorAgeFilesLines
* If we close or sync a hash-based db file, make sure to call fsync toDavid Malone2016-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 Notes: svn path=/head/; revision=295924
* Use intptr_t note ptrdiff_t when storing flags in the bottom bits ofBrooks Davis2016-01-292-6/+6
| | | | | | | | | | pointers. Obtained from: CheriBSD (e3a69027cc5a384431156d61c90d4304387a9b9d) Sponsored by: DARPA, AFRL Notes: svn path=/head/; revision=295031
* Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.Craig Rodrigues2015-09-201-25/+10
| | | | Notes: svn path=/head/; revision=288042
* Switch libc from using _sig{procmask,action,suspend} symbols, whichKonstantin Belousov2015-08-291-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=287292
* Drop some unnecessary casts.Pedro F. Giffuni2015-05-181-4/+3
| | | | | | | | Reported by: Clang static analyzer Obtained from: NetBSD Notes: svn path=/head/; revision=283068
* Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP}Marcel Moolenaar2014-03-041-1/+1
| | | | | | | | | | | | | | 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. Notes: svn path=/head/; revision=262722
* db: Use O_CLOEXEC instead of separate fcntl() call.Jilles Tjoelker2013-08-131-3/+1
| | | | Notes: svn path=/head/; revision=254289
* db/hash: Use O_CLOEXEC instead of separate fcntl() call.Jilles Tjoelker2013-08-111-2/+1
| | | | | | | | | In particular, a hash db is used by getpwnam() and getpwuid(). MFC after: 1 week Notes: svn path=/head/; revision=254222
* libc/db/hash: cap auto-tuned block size with a value that actually worksAndriy Gapon2010-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 Notes: svn path=/head/; revision=206178
* Consider flag == 0 as the same of flag == R_NEXT. This change will restoreXin LI2009-08-241-2/+2
| | | | | | | | a historical behavior that has been changed by revision 190491, and has seen to break exim. Notes: svn path=/head/; revision=196525
* Add some casts to silence compiler warning about signedness.Xin LI2009-03-281-1/+1
| | | | Notes: svn path=/head/; revision=190500
* Minor changes from Berkeley DB 1.86 and further improvements from OpenBSD.Xin LI2009-03-282-67/+44
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=190498
* Plug memory leaks and a potential NULL dereference.Xin LI2009-03-281-4/+12
| | | | | | | Obtained from: OpenBSD Notes: svn path=/head/; revision=190496
* Simplify the logic when determining whether to zero out a db file to afterXin LI2009-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 Notes: svn path=/head/; revision=190495
* - If (keysize+datasize)%(bsize=14)==0, insertion of a `big key' would causeXin LI2009-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 Notes: svn path=/head/; revision=190494
* Avoid NULL deference which causes DEBUG1 to crash, not to print usefulXin LI2009-03-281-1/+1
| | | | | | | | | information. Obtained from: OpenBSD Notes: svn path=/head/; revision=190493
* - Avoid overwriting the cursor page when the cursor page becomes theXin LI2009-03-281-1/+21
| | | | | | | | | | LRU page. - Fix for sequential retrieval failure when using large key/data pairs. Obtained from: OpenBSD Notes: svn path=/head/; revision=190492
* Fix a crash when iterating over a hash and removing its elements.Xin LI2009-03-282-11/+21
| | | | | | | Obtained from: OpenBSD Notes: svn path=/head/; revision=190491
* Only squeeze a short key/value pair onto a page with other complete key/valueXin LI2009-03-281-3/+9
| | | | | | | | | pairs, not onto a page containing the end of a big pair. Obtained from: NetBSD via OpenBSD Notes: svn path=/head/; revision=190490
* Diff reduce against OpenBSD, no functional change.Xin LI2009-03-282-12/+6
| | | | Notes: svn path=/head/; revision=190489
* Return meaningful errno in overflow case; print error message to stderrXin LI2009-03-281-1/+7
| | | | | | | | | in one more case. Obtained from: NetBSD via OpenBSD Notes: svn path=/head/; revision=190487
* Use pread(2) and pwrite(2) instead of lseek(2) + read(2) / write(2).Xin LI2009-03-282-6/+3
| | | | | | | Obtained from: NetBSD via OpenBSD Notes: svn path=/head/; revision=190486
* db/btree/bt_open.c: check return value of snprintf() and return valueXin LI2009-03-281-4/+15
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=190485
* Several signed/unsigned warning fixes.Xin LI2009-03-284-10/+12
| | | | Notes: svn path=/head/; revision=190484
* When allocating memory, zero out them if we don't intend to overwrite themXin LI2009-03-281-9/+6
| | | | | | | | | | | | | | | 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). Notes: svn path=/head/; revision=190482
* Explicitly specify bit width for on-disk data structure.Xin LI2009-03-041-17/+17
| | | | | | | Obtained from: OpenBSD Notes: svn path=/head/; revision=189330
* Style changes (including additional casts to shut up warnings). ThisXin LI2009-03-042-10/+8
| | | | | | | commit does not affect MD5 of object file. Notes: svn path=/head/; revision=189327
* Diff reduction against OpenBSD: ANSI'fy prototypes.Xin LI2009-03-025-213/+101
| | | | | | | | | | | (This is part of a larger changeset which is intended to reduce diff only, thus some prototypes were left intact since they will be changed in the future). Verified with: md5(1) Notes: svn path=/head/; revision=189291
* The usage of "info" in init_hash() is read-only, so constifyXin LI2007-05-251-3/+3
| | | | | | | | the internal interface instead of casting away the constant constraint upon calling. Notes: svn path=/head/; revision=169979
* Per Regents of the University of Calfornia letter, remove advertisingWarner Losh2007-01-0910-40/+0
| | | | | | | | | clause. # If I've done so improperly on a file, please let me know. Notes: svn path=/head/; revision=165903
* Fix format strings to unbreak with -DDEBUG option.Jun Kuriyama2004-09-101-1/+1
| | | | Notes: svn path=/head/; revision=135024
* Eliminate 61 warnings emitted at WARNS=2 (leaving 53 to go).Jacques Vidrine2003-02-162-4/+5
| | | | | | | | | | Only warnings that could be fixed without changing the generated object code and without restructuring the source code have been handled. Reviewed by: /sbin/md5 Notes: svn path=/head/; revision=111010
* libc_r wasn't so tied to libc for 22 months.Ruslan Ermilov2002-11-181-1/+1
| | | | Notes: svn path=/head/; revision=107052
* Fix the style of the SCM ID's.David E. O'Brien2002-03-221-0/+1
| | | | | | | I believe have made all of libc .h's as consistent as possible. Notes: svn path=/head/; revision=92991
* Fix the style of the SCM ID's.David E. O'Brien2002-03-221-0/+2
| | | | | | | I believe have made all of libc .c's as consistent as possible. Notes: svn path=/head/; revision=92986
* Remove multi-line __P() usage.David E. O'Brien2002-03-222-3/+3
| | | | Notes: svn path=/head/; revision=92941
* Remove __P() usage.David E. O'Brien2002-03-217-53/+54
| | | | Notes: svn path=/head/; revision=92905
* Remove 'register' keyword.David E. O'Brien2002-03-216-72/+78
| | | | Notes: svn path=/head/; revision=92889
* Add new, from scratch implementation of hsearch() et al that actually works.Ruslan Ermilov2001-05-152-110/+1
| | | | | | | | Obtained from: NetBSD MFC after: 1 month Notes: svn path=/head/; revision=76613
* Fix typo: compatability -> compatibility.Jeroen Ruigrok van der Werven2001-02-061-1/+2
| | | | | | | | | Compatability is not an existing english word. Add $FreeBSD$. Notes: svn path=/head/; revision=72092
* Remove _THREAD_SAFE and make libc thread-safe by default byDaniel Eischen2001-01-243-5/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | adding (weak definitions to) stubs for some of the pthread functions. If the threads library is linked in, the real pthread functions will pulled in. Use the following convention for system calls wrapped by the threads library: __sys_foo - actual system call _foo - weak definition to __sys_foo foo - weak definition to __sys_foo Change all libc uses of system calls wrapped by the threads library from foo to _foo. In order to define the prototypes for _foo(), we introduce namespace.h and un-namespace.h (suggested by bde). All files that need to reference these system calls, should include namespace.h before any standard includes, then include un-namespace.h after the standard includes and before any local includes. <db.h> is an exception and shouldn't be included in between namespace.h and un-namespace.h namespace.h will define foo to _foo, and un-namespace.h will undefine foo. Try to eliminate some of the recursive calls to MT-safe functions in libc/stdio in preparation for adding a mutex to FILE. We have recursive mutexes, but would like to avoid using them if possible. Remove uneeded includes of <errno.h> from a few files. Add $FreeBSD$ to a few files in order to pass commitprep. Approved by: -arch Notes: svn path=/head/; revision=71579
* cleanup the tsearch import.Alfred Perlstein2000-07-062-53/+4
| | | | | | | | | | | | | | | remove (comment out) functions defined or depricated elsewhere: bsearch, lfind, lsearch, insque, remque change hcreate to take a size_t rather than uint (essentially the same) since hcreate/hdestroy are now in <search.h>, remove private search.h in lib/libc/db/hash/ add $FreeBSD tags to hsearch.c Notes: svn path=/head/; revision=62684
* Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),Jason Evans2000-01-272-14/+12
| | | | | | | | | | | | | | | | | | | | just use _foo() <-- foo(). In the case of a libpthread that doesn't do call conversion (such as linuxthreads and our upcoming libpthread), this is adequate. In the case of libc_r, we still need three names, which are now _thread_sys_foo() <-- _foo() <-- foo(). Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(), nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo(). Remove all internal libc usage of: creat(), pause(), sleep(), system(), tcdrain(), wait(), and waitpid(). Make thread cancellation fully POSIX-compliant. Suggested by: deischen Notes: svn path=/head/; revision=56698
* Add three-tier symbol naming in support of POSIX thread cancellationJason Evans2000-01-122-12/+18
| | | | | | | | | points. For library functions, the pattern is __sleep() <-- _libc_sleep() <-- sleep(). The arrows represent weak aliases. For system calls, the pattern is _read() <-- _libc_read() <-- read(). Notes: svn path=/head/; revision=55837
* $Id$ -> $FreeBSD$Peter Wemm1999-08-281-1/+1
| | | | Notes: svn path=/head/; revision=50476
* Changed all paths to be relative to src/lib instead of src/lib/libcJohn Birrell1997-05-031-2/+3
| | | | | | | | | | | | | so that all these makefiles can be used to build libc_r too. Added .if ${LIB} == "c" tests to restrict man page builds to libc to avoid needlessly building them with libc_r too. Split libc Makefile into Makefile and Makefile.inc to allow the libc_r Makefile to include Makefile.inc too. Notes: svn path=/head/; revision=25401
* Reviewed by: Bruce Evans <bde@freebsd.org>Daniel O'Callaghan1997-02-151-0/+6
| | | | | | | | Guard against possible buffer overrun in filename passed. Another candidate for 2.2. Notes: svn path=/head/; revision=22736
* Back out most of the last backout. :-) Guido removed the 1.1.1.1->1.1.1.2Peter Wemm1996-10-191-10/+18
| | | | | | | | | changes from the vendor branch as well, backing the db-1.82 changes. This file should now be the same as it was in rev 1.1.1.2. Notes: svn path=/head/; revision=19029
* Backout bzero patch.Guido van Rooij1996-10-181-21/+11
| | | | | | | | | Somehow, I also managed to get quite some other changes in this file at the same time. All I did was checkout the file and made a single change. If someone has an explanation how these PURIFFY defines got in... Notes: svn path=/head/; revision=19024
* When freeing buffers in the db routines, also zeroize themGuido van Rooij1996-10-171-1/+3
| | | | | | | | | This should solve the bug where a coredumping ftpd reveals encrypted passwords. Obtained from: OpenBSD Notes: svn path=/head/; revision=18997