History log of /src/lib/libc/db/hash/hash.c (Results 1 – 25 of 174)
Revision Date Author Comments
# aa05d1b2 01-Aug-2025 Bojan Novković <bnovkov@FreeBSD.org>

db/hash.c: Fix flag check in hash_seq

Fixes: 3a686b851f8f


# 3a686b85 30-Jul-2025 Bojan Novković <bnovkov@FreeBSD.org>

dbm_nextkey: Always return an error if we've reached the end of the database

POSIX.1 states that `dbm_nextkey` must return an invalid key
(i.e., `key.dptr == NULL`) after the end of the database was

dbm_nextkey: Always return an error if we've reached the end of the database

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

show more ...


# 14598537 25-Jul-2025 Bojan Novković <bnovkov@FreeBSD.org>

db/hash.c: Allow O_WRONLY in dbm_open

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, POSI

db/hash.c: Allow O_WRONLY in dbm_open

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

show more ...


# 108e2d11 24-Jul-2025 Bojan Novković <bnovkov@FreeBSD.org>

db/hash.c: Do not return an error when opening a missing database with O_CREAT

dbm_open currently returns an error when opening a missing database
with O_CREAT but creates the request database file.

db/hash.c: Do not return an error when opening a missing database with O_CREAT

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

show more ...


# dc36d6f9 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

lib: Remove ancient SCCS tags.

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 s

lib: Remove ancient SCCS tags.

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

show more ...


# 559a218c 01-Nov-2023 Warner Losh <imp@FreeBSD.org>

libc: Purge unneeded cdefs.h

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. Kee

libc: Purge unneeded cdefs.h

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

show more ...


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# aa05d1b2 01-Aug-2025 Bojan Novković <bnovkov@FreeBSD.org>

db/hash.c: Fix flag check in hash_seq

Fixes: 3a686b851f8f


# 3a686b85 30-Jul-2025 Bojan Novković <bnovkov@FreeBSD.org>

dbm_nextkey: Always return an error if we've reached the end of the database

POSIX.1 states that `dbm_nextkey` must return an invalid key
(i.e., `key.dptr == NULL`) after the end of the database was

dbm_nextkey: Always return an error if we've reached the end of the database

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

show more ...


# 14598537 25-Jul-2025 Bojan Novković <bnovkov@FreeBSD.org>

db/hash.c: Allow O_WRONLY in dbm_open

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, POSI

db/hash.c: Allow O_WRONLY in dbm_open

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

show more ...


# 108e2d11 24-Jul-2025 Bojan Novković <bnovkov@FreeBSD.org>

db/hash.c: Do not return an error when opening a missing database with O_CREAT

dbm_open currently returns an error when opening a missing database
with O_CREAT but creates the request database file.

db/hash.c: Do not return an error when opening a missing database with O_CREAT

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

show more ...


# dc36d6f9 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

lib: Remove ancient SCCS tags.

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 s

lib: Remove ancient SCCS tags.

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

show more ...


# 559a218c 01-Nov-2023 Warner Losh <imp@FreeBSD.org>

libc: Purge unneeded cdefs.h

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. Kee

libc: Purge unneeded cdefs.h

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

show more ...


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 82725ba9 23-Nov-2017 Hans Petter Selasky <hselasky@FreeBSD.org>

Merge ^/head r325999 through r326131.


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier f

General further adoption of SPDX licensing ID tags.

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.

show more ...


# 348238db 01-Mar-2017 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r314420 through r314481.


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

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

Renumber copyright clause 4

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

show more ...


# 968c0b40 26-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

libc: make more use of the howmany() macro when available.

We have a howmany() macro in the <sys/param.h> header that is
convenient to re-use as it makes things easier to read.


# 876d357f 11-Apr-2016 Glen Barber <gjb@FreeBSD.org>

MFH

Sponsored by: The FreeBSD Foundation


# 513004a2 10-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

libc: replace 0 with NULL for pointers.

While here also cleanup some surrounding code; particularly
drop some malloc() casts.

Found with devel/coccinelle.

Reviewed by: bde (previous version - all

libc: replace 0 with NULL for pointers.

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)

show more ...


# 15719ec4 06-Apr-2016 Bryan Drewery <bdrewery@FreeBSD.org>

Follow-up r295924: Only sync hash-based db files open for writing when closing.

This fixes a major performance regression when reading db files such as
the pw database during a 'pkg install'.

MFC a

Follow-up r295924: Only sync hash-based db files open for writing when closing.

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

show more ...


# 14e9c916 24-Feb-2016 Dimitry Andric <dim@FreeBSD.org>

Merge ^/head r295902 through r296006.


# 86b234d2 23-Feb-2016 Glen Barber <gjb@FreeBSD.org>

MFH

Sponsored by: The FreeBSD Foundation


# efb7dae2 23-Feb-2016 David Malone <dwmalone@FreeBSD.org>

If we close or sync a hash-based db file, make sure to call fsync to
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 u

If we close or sync a hash-based db file, make sure to call fsync to
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

show more ...


1234567