Commit graph

172 commits

Author SHA1 Message Date
Brooks Davis 1b10a30539 libc: don't try to export mpool_stat
This requires that mpool.c be compiled with -DSTATISTICS and we provide
no mechanism to do this.

Differential Revision:	https://reviews.freebsd.org/D44185
2024-04-16 22:14:20 +01:00
rilysh f362c952a5 libc(bt_utils.c): fix "contiguous" spelling
From "contigous" to "contiguous".

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1119
2024-04-12 16:34:55 -06:00
rilysh 0fc1fb1491 libc(bt_seq.c): fix "uninitialized" spelling
From "unitialized" to "uninitialized".

Signed-off-by: rilysh <nightquick@proton.me>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1119
2024-04-12 16:34:54 -06:00
Warner Losh a2f733abcf lib: Automated cleanup of cdefs and other formatting
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
2023-11-26 22:23:59 -07:00
Warner Losh 0b8224d1cc Remove copyright strings ifdef'd out
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
2023-11-26 22:23:58 -07:00
Warner Losh 5b31cc94b1 sccs: Manual changes
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
2023-11-26 22:23:58 -07:00
Warner Losh dc36d6f9bb 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
2023-11-26 22:23:28 -07:00
Brooks Davis 1ca63a8219 libc: Remove empty comments in Symbol.map
These were left over from $FreeBSD$ removal.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D42612
2023-11-15 17:51:03 +00:00
Warner Losh 559a218c9b 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
2023-11-01 16:44:30 -06:00
Dag-Erling Smørgrav dc41de36ab libc: Fix missing or misspelled MLINKS.
Differential Revision:	https://reviews.freebsd.org/D42192
2023-10-18 16:07:46 +02:00
Warner Losh 401ab69cff Remove $FreeBSD$: one-line ps tag
Remove /^%\s*RCSID:\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:39 -06:00
Warner Losh b2c76c41be Remove $FreeBSD$: one-line nroff pattern
Remove /^\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:15 -06:00
Warner Losh fa9896e082 Remove $FreeBSD$: two-line nroff pattern
Remove /^\.\\"\n\.\\"\s*\$FreeBSD\$$\n/
2023-08-16 11:55:10 -06:00
Warner Losh d0b2dbfa0e Remove $FreeBSD$: one-line sh pattern
Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
2023-08-16 11:55:03 -06:00
Warner Losh 1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Warner Losh 42b388439b Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:23 -06:00
Warner Losh be6151e43c mpool: Remove $FreeBSD$ comment
Remove non-standard $FreeBSD$ comment. It's not useful

Sponsored by:		Netflix
2023-08-16 01:37:16 -06:00
Warner Losh 4d846d260e spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
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
2023-05-12 10:44:03 -06:00
Mark Johnston 68ca8363c7 libc: Use secure_getenv(3) where appropriate
No functional change intended.

Reviewed by:	mjg, imp, kib
Differential Revision:	https://reviews.freebsd.org/D39278
2023-03-27 08:56:22 -04:00
Gordon Bergling 4b7f35db44 libc: Add HISTORY sections to the manual pages
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
2022-05-05 18:46:32 +02:00
Alex Richardson 5f6c8ce245 tools/build: Don't redefine open() for the linux bootstrap
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
2021-08-02 14:33:23 +01:00
John Baldwin 371f3da616 Remove the SYMVER build option.
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
2020-04-30 22:08:40 +00:00
Xin LI b6f7731dba Remove "All rights reserved" from my files.
See r333391 for the rationale.

MFC after:	1 week
2018-05-10 06:41:08 +00:00
Pedro F. Giffuni d915a14ef0 libc: further adoption of SPDX licensing ID tags.
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.
2017-11-25 17:12:48 +00:00
Pedro F. Giffuni 8a16b7a18f 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.
2017-11-20 19:49:47 +00:00
Warner Losh fbbd9655e5 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
2017-02-28 23:42:47 +00:00
Pedro F. Giffuni 70e7268bd5 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)
2016-09-26 16:06:50 +00:00
Pedro F. Giffuni d191be26c0 btree(3): don't shortcut closing if the metadata is dirty.
Obtained from:	NetBSD (from krb5 tree)

MFC after:	3 weeks
2016-09-26 02:29:28 +00:00
Ed Schouten de1d269583 Fix prototype of dbm_open().
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
2016-05-31 18:32:57 +00:00
Ed Schouten 2fed5061db Let dbm's datum::dptr use the right type.
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
2016-05-30 16:52:23 +00:00
Pedro F. Giffuni 968c0b406d 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.
2016-04-26 01:17:05 +00:00
Pedro F. Giffuni 75a5de5a40 libc: use our roundup2/rounddown2() macros when param.h is available.
rounddown2 tends to produce longer lines than the original code but
still it makes the code more readable.
2016-04-20 01:21:39 +00:00
Andriy Voskoboinyk 2cf5e9365d libc: do not include <sys/types.h> where <sys/param.h> was already included
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).
2016-04-18 21:05:15 +00:00
Pedro F. Giffuni 513004a23d 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)
2016-04-10 19:33:58 +00:00
Bryan Drewery 15719ec499 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
2016-04-06 22:38:50 +00:00
Ed Maste c38dac681d libc: don't build compat functions if building WITHOUT_SYMVER
WITHOUT_SYMVER necessarily implies building a system without symver
backwards compatability.

Sponsored by:	The FreeBSD Foundation
2016-03-15 19:26:32 +00:00
Kurt Lidl 06feb971e7 Allow O_CLOEXEC to be used in dbopen() flags
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
2016-03-06 04:38:08 +00:00
Pedro F. Giffuni e1ea782729 db(3): Fix aliasing warnings from modern GCC.
While here also drop a malloc cast.

Obtained from:	NetBSD (CVS Rev. 1.18 - 1.20)
2016-02-24 17:14:11 +00:00
Pedro F. Giffuni 3579f3d9ea db(3): Fix aliasing warnings from modern GCC.
Obtained from:	NetBSD (CVS Rev. 1.20)
2016-02-24 16:52:03 +00:00
David Malone efb7dae251 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
2016-02-23 15:21:13 +00:00
Brooks Davis 45308eec4a Use intptr_t note ptrdiff_t when storing flags in the bottom bits of
pointers.

Obtained from:	CheriBSD (e3a69027cc)
Sponsored by:	DARPA, AFRL
2016-01-29 01:22:12 +00:00
Craig Rodrigues d9556fb15d Use ANSI C prototypes. Eliminates -Wold-style-definition warnings. 2015-09-20 20:55:00 +00:00
Jilles Tjoelker 636b8d937e db/recno: Open with close-on-exec like btree and hash do. 2015-09-13 17:17:52 +00:00
Konstantin Belousov bd6060a1c6 Switch libc from using _sig{procmask,action,suspend} symbols, which
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
2015-08-29 14:25:01 +00:00
Pedro F. Giffuni 1b81d86525 Drop some unnecessary casts.
Reported by:	Clang static analyzer
Obtained from:	NetBSD
2015-05-18 16:28:13 +00:00
Pedro F. Giffuni a9a4a706eb dbm_delete(3) correct man page to match current behaviour.
"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
2015-02-20 01:31:10 +00:00
Jeremie Le Hen dd3d4ecb61 Let __bt_put() accept the R_SETCURSOR flag, as stated in the dbopen(3) manpage.
While here, update the comment above with all the accepted flags.

Reviewed by:	silence on hackers@
MFC after:	2 weeks
2014-03-06 07:44:45 +00:00
Marcel Moolenaar 8876613dc5 Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP}
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.
2014-03-04 02:19:39 +00:00
Jilles Tjoelker 89521d4108 db: Use O_CLOEXEC instead of separate fcntl() call. 2013-08-13 19:20:50 +00:00
Jilles Tjoelker 46d71747f6 db/hash: Use O_CLOEXEC instead of separate fcntl() call.
In particular, a hash db is used by getpwnam() and getpwuid().

MFC after:	1 week
2013-08-11 15:38:48 +00:00