Commit graph

16225 commits

Author SHA1 Message Date
Damin Rido
7b35b4d196 sockstat: add libxo support
Sponsored by:   Google, LLC (GSoC 2025)
MFC after:      2 weeks
Reviewed by:	asomers
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1770
Relnotes:	yes
2025-07-30 14:27:14 -06:00
Warner Losh
7fc218b30b find: Put back clearing the NOSTAT bit
In fd186cd16e I read the condition backwards. We want to stat all the
time until we can implement something to do it more inteligently as
Jiles suggested in the review.

Fixes: fd186cd16e
Noticed by: des
Sponsored by: Netflix
2025-07-29 21:47:55 -06:00
Lexi Winter
328110da26 Move toolchain utils to -toolchain package
Move LLVM ar, nm, and size.  Also move elftoolchain strings, which
should have already been there.

The remaining LLVM utilities (including strings) stay in -clang for now
since they're links to other executables.

Reviewed by:	des, dim
Differential Revision:	https://reviews.freebsd.org/D51583
2025-07-28 17:29:29 +01:00
Lexi Winter
14f57afb85 bmake: Add a package for bmake and share/mk
bmake along with /usr/share/mk seems to meet the criteria for being in
its own package: it's self-contained and the majority of users (who are
using binary packages) don't need to install it, so it doesn't belong in
FreeBSD-utilities.  Instead, put it in its own package.

Add a dependency on the new package from:

- sendmail (uses make to build its configuration)
- NIS (uses make to build the database).

But not from examples, because while some of the examples do require
make, they are intended as examples rather than something to be used
directly.

Reviewed by:	manu, sjg
Differential Revision:	https://reviews.freebsd.org/D50149
2025-07-28 10:17:36 +01:00
Lexi Winter
ad023bc26e clang-scan-deps: Pass ${TDFILE} to tblgen, not ${.ALLSRC}
${.ALLSRC} can include the dependency OptParser.td, which causes
llvm-tblgen to fail since it only accepts a single input argument.

Use ${TDFILE} directly instead, which matches the other invocations
of tblgen in the LLVM Makefiles.

Fixes:		d3c06bed2c ("clang: install clang-scan-deps")
MFC after:	3 days
Reviewed by:	dim
Differential Revision:	https://reviews.freebsd.org/D51569
2025-07-28 10:17:36 +01:00
Ed Maste
0fde36fe04 pom: Cache tzdata before entering capability mode
Pom uses localtime() so needs tzdata available.

PR:		278574
Reported by:	Tatsuki Makino
Reviewed by:	ivy
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51521
2025-07-27 12:00:53 -04:00
Dag-Erling Smørgrav
ad1f7c1288 find: Remove duplicate case
Fixes:	a52d0d76fa
2025-07-26 20:41:23 +02:00
Warner Losh
a52d0d76fa find: Document possible formats
Accidentlaly committed with XXX write this. So write which formats
-printf supports.

Sponsored by:		Netflix
2025-07-26 11:12:38 -06:00
Dag-Erling Smørgrav
b26f93a465 xargs: Convert tests to ATF
Also add license and copyright statement, with permission from the
original author.

Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D51537
2025-07-26 18:44:43 +02:00
Dag-Erling Smørgrav
a7fa987abe xargs: Limit -n to {ARG_MAX}
Since it's not possible to pass more than {ARG_MAX} bytes on the command
line, it's also not possible to pass more than {ARG_MAX} individual
arguments.  Therefore, {ARG_MAX} is a reasonable upper bound for the -n
option.  This resolves both the arithmetic overflow issue and the CI OOM
issue, so we can safely re-enable the test.

Fixes:		eab91d0081
Fixes:		2682a15527
MFC after:	1 week
Reviewed by:	jlduran, emaste
Differential Revision:	https://reviews.freebsd.org/D51536
2025-07-26 18:44:35 +02:00
Dag-Erling Smørgrav
23401aeb15 Replace last few remaining MAN[1-8] with MAN
Reviewed by:	ivy
Differential Revision:	https://reviews.freebsd.org/D51530
2025-07-26 12:00:02 +02:00
Warner Losh
1f2c178e56 find: Use formats that work on 32-bit too...
Sponsored by:		Netflix
2025-07-25 23:02:31 -06:00
Warner Losh
fd186cd16e find: Fix items from the review I missed for printf
Minor fixes I missed in a review comment until after the commit.

Pointy-hat-to: imp
Fixes: 7b9c912c41
Sponsored by: Netflix
2025-07-25 16:24:49 -06:00
Warner Losh
486cae8f06 find: implement -fprint and -fprint0
Implement -fprint fn which will print the matching files to fn, each
followed by a newline ('\n'). And -fprint0 (same, except followed by a
NUL). Both of these are always true. The file is created if it does not
exist, or truncated if it does. This is done first thing
unconditionally, so if there's no output, the file will have zero
length.

Note: GNU Find appears to collect the output for -fprint* to the same
file such that they don't interfere. That detail is unimplemented at
present.

Sponsored by:		Netflix
Discussed with:		jilles
Reviewed by:		pauamma@gundo.com (man)
Differential Revision:	https://reviews.freebsd.org/D42667
2025-07-25 10:34:49 -06:00
Warner Losh
7b9c912c41 find: Add GNU find's -printf
Implements most of gnu find's -printf predicate. However, the '#', '-',
'.' and size format modifiers are unimplemented, as are %P, %H, %F, %y,
and %Y formats. Follows what I think it should do based on the info
page, I've not looked at the gnu find code.

Sponsored by:		Netflix
Discussed with:		des, jilles
Reviewed by:		pauamma@gundo.com (man)
Differential Revision: https://reviews.freebsd.org/D38138
2025-07-25 10:34:37 -06:00
Lexi Winter
bf0ee5f217 pom.6: add a more complete bibliography
Source: Wikipedia
<https://en.wikipedia.org/wiki/Practical_Astronomy_with_Your_Calculator>
2025-07-24 22:13:57 +01:00
Artem Bunichev
6a41fd4667
top.1: Fix incorrect default value for -s option
The default delay between screen updates was incorrectly transfered
from roff(7) register that was used in previous version of man page.

Reviewed by:		ziaee
Fixes:			9d6cce02a7 (initial pass to freebsdize)
Differential Revision:	https://reviews.freebsd.org/D51503
2025-07-24 16:06:21 -04:00
Ed Maste
58d9d2f8da asa.1: Drop SEE ALSO reference to long-gone f77(1)
Sponsored by:	The FreeBSD Foundation
2025-07-24 13:25:39 -04:00
Wolfram Schneider
f8b632fb04 man.sh: avoid endless loop
limit the number of .so includes to a value of 32 instead of infinity.

PR: 287037
Differential Revision: https://reviews.freebsd.org/D51412
2025-07-21 07:23:45 +00:00
Aymeric Wibo
46be8a71d5
committers-src: add myself (obiwac@)
Add obiwac@ (myself) as new src committer with mckusick@ and jrm@ as
mentors.

Reviewed by:	mckusick (mentor), jrm (mentor)
Approved by:	mckusick (mentor), jrm (mentor)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D51428
2025-07-20 18:01:59 +02:00
Simon J. Gerraty
a8c56be471 Merge bmake-20250707
Merge commit '3d772e596c1acf76f555c1f51fd8d834e56b0c35'
2025-07-19 10:41:12 -07:00
Alan Somers
cc61a0793a manpages: prefer linking to xo_options.7 over xo_parse_args.3
Most libxo-enabled utilities link to xo_parse_args.3.  But that man page
doesn't actually describe how to format command-line arguments.  Rather,
xo_options.7 does.  I suspect that these utilities link to the former
because the latter man page did not exist until libxo-0.7.2
(8a6eceff3c).  And newer utilities have probably been copy/pasting the
same text from older ones.  But the superior man page does exist now,
so we should link to it instead.

MFC after:	2 weeks
Sponsored by:	ConnectWise
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D51354
2025-07-16 12:02:24 -06:00
Damin Rido
b2bf651a79 sockstat: Reintroduce -w flag with altered behavior
The -w flag was previously removed when automatic column sizing was
introduced. Originally, -w enabled wider output, but used hardcoded
column widths that did not guarantee alignment with actual content.

This commit reintroduces the -w flag with a new purpose: to dynamically
size columns based on the longest entry in the current output.  Unlike
the original behavior, this version ensures fully aligned and
consistently formatted rows.

By default, sockstat now uses fixed-width columns for more compact
output, especially in 80-column terminals. Users who prefer a full-width
view can now use -w to enable automatic column sizing.

Sponsored by:	Google, LLC (GSoC 2025)
MFC after:	2 weeks
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1746
Reviewed by:    asomers, glebius
2025-07-15 15:09:02 -06:00
Alexander Ziaee
602e423db1
top.1: Document the THR column
MFC after:		3 days
Fixes:			32efd26355 (Add a THR column)
Reviewed by:		bcr
Differential Revision:	https://reviews.freebsd.org/D50754
2025-07-15 15:25:31 -04:00
Alexander Ziaee
3cb2a7e01e
sed.1: Adjust examples to fit in one line + SPDX
Examples were previously overflowing at MANWIDTH 80. Keep the same
complexity but use shorter phrases to make them easier to read. Tag
SPDX while here.

MFC after:		3 days
Reviewed by:		bcr
Discussed with:		emaste
Differential Revision:	https://reviews.freebsd.org/D50867
2025-07-15 15:20:11 -04:00
Jeffrey R. Day
b87dcd7004
find.1: Correct HISTORY grammar typo
PR:		286292
MFC after:	3 days
Reviewed by:	ziaee
2025-07-14 13:50:51 -04:00
Christos Margiolis
697bf0f416 fortune: Fix typo in dmesgd.nycbug.org example
No functional change, but commit for correctness nonetheless.

MFC after:	1 day
Differential Revision:	https://reviews.freebsd.org/D51293
2025-07-14 00:25:58 +03:00
Lukas Engelhardt
76856ead44 netstat.1: Add common example to list listening sockets
While here, wrap to 80 characters.

Approved by:	ziaee
Differential Revision:	https://reviews.freebsd.org/D51280
2025-07-13 08:07:00 +00:00
Konstantin Belousov
09d28419c6 cross-build: fix after the recent sqlite3 import
Stop adding contrib/sqlite3 into the include path for usr.bin/kyua, take
headers from the install sysroot env.  sqilte3 now has the VERSION file,
which clashes with c++ include <version>.

Submitted by:	jrtc27 (see https://reviews.freebsd.org/D51217)
Tested by:	kib
Fixes:	17f0f75308 ("sqlite3: Vendor import of sqlite3 3.50.2")
2025-07-11 00:31:23 +03:00
Kyle Evans
3fde39073c shar: remove from the tree well in advance of the 15.0 release
We have had deprecation notice in the manpage for nearly six months, and
it is also present both in 13.5 and 14.3.  tar(1) can supply this
functionality for those that truly need it, and cy@ has also created a
sysutils/freebsd-shar port for this version of a frontend to live on in
ports -- this port has been available since December 18, 2024.

Reviewed by:	allanjude, cy, emaste, jrm
Differential Revision:	https://reviews.freebsd.org/D50925
2025-07-10 12:57:03 -05:00
Kyle Evans
4c8b54f765 lockf: minor cosmetic cleanups, no functional change
Switch various flags from int -> bool.

kill(getpid(), foo) and raise(foo) are equivalent in this context, so
switch to the latter as a minor preference for readability.

Use proper signal fences instead of volatile for our SIGALRM handler.

Reviewed by:	kib (earlier version), des
Differential Revision:	https://reviews.freebsd.org/D51027
2025-07-10 12:54:20 -05:00
Kyle Evans
c82203e65d lockf: tests: add tests for the -p and -T features
Reviewed by:	des
Differential Revision:	https://reviews.freebsd.org/D51026
2025-07-10 12:54:20 -05:00
Kyle Evans
679f619495 lockf: add a -T option to terminate the child upon early abort
This is useful to avoid having the command running twice in the face of
the admin terminating the process.  Notably, if the -p option is not in
use (or can't be used, e.g., because we can't open the file for writing)
then this provides a nice alternative where one simply needs to send a
SIGTERM to the lockf(1) process associated with the lock file to clean
it all up.

Reviewed by:	des
Differential Revision:	https://reviews.freebsd.org/D51025
2025-07-10 12:54:20 -05:00
Kyle Evans
7e8afac0cb lockf: switch to a SIGCHLD model for reaping child
A future change will add a -T flag to forward SIGTERM along to the
child before we cleanup and terminate ourselves.  Using a SIGCHLD
handler to do that with SIGTERM blocked only while the child is actively
being collected will enable us to safely do so without having to worry
that our pid is potentially invalid.

Add a test that concisely checks that the child's error is properly
bubbled up to the caller.

Reviewed by:	des, kib
Differential Revision:	https://reviews.freebsd.org/D51024
2025-07-10 12:54:19 -05:00
Kyle Evans
df268d4b03 lockf: add a -p mode to write the child's pid
If we're going to hold the lock, it can be useful to scribble down the
pid that we spawned off to quickly associate the lock back to the
process that's keeping it open.

Reviewed by:	allanjude (previous version), des
Differential Revision:	https://reviews.freebsd.org/D51014
2025-07-10 12:54:19 -05:00
Alexander Ziaee
91ad27bcfc
truncate.1: Polish title and examples
+ describe better
+ switch examples to human readable sizes, with consistent spacing
+ `Downsize ... in 5 Megabytes` >> `Downsize ... by 5 Megabytes`
+ remove prompt from lone example with prompt for consistency
+ remove x permissions from kernel example
+ examples now fit on standard console without wrapping

While here:
+ fold a line to eliminate linter warning + tag spdx
+ add -nosplit to AUTHORS to eliminate a rendering glitch

MFC after:	3 days
Discussed with:	asomers, jhb, maxim
Reviewed by:	imp (previous version)
Closes:		https://github.com/freebsd/freebsd-src/pull/1568
2025-07-09 13:52:01 -04:00
Mark Johnston
393fefa3d9 mkimg: Make output reproducible using a specific timestamp
In commit 95ac5b0e27 ("mkimg: Add a reproducible mode"), I added a -R
flag to mkimg, indicating that output should be reproducible.

There is one place in the VHD image backend that uses time(3) to
populate an image metadata field; this field is visible to tools which
know how to process VHD images.  Rather than picking an arbitrary value
for that timestamp, it seems better to behave like makefs(8) and let the
invoker pick a suitable timestamp.

So, remove -R and instead add a -t option which lets the timestamp be
specified directly.  Then, modify the VHD backend to use that timestamp.

Fixes:		95ac5b0e27 ("mkimg: Add a reproducible mode")
Reviewed by:	bnovkov
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D51077
2025-07-07 20:27:24 +00:00
Lexi Winter
d3c06bed2c clang: install clang-scan-deps
clang-scan-deps is used to generate dependency information from C++20
modules according to proposed standard ISO/IEC WG21 P1689R5[0].  It is
required by common build tools (e.g., CMake) to build C++ sources
that use modules.

Since this is a core build tool, install it by default, not gated
behind MK_CLANG_EXTRAS.

[0] https://www.open-std.org/JTC1/SC22/WG21/docs/papers/2022/p1689r5.html

MFC after:	3 days
Reviewed by:	kevans, dim
Approved by:	kevans (mentor)
Requested by:	jbo
Differential Revision:	https://reviews.freebsd.org/D51044
2025-07-06 22:02:52 +01:00
Alan Somers
bc3338985a sockstat: microoptimize cap-getnameinfo
Revert a change to the cap_getnameinfo, accidentally introduced in
0726c6574f, that caused cap_getnameinfo to populate a buffer which was
about to be thrown away.

Fixes:		0726c6574f
Sponsored by:	ConnectWise
Reviewed by:	Damin Rido <rido@FreeBSD.org>
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1753
2025-07-04 13:18:34 -06:00
Mark Johnston
f56e0d4755 procstat: Add handling for inotify descriptors
MFC after:	3 months
Sponsored by:	Klara, Inc.
2025-07-04 14:42:34 +00:00
Mark Johnston
e02d4fab54 kdump: Add support for decoding inotify events
These are emitted when reading from an inotify descriptor.

MFC after:	3 months
Sponsored by:	Klara, Inc.
2025-07-04 14:42:33 +00:00
Mark Johnston
4d08e7815d truss: Add a decoder for inotify_add_watch_at(2)
MFC after:	3 months
Sponsored by:	Klara, Inc.
2025-07-04 14:42:33 +00:00
Simon J. Gerraty
0b46a53a2f Merge bmake-20250618 2025-06-27 19:49:16 -07:00
Damin Rido
0726c6574f sockstat: Add automatic column sizing and remove -w option
Refactor sockstat to dynamically size table columns based on content.
This eliminates the need for the -w option, which is now ignored
for backwards compatibility.

Numeric columns are now right-aligned for improved readability;
previously, they were left-aligned.

Unknown fields are now consistently shown as "??" instead of a mix
of "", "?", and "?" for output uniformity.

Sponsored by:	Google, LLC (GSoC 2025)
MFC after:	2 weeks
Reviewed by:	asomers
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1720
2025-06-27 09:54:41 -06:00
Mark Johnston
95ac5b0e27 mkimg: Add a reproducible mode
mkimg embeds a UUID in the GPT header and uses the current time of day
to generate it, so its output is not reproducible by default.  Add a -R
flag to ask it to use a fixed time for UUID generation.

Merge the FreeBSD-specific implementation of osdep_uuidgen() with that
of Linux, as the use of uuidgen(2) is incompatible with reproducible
output mode.

Reviewed by:	bnovkov
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D49716
2025-06-26 14:44:01 +00:00
Dag-Erling Smørgrav
0a5b763d98 libc: Rename fscandir{,_b}() to fdscandir{,_b}().
This seems to fit the pattern better (e.g. fdopendir()).

I've added weak references to ease the transition, but since it's only
been a few days, we can remove them (and the ObsoleteFiles entries for
the manual pages) before we branch stable/15.

Fixes:		deeebfdeca
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D50980
2025-06-23 15:03:10 +02:00
Wolfram Schneider
27aec148ea mididumpl.1: update link to Standard MIDI-File Format Spec. 1.1, updated
PR:		287588
MFC after:	1 week
2025-06-23 05:36:51 +00:00
Mark Johnston
a37bc4cb8d localedef: Fix a wchar_t comparison
The intent here is to characterize wide characters which fit in a single
byte.  When wchar_t is signed, this comparison is insufficient.

On systems with signed wchar_t, of the files in /usr/share/locale this
only affects zh_CN.GB18030/LC_COLLATE.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D50757
2025-06-20 16:39:22 +00:00
Mark Johnston
770fba248d localedef: Use consistent sorting order
In several modules we build up an RB tree keyed by wide characters.
wchar_t has different signedness on different platforms, so iteration
over such a tree results in platform-dependent ordering.

The ctype module uses this ordering when writing the output file, which
creates reproducibility problems when comparing the results of cross
builds and native builds (e.g., native amd64 vs. cross-building on
arm64).

Modify such comparisons to always be unsigned.  Introduce a helper
function for this purpose.  In the other modules I believe the sort
order does not affect program output.

On systems with signed wchar_t, of the files in /usr/share/locale this
only affects zh_CN.GB18030/LC_CTYPE.

MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D50756
2025-06-20 16:39:22 +00:00
Dag-Erling Smørgrav
28d9586cde diff: Fix gcc build.
Sponsored by:	Klara, Inc.
2025-06-20 17:42:40 +02:00