Commit graph

284956 commits

Author SHA1 Message Date
Mitchell Horne f7a2170606 pmc_events.h: update top-level comment
It points to non-existent documentation. The wiki page still contains a
useful overview, so keep this link.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2023-07-10 14:32:27 -03:00
Mitchell Horne a5b3e56330 pmcstat(8): Drop .Ud
This utility has existed for a long time and should not be advertised as
"currently under development".

While here, fix the one other warning from igor about using a newline
for a new sentence.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2023-07-10 14:30:03 -03:00
Mitchell Horne 398fb4a592 pmclog(3): Drop .Ud
This API is stable and should not be advertised as "currently under
development".

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2023-07-10 14:30:03 -03:00
Alex Bahm c210cac00f dhclient: fix time parsing for leases expiring after 2038
Convert lease parsing to timegm to calculate timestamp. For reference, when
writing the lease, we use gmtime to convert the timestamp to struct tm.

Reviewed By:	markj, vangyzen
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D40760
2023-07-10 11:00:34 -05:00
Alan Somers 6c049996ec During F_SETFL, don't change file flags on error
Previously, even if the FIONBIO or FIOASYNC ioctl failed, the file's
f_flags variable would still be changed.  Now, kern_fcntl will restore
the original flags if the ioctl fails.

PR:		265736
Reported by:	Yuval Pavel Zholkover <paulzhol@gmail.com>
MFC after:	2 weeks
Reviewed by:	kib
Differential Revision: https://reviews.freebsd.org/D40955
2023-07-10 08:13:58 -06:00
Mitchell Horne 8ab2da6828 Remove GCC 4.2 include dirs
These are present (and empty) on a system installed post-GCC removal.

Reviewed by:	imp
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D40878
2023-07-10 10:16:13 -03:00
Doug Moore 16e01c05c0 radix_trie: avoid code duplication in insert
Two cases in the insert routine are written differently, when
they're really doing the same thing. Writing that case only once
saves 208 bytes in the compiled vm_radix_insert code and reduces
instructions executed by about 2%.
Reviewed by:	alc
Tested by:	pho
Differential Revision:	https://reviews.freebsd.org/D40807
2023-07-09 15:06:02 -05:00
Mitchell Horne 89240e0ab6 hwpmc(4): update DEBUGGING section details
The examples I wrote previously do not work. We parse the flags using
explicit names, not the shortened flag suffix. Fix the list of major
flags, and add a compact list of minor flags. Fix the examples, and
tweak some wording for clarity.

Reviewed by:	jkoshy, emaste
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Fixes:		5fc97cc325 ("hwpmc(4): document debugging options")
Differential Revision:	https://reviews.freebsd.org/D40913
2023-07-09 16:03:54 -03:00
Jessica Clarke 076a4dc59b rtld-elf: Remove _PATH_ELF32_HINTS and _COMPAT32_PATH_RTLD
These are no longer referenced, with the one user of each now using the
double-underscore version with "32" as an argument instead.

Reviewed by:	kib, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40935
2023-07-09 18:50:30 +01:00
Jessica Clarke e17dd921a2 ldd: Use __PATH_RTLD("32") over _COMPAT32_PATH_RTLD
This will allow the latter to be removed, reducing the boilerplate
needed for a new libcompat.

Reviewed by:	kib, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40934
2023-07-09 18:50:24 +01:00
Jessica Clarke 1e635e87e3 ldconfig: Use __PATH_ELF_HINTS("32") over _PATH_ELF32_HINTS
This will allow the latter to be removed, reducing the boilerplate
needed for a new libcompat.

Reviewed by:	kib, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40933
2023-07-09 18:50:15 +01:00
Jessica Clarke 1840dc06e1 bsd.compat.mk: Remove obsolete COMPAT_32BIT now it's unused
See commit 8fad2cda93 ("bsd.compat.mk: Provide new CPP and sub-make
variables") for the context behind this change.

Reviewed by:	emaste, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40932
2023-07-09 18:50:03 +01:00
Jessica Clarke 3864bd4fd2 lib: Migrate from COMPAT_32BIT to generic COMPAT_LIBCOMPAT
In the process, delete a COMPAT_SOFTFP remnant that was missed in
previous sweeps.

See commit 8fad2cda93 ("bsd.compat.mk: Provide new CPP and sub-make
variables") for the context behind this change.

Reviewed by:	emaste, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40931
2023-07-09 18:49:53 +01:00
Jessica Clarke 45be5010ce libsysdecode: Migrate from COMPAT_32BIT to generic COMPAT_LIBCOMPAT
The use isn't any more generic, just the variable itself, which will
allow COMPAT_32BIT to be removed. The fact we even have to check
COMPAT_LIBCOMPAT here in order to pass the right flags to CPP points at
our libcompat infrastructure not suitably modifying the CPP variable
(which we barely use for world; this and bsd.symver.mk are the two
uses, and the latter could benefit from the right flags too), but this
change doesn't attempt to fix that.

See commit 8fad2cda93 ("bsd.compat.mk: Provide new CPP and sub-make
variables") for the context behind this change.

Reviewed by:	emaste, imp, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40930
2023-07-09 18:49:43 +01:00
Jessica Clarke d7be70f0ff libiconv_modules: Migrate from COMPAT_32BIT to generic COMPAT_libcompat
See commit 8fad2cda93 ("bsd.compat.mk: Provide new CPP and sub-make
variables") for the context behind this change.

Reviewed by:	brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40929
2023-07-09 18:49:35 +01:00
Jessica Clarke daf2519ea2 geom: Migrate from COMPAT_32BIT to generic COMPAT_libcompat
See commit 8fad2cda93 ("bsd.compat.mk: Provide new CPP and sub-make
variables") for the context behind this change.

Reviewed by:	imp, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40927
2023-07-09 18:49:28 +01:00
Jessica Clarke cb2f2faa6d kerberos5: Migrate from COMPAT_32BIT to generic COMPAT_LIBCOMPAT
See commit 8fad2cda93 ("bsd.compat.mk: Provide new CPP and sub-make
variables") for the context behind this change.

Reviewed by:	emaste, imp, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40926
2023-07-09 18:49:21 +01:00
Jessica Clarke f940929d41 rtld-elf: Migrate from COMPAT_32BIT to generic COMPAT_libcompat/LIBCOMPAT
We still have a tiny amount of libcompat-specific code in rtld_paths.h,
but it's been deduplicated as much as possible, and in future we may
wish to just push these variables down to the few consumers of them and
make them use the double-underscore variants with a libcompat argument
rather than give them names here.

See commit 8fad2cda93 ("bsd.compat.mk: Provide new CPP and sub-make
variables") for the context behind this change.

Reviewed by:	kib, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40925
2023-07-09 18:49:07 +01:00
Jessica Clarke d3748fc0c2 include: Migrate from COMPAT_32BIT to generic COMPAT_libcompat
See commit 8fad2cda93 ("bsd.compat.mk: Provide new CPP and sub-make
variables") for the context behind this change.

Reviewed by:	emaste, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40924
2023-07-09 18:48:54 +01:00
Jessica Clarke 0ade2f8cf7 openpam: Migrate from COMPAT_32BIT to generic COMPAT_libcompat
See commit 8fad2cda93 ("bsd.compat.mk: Provide new CPP and sub-make
variables") for the context behind this change.

Reviewed by:	brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40923
2023-07-09 18:48:17 +01:00
Jessica Clarke 8fad2cda93 bsd.compat.mk: Provide new CPP and sub-make variables
Currently the only way to detect for a libcompat build is to consult
whether COMPAT_32BIT is defined (or equivalent, for downstreams with
other libcompats or past releases with libsoft as COMPAT_SOFTFP). There
are two issues with this:

1. COMPAT_32BIT is a new naming scheme that doesn't match the libcompat
   name, which is unnecessary deviation.
2. When multiple libcompats exist, everywhere that needs to detect a
   libcompat must check each variable in turn, despite the fact that it
   normally just wants to know if this is a libcompat build and perhaps
   what ${LIBCOMPAT} and/or ${libcompat} are for it.

As a result, far too many places in the tree need to know about the set
of possible libcompats.

Instead, introduce two new CPP and sub-make variables, COMPAT_LIBCOMPAT
and COMPAT_libcompat, which give the values for ${LIBCOMPAT} and
${libcompat} respectively, so that uses can be made parameterised. For
when code really does need to know the specific libcompat, Makefiles can
perform a string comparison, but the C preprocessor cannot, so introduce
an additional CPP-only COMPAT_LIB${LIBCOMPAT} which is intended to
replace the inconsistently-named COMPAT_32BIT (which will be removed in
future). Uses of this new variable should still be kept to a minimum,
however, given the code duplication needed for new libcompats.

Reviewed by:	emaste, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40922
2023-07-09 18:47:42 +01:00
Jessica Clarke 537f945fc8 Makefile.libcompat: Quote CFLAGS and CXXFLAGS for sub-make
Currently none of the words in these require quoting, but a future
commit will add words that do, thus we should make sure to quote each
word so the shell doesn't mangle them before calling the sub-make.

(Note that :@var@expr@ is the bmake syntax for map, replacing each word
with expr's evaluation, with var containing the input word)

Reviewed by:	emaste, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40921
2023-07-09 18:46:12 +01:00
Jessica Clarke 0fbb77c3ef libc: Build all i386 sources for amd64 lib32
Having the symbols exported by libc differ between i386 and amd64 lib32
is questionable. Since these files build just fine today, stop guarding
them with !defined(COMPAT_32BIT). Whether or not they work at run time
is a different matter, but an i386 jail would be similarly affected if
not, so that's not a problem with lib32.

Reviewed by:	kib, jhb, imp
Differential Revision:	https://reviews.freebsd.org/D40937
2023-07-09 18:46:03 +01:00
Jessica Clarke 6adfb8155e lib: Enable libcbor and libfido2 for COMPAT_32BIT
We no longer have COMPAT_32BIT hacks for libusb, instead supporting the
normal 32-bit ioctls for freebsd32 processes, so we can enable these for
the lib32 build.

Reviewed by:	emaste, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40920
2023-07-09 18:45:56 +01:00
Jessica Clarke 5181fe24b2 rtld-elf: Reuse _BASENAME_RTLD for debug.h rather than duplicating logic
Reviewed by:	kib, brooks, jhb
Differential Revision:	https://reviews.freebsd.org/D40919
2023-07-09 18:45:49 +01:00
Jessica Clarke be01082b86 elf-hints.h: Allow rtld_paths.h to be included before it
Currently rtld_paths.h will #undef _PATH_ELF_HINTS in order to override
this to the right value if included afterwards, but the other way round
does not work as elf-hints.h tries to define an already-defined macro to
a potentially different value. Thus, guard the definition here so that
rtld_paths.h's definition continues to take precedence.

Note that, although all in-tree uses of _PATH_ELF_HINTS have included
rtld_paths.h already, pax-utils wants _PATH_ELF_HINTS from elf-hints.h
and so we cannot just drop the define. In-tree uses must just continue
to make sure that they include rtld_paths.h to get the right value for
libcompat builds as is already required.

Reviewed by:	kib, brooks, jhb, imp
Differential Revision:	https://reviews.freebsd.org/D40918
2023-07-09 18:45:42 +01:00
Jessica Clarke c63c4e694c Don't bother to check COMPAT_32BIT when __LP64__ is defined
Under COMPAT_32BIT we are compiling 32-bit code and so __LP64__ is not
defined, __ILP32__ is, and thus the check is completely redundant.

Reviewed by:	brooks, jhb, imp
Differential Revision:	https://reviews.freebsd.org/D40917
2023-07-09 18:45:32 +01:00
Jessica Clarke 3d96c005dd libsysdecode: Drop dead __amd64__ && COMPAT_32BIT code
Under COMPAT_32BIT we are compiling 32-bit code and so __amd64__ is not
defined, __i386__ is, and we use the real i386 headers.

Reviewed by:	brooks, jhb, imp
Differential Revision:	https://reviews.freebsd.org/D40916
2023-07-09 18:45:23 +01:00
Kristof Provost ebd508a0b2 openssl: include d2i_KeyParams() and d2i_KeyParams_bio()
These functions are new, and some ports (e.g.opensc) expect to have them
available. Add the file they're defined in to the build, and add them
to Version.map.

PR:		270076
Reviewed by:	markj, emaste, pierre
Fixes:	b077aed33b ("Merge OpenSSL 3.0.9")
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D40914
2023-07-09 15:18:21 +02:00
Christian Brueffer acb3e99faa superio.4: mdoc cleanup 2023-07-09 12:51:16 +02:00
Christian Brueffer d32210ef16 ath10k.4: mdoc cleanup 2023-07-09 12:25:57 +02:00
Martin Matuska e64780fbc3 xinstall: do not use copy_file_range(2) when BOOTSTRAPPING
Reported by:	arichardson
2023-07-09 01:25:23 +02:00
Martin Matuska 055f920ebe cat: fallback on EBADF with copy_file_range(2)
When stdout is opened with O_APPEND, copy_file_range(2) fails with EBADF.
2023-07-09 01:08:46 +02:00
John Baldwin 2596008a0b amd64 pcpu.h: Add missing 'do' from do-while loop around __PCPU_SET.
Reported by:	mjg
Diagnosed by:	jrtc27
2023-07-08 12:59:26 -07:00
Martin Matuska 5a50d52f11 xinstall: use copy_file_range(2) with fallback to previous behavior
This allows to use special filesystem features like server-side
copying on NFS 4.2 or block cloning on OpenZFS 2.2.

Note: copy_file_range(2) is not used when a digest calculation is
requested as this would require to read the input file twice.

Reviewed by:	asomers, imp, rmacklem
Differential revision:	https://reviews.freebsd.org/D40898
2023-07-08 21:51:21 +02:00
Martin Matuska 8113cc8276 cat: use copy_file_range(2) with fallback to previous behavior
This allows to use special filesystem features like server-side
copying on NFS 4.2 or block cloning on OpenZFS 2.2.

Reviewed by:	imp, rmacklem
Differential revision:	https://reviews.freebsd.org/D40882
2023-07-08 21:51:15 +02:00
Mateusz Guzik 70c00442d2 vfs: clean up unused NDF_NO* macros
The manpage is touched up to not mention them, but still desperately
needs help.
2023-07-08 19:45:46 +00:00
Konstantin Belousov 7a70f17ac4 killpg(): more carefully avoid LoR
otherwise we could end up with the livelock.  When pg_killsx trylock
failed, ensure that we do wait for lock availability before retry.

Reported and tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-07-08 22:05:25 +03:00
Konstantin Belousov ed84cb591d sys_setpgid(): style, remove extra ()s
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2023-07-08 22:05:16 +03:00
Jens Schweikhardt 5fee12e189 Correct grammo. This one has spread. Should be the last. 2023-07-08 14:35:41 +02:00
Jens Schweikhardt 7a949a0f1c Correct grammo. 2023-07-08 14:25:44 +02:00
Jens Schweikhardt 2c2a04984c Correct a grammo. 2023-07-08 11:55:54 +02:00
Graham Perrin 666c54d12e hwpmc(4): instead of manual edition, use sysrc(8)
Exemplifying safe use of sysrc(8) has become commonplace in
documentation such as the FreeBSD Handbook. Encourage its use.

Consistency: 'the driver' (not 'this driver').

Co-authored-by: Mina Galić <me+github@igalic.co>
Reviewed-by:    imp, Mina Galić <me+github@igalic.co>
Approved by:    imp
MFC after:      3 days
Pull-request:   https://github.com/freebsd/freebsd-src/pull/785
2023-07-08 07:30:52 +01:00
Greg Becker b370ef156a libthr: Patch to reduce latency to acquire+release a pthread mutex.
The acquisition and release of an uncontended default/normal pthread
mutex on FreeBSD is suprisingly slow, e.g., pthread wrlocks and binary
semaphores both exhibit roughly 33% lower latency, while default/normal
mutexes on Linux exhibit roughly 67% lower latency than FreeBSD. This is
likely explained by the fact that AFAICT in the best case to acquire an
uncontended mutex on Linux one need touch only 1 page and read+modify
only 1 cacheline, whereas on FreeBSD we need to touch at least 4 pages,
read 6 cachelines, and modify at least 4 cachelines.

This patch does not address the pthread mutex architecture. Instead,
it improves performance by adding the __always_inline attribute to
mutex_lock_common() and mutex_unlock_common() to encourage constant
folding and propagation, thereby lowering the latency to acquire and
release a mutex due to a shorter code path with fewer compares, jumps,
and mispredicts.

With this patch on a stock build I see a reduction in latency of roughly
7% for default/normal mutexes, and 17% for robust mutexes. When built
without PTHREADS_ASSERTIONS enabled I see a reduction in latency of
roughly 15% and 26%, respectively. Suprisingly, I see similar reductions
in latency for heavily contended mutexes.

By default, this patch increases the size of libthr.so.3 by 2448 bytes,
but when built without PTHREAD_ASSERTIONS enabled it only increases by
448 bytes.

Reviewed by:	jhb (previous version), kib
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D40912
2023-07-08 09:00:12 +03:00
Cy Schubert bfa51318de pam_krb5: Add missing patch
Include a portion of the patch that was missed in 813847e49e.

Reported by:	markj
Fixes:		813847e49e
MFC after:	1 day
2023-07-07 20:09:18 -07:00
Jessica Clarke 5684c8783b qlnxe: Add missing #ifdef INET to fix amd64 LINT-NOINET/NOIP builds
The approach here is copied directly from qlxgb.

Fixes:	b0d3d44dfe ("qlnxe: add driver to amd64 NOTES")
2023-07-08 00:54:07 +01:00
Mark O'Donovan 406ff3d57e Simplify buffer count calculation
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/778
2023-07-07 16:36:28 -06:00
Mark O'Donovan 0b53a9971e Remove duplicate #include
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/778
2023-07-07 16:36:28 -06:00
Brooks Davis f55ef85748 etc/rc.d/routing: use find_system_scripts
In 3693d9140e /etc/rc switched to using
find_system_scripts rather than directly including /etc/rc.d/* in the
list of scripts to run in order to skip .pkgsave files.  Follow suit
in etc/rc.d/routing.

Sponsored by:	DARPA
2023-07-07 23:25:11 +01:00
Graham Perrin 3541d90836 gpart(8): slices are out of context for GPT
Correct the GPT example. Creation of a partition leaves free the rest
of the device (not the slice).

Approved-by:  imp
Fixes:        ae1b731b5d Rewrite the GPT and MBR examples.  For GPT, ensure that the boot partition is large enough for gptzfsboot, which has doubled in size since 10.
MFC after:    1 week
Pull-request: https://github.com/freebsd/freebsd-src/pull/795
2023-07-07 23:05:46 +01:00