aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/db
Commit message (Collapse)AuthorAgeFilesLines
* db/hash.c: Fix flag check in hash_seqBojan Novković7 days1-1/+1
| | | | Fixes: 3a686b851f8f
* dbm_nextkey: Always return an error if we've reached the end of the databaseBojan Novković8 days1-2/+4
| | | | | | | | | | | | | POSIX.1 states that `dbm_nextkey` must return an invalid key (i.e., `key.dptr == NULL`) after the end of the database was reached. The current implementation of `hash_seq` will incorrectly restart the key sequence after the end of the database is reached. Fix this by checking the "current bucket" index when R_NEXT is passed. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D51635 Reviewed by: markj
* db/hash.c: Allow O_WRONLY in dbm_openBojan Novković9 days3-14/+11
| | | | | | | | | | | | | | The dbm(3) manpage explicitly states that O_WRONLY is not allowed in dbm_open, but a more recent comment in ` __hash_open` suggests otherwise. Furthermore, POSIX.1 allows O_WRONLY in dbm_open and states that the underlying file must be opened for both reading and writing. Fix this by correcting the O_WRONLY check and moving it further into the function to make sure that the original flags are stored in hashp. Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51514
* db/hash.c: Do not return an error when opening a missing database with O_CREATBojan Novković14 days1-1/+2
| | | | | | | | | | | | | | | dbm_open currently returns an error when opening a missing database with O_CREAT but creates the request database file. This is caused by a buggy check in __hash_open which attempts to detect a new (or empty) database file, but fails to take the O_CREAT flag into account. Fix this by expanding the check to include O_CREAT. Fixes: edcdc752ecdd Sponsored by: Klara, Inc. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D51491
* Remove residual blank line at start of MakefileWarner Losh2024-07-157-7/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* libc: don't try to export mpool_statBrooks Davis2024-04-161-1/+0
| | | | | | | This requires that mpool.c be compiled with -DSTATISTICS and we provide no mechanism to do this. Differential Revision: https://reviews.freebsd.org/D44185
* libc(bt_utils.c): fix "contiguous" spellingrilysh2024-04-121-1/+1
| | | | | | | | From "contigous" to "contiguous". Signed-off-by: rilysh <nightquick@proton.me> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1119
* libc(bt_seq.c): fix "uninitialized" spellingrilysh2024-04-121-1/+1
| | | | | | | | From "unitialized" to "uninitialized". Signed-off-by: rilysh <nightquick@proton.me> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1119
* lib: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Remove copyright strings ifdef'd outWarner Losh2023-11-278-48/+0
| | | | | | | | | | | We've ifdef'd out the copyright strings for some time now. Go ahead and remove the ifdefs. Plus whatever other detritis was left over from other recent removals. These copyright strings are present in the comments and are largely from CSRG's attempt at adding their copyright to every binary file (which modern interpretations of the license doesn't require). Sponsored by: Netflix
* sccs: Manual changesWarner Losh2023-11-272-2/+0
| | | | | | | | | | | | | | | For the uncommon items: Go through the tree and remove sccs tags that didn't fit any nice pattern. If in the neighborhood, other SCM tags were removed when they were detritis of long-ago CVS somehow in the early mists of the project. Some adjacent copyrights stringswere removed (they duplicated the copyright notices in the file). This also removed non-standard formations of omission of SCCS tags (usually by adding an extra #if 0 somewhere. After this commit, a number of strings tagged with the 'what' @(#) prefix remain, but they are primarily copyright notices. Sponsored by: Netflix
* lib: Remove ancient SCCS tags.Warner Losh2023-11-2766-163/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* libc: Remove empty comments in Symbol.mapBrooks Davis2023-11-151-3/+0
| | | | | | | These were left over from $FreeBSD$ removal. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D42612
* libc: Purge unneeded cdefs.hWarner Losh2023-11-0139-39/+0
| | | | | | | | | These sys/cdefs.h are not needed. Purge them. They are mostly left-over from the $FreeBSD$ removal. A few in libc are still required for macros that cdefs.h defines. Keep those. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D42385
* libc: Fix missing or misspelled MLINKS.Dag-Erling Smørgrav2023-10-181-1/+1
| | | | Differential Revision: https://reviews.freebsd.org/D42192
* Remove $FreeBSD$: one-line ps tagWarner Losh2023-08-162-2/+0
| | | | Remove /^%\s*RCSID:\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line nroff patternWarner Losh2023-08-165-5/+0
| | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: two-line nroff patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-1610-10/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-1640-80/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* Remove $FreeBSD$: one-line .h patternWarner Losh2023-08-168-8/+0
| | | | Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
* mpool: Remove $FreeBSD$ commentWarner Losh2023-08-161-1/+0
| | | | | | Remove non-standard $FreeBSD$ comment. It's not useful Sponsored by: Netflix
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* libc: Use secure_getenv(3) where appropriateMark Johnston2023-03-272-6/+4
| | | | | | | No functional change intended. Reviewed by: mjg, imp, kib Differential Revision: https://reviews.freebsd.org/D39278
* libc: Add HISTORY sections to the manual pagesGordon Bergling2022-05-051-1/+12
| | | | | | | | | | There are some sections which could be improved and work to do so is on going. The work will be covered via 'X-MFC-WITH' commits. Obtained from: OpenBSD MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D34759
* tools/build: Don't redefine open() for the linux bootstrapAlex Richardson2021-08-021-0/+6
| | | | | | | | | | | This is needed to bootstrap llvm-tblgen on Linux since LLVM calls `::open(...)` which does not work if open is a statement macro. Also stop defining O_SHLOCK/O_EXLOCK and update the only bootstrap tools user of those flags to deal with missing definitions. Reviewed By: jrtc27 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31226
* Remove the SYMVER build option.John Baldwin2020-04-301-4/+2
| | | | | | | | | | | | | | This option was added as a transition aide when symbol versioning was first added. It was enabled by default in 2007 and is supported even by the old GPLv2 binutils. Trying to disable it currently fails to build in libc and at this point it isn't worth fixing the build. Reported by: Michael Dexter Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D24637 Notes: svn path=/head/; revision=360511
* Remove "All rights reserved" from my files.Xin LI2018-05-101-1/+0
| | | | | | | | | See r333391 for the rationale. MFC after: 1 week Notes: svn path=/head/; revision=333449
* libc: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-251-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using mis-identified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326193
* General further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-2046-0/+92
| | | | | | | | | | | | | | | | | Mainly focus on files that use BSD 3-Clause license. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Special thanks to Wind River for providing access to "The Duke of Highlander" tool: an older (2014) run over FreeBSD tree was useful as a starting point. Notes: svn path=/head/; revision=326025
* Renumber copyright clause 4Warner Losh2017-02-2851-51/+51
| | | | | | | | | | | | Renumber cluase 4 to 3, per what everybody else did when BSD granted them permission to remove clause 3. My insistance on keeping the same numbering for legal reasons is too pedantic, so give up on that point. Submitted by: Jan Schaumann <jschauma@stevens.edu> Pull Request: https://github.com/freebsd/freebsd/pull/96 Notes: svn path=/head/; revision=314436
* hash(3): protect in-memory page when using cross-endianness.Pedro F. Giffuni2016-09-261-4/+9
| | | | | | | | | | 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) Notes: svn path=/head/; revision=306349
* btree(3): don't shortcut closing if the metadata is dirty.Pedro F. Giffuni2016-09-261-1/+2
| | | | | | | | | Obtained from: NetBSD (from krb5 tree) MFC after: 3 weeks Notes: svn path=/head/; revision=306332
* Fix prototype of dbm_open().Ed Schouten2016-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 Notes: svn path=/head/; revision=301066
* Let dbm's datum::dptr use the right type.Ed Schouten2016-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 Notes: svn path=/head/; revision=300999
* libc: make more use of the howmany() macro when available.Pedro F. Giffuni2016-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. Notes: svn path=/head/; revision=298600
* libc: use our roundup2/rounddown2() macros when param.h is available.Pedro F. Giffuni2016-04-201-1/+1
| | | | | | | | rounddown2 tends to produce longer lines than the original code but still it makes the code more readable. Notes: svn path=/head/; revision=298323
* libc: do not include <sys/types.h> where <sys/param.h> was already includedAndriy Voskoboinyk2016-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). Notes: svn path=/head/; revision=298226
* libc: replace 0 with NULL for pointers.Pedro F. Giffuni2016-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) Notes: svn path=/head/; revision=297790
* Follow-up r295924: Only sync hash-based db files open for writing when closing.Bryan Drewery2016-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 Notes: svn path=/head/; revision=297626
* libc: don't build compat functions if building WITHOUT_SYMVEREd Maste2016-03-151-1/+4
| | | | | | | | | | WITHOUT_SYMVER necessarily implies building a system without symver backwards compatability. Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=296915
* Allow O_CLOEXEC to be used in dbopen() flagsKurt Lidl2016-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 Notes: svn path=/head/; revision=296423
* db(3): Fix aliasing warnings from modern GCC.Pedro F. Giffuni2016-02-241-3/+2
| | | | | | | | | While here also drop a malloc cast. Obtained from: NetBSD (CVS Rev. 1.18 - 1.20) Notes: svn path=/head/; revision=295975
* db(3): Fix aliasing warnings from modern GCC.Pedro F. Giffuni2016-02-241-6/+12
| | | | | | | Obtained from: NetBSD (CVS Rev. 1.20) Notes: svn path=/head/; revision=295973
* 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
* db/recno: Open with close-on-exec like btree and hash do.Jilles Tjoelker2015-09-131-1/+1
| | | | Notes: svn path=/head/; revision=287761
* Switch libc from using _sig{procmask,action,suspend} symbols, whichKonstantin Belousov2015-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 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