Commit graph

15910 commits

Author SHA1 Message Date
Alexander Motin
93839cddbd systat/top: Update ZFS sysctl names
Some of ARC statistic sysctls changed years ago, but those tools
are still using legacy shims, that are going to be removed.

Approved by:    re (cperciva)

(cherry picked from commit 8aad1e6148d3389df100bb0391e2d3a909f26ecf)
(cherry picked from commit f23326ff2c7cad9579061291b6de7feb5ea7302a)
2025-05-27 22:20:01 -04:00
Dag-Erling Smørgrav
84b971c918 man: Exit cleanly on SIGPIPE.
The first attempt at addressing this simply suppressed SIGPIPE, which
resulted in mandoc printing out error messages instead.  This was then
reverted, but the pipefail was (correctly) left in, so man still
returned a nonzero exit code if you quit a page before the end.

Approved by:	re (cperciva)
PR:		223516, 279542
Fixes:		14a5c1068d37, a85d870007e7
MFC after:	1 week
Reviewed by:	ziaee, kevans
Differential Revision:	https://reviews.freebsd.org/D50302

(cherry picked from commit fbaba7aa432257a9b787edc6bfdbfbde94f2e0d5)
(cherry picked from commit 2f99190a9234b119bcec1e4645e87d4e6016e5a5)
2025-05-21 19:36:41 +02:00
Xin LI
9679eedea9 MFV: xz 5.8.1.
PR:		bin/286252
Approved by:	re (cperciva)

(cherry picked from commit 128836d304d93f2d00eb14069c27089ab46c38d4)
(cherry picked from commit 5cf27a49a2de91ae1f369912a7bf3859fbc79355)
2025-05-08 09:24:51 -07:00
Michael Tuexen
0cd8d6dd11 netstat: fix table header alignment for -x
Add a missing space before R-HIWA to align the table header with
the table contents.

Reviewed by:		rrs, cc
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D49941

(cherry picked from commit 4294f7946e4cd8face2bfa16cedc5c0bf0d6c81e)
2025-05-01 21:01:47 +02:00
Kyle Evans
09e0a909fb tee: try opening as a UNIX socket if open(2) fails
If we get EOPNOTSUPP from open() failing, then it may just be that we're
looking at a unix(4) socket instead of a normal file/device or whatnot.
Fallback to trying to open it as a unix(4) socket, which is a useful
feature that doesn't add much complexity.

Reviewed by:	des, emaste, markj

(cherry picked from commit 1b3748977f28c70e0b161fb476bf4e075bcc5940)
2025-04-27 13:59:34 -05:00
Kyle Evans
8b42f57eeb time: switch to fences for siginfo_recvd
This effectively reverts
6e824f3713011 ("time: siginfo_recvd needs to be marked volatile")
because it was actually wrong.  Switch to C11 signal fence, which
provides a compiler barrier that will do the right thing.

Reported by:	kib
Reviewed by:	kib (slightly earlier version)

(cherry picked from commit df1b0f580d3dc4dd165d84fbcc14d0eebd8ee2c4)
2025-04-25 22:19:49 -05:00
Kyle Evans
c195ae9591 bintrans: disable argument permutation for qp and base64
Err on the side of caution and revert to the BSD-style getopt(3)
behavior for argument processing, as it's harder to go back and it's
not clear that this was strictly intentional.

This is the difference between allowing `base64 /COPYRIGHT -w 80` and
forcing `base64 -w 80 /COPYRIGHT`.

Reviewed by:	emaste, pstef

(cherry picked from commit d8fd551438706b3766da23e72ef077945ba43cd3)
2025-04-25 22:19:48 -05:00
Kyle Evans
99509fcc87 tee: minor cleanup
Pull the open flags out of the loop into a local var.  They won't be
changing, so this is marginally more readable.

Adds some extra brackets around the loop in preparation for a future
change that may try to fallback to opening the path as a socket if we
get an EOPNOTSUPP.

No functional change.

Reviewed by:	asomers, des, emaste, ngie

(cherry picked from commit 414c2b8d1e5abe7186c1aa4dc3ab28147ce46f47)
2025-04-25 22:19:48 -05:00
Kyle Evans
00640ea314 tee: add some basic tests
The cases are ordered in such a way that we naturally progress through
the functionality, with the earliest failures perhaps shedding light on
any later failures.

sysutils/porch is used for one test if it's available, just to cleanly
check that SIGINT is being ignored properly.

Reviewed by:	des, emaste

(cherry picked from commit 85ff0b08ee699ff323404727998993275b4d2e2a)
2025-04-25 22:19:48 -05:00
Alexander Ziaee
7149eab802
top.1: top does not accept uids
MFC after:		3 days
Reviewed by:		carlavilla, imp
Approved by:		carlavilla (mentor)
Differential Revision:	https://reviews.freebsd.org/D49631

(cherry picked from commit 92e9e13f061f9fc6411169768f5894f26fa80aaf)
2025-04-21 23:15:29 -04:00
Alexander Ziaee
9f2b64dcb2
top.1: Add HISTORY
top was added in 511d9c6565 for FreeBSD 2.2.2.

MFC after:		3 days
Reviewed by:		carlavilla, imp, joerg
Approved by:		carlavilla (mentor)
Differential Revision:	https://reviews.freebsd.org/D49591

(cherry picked from commit a9f5dcf82941e7e211490432b93bd124e7c0a57d)
2025-04-21 23:14:43 -04:00
Colin Percival
ee7a874557 14.3: Update stable/14 to -PRERELEASE
This marks the start of the FreeBSD 14.3 release cycle; the stable/14
tree is now in "code slush".

Developers are encouraged to prioritize fixing bugs (and/or merging bug
fixes from HEAD) over new features at this time.  Commit approval from
re@ is not required but if new features introduce problems they may be
removed from the release.

Approved by:	re (implicit)
Sponsored by:	Amazon
2025-04-18 22:09:46 -07:00
Kyle Evans
a420e1b1ce grep: avoid duplicated lines when we're coloring output
For the default uncolored output, we'll just output a line once and then
move on.  For colored output, we'll output multiple matches per
line with context from the line interspersed and may end up writing out
some match context multiple times as we don't persist which part of the
lines have already been printed.

Fix it by tracking the length of line printed thus far in printline()
and retaining it across successive calls to printline() in the same
line.  printline() should indicate whether it terminated the line or not
to avoid tracking the logic for that in multiple places: -o lines are
always terminated, so it's generally only some --color contexts where we
wouldn't have terminated.

Add a test to make sure that we're only printing one line going forward.

Reported and tested by:	Jamie Landeg-Jones <jamie catflap org>
Reviewed by:	emaste

(cherry picked from commit 4c9ffb13dd74159bd3ed7e1c4c706dbd15a70df2)
2025-04-16 20:01:29 -05:00
Olivier Certner
f9fa6cb391
cred: Hide internal flag CRED_FLAG_CAPMODE
This flag is used in field 'cr_flags', which is never directly visible
outside the kernel.  That field is however exported through 'struct
kinfo_proc' objects (field 'ki_cr_flags'), either from the kernel via
sysctls or from libkvm, and is supposed to contain exported flags
prefixed with KI_CRF_ (currently, KI_CRF_CAPABILITY_MODE and
KI_CRF_GRP_OVERFLOW, this second one being a purely userland one
signaling overflow of 'ki_groups').

Make sure that KI_CRF_CAPABILITY_MODE is the flag actually exported and
tested by userland programs, and hide the internal CRED_FLAG_CAPMODE.
As both flags are currently defined to the same value, this doesn't
change the KBI, but of course does change the KPI.  A code search via
GitHub and Google fortunately doesn't reveal any outside uses for
CRED_FLAG_CAPMODE.

While here, move assignment of 'ki_uid' to a more logical place in
kvm_proclist(), and definition of XU_NGROUPS as well in 'sys/ucred.h'
(no functional/interface changes intended).

Reviewed by:    mhorne
Approved by:    markj (mentor)
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D46909

(cherry picked from commit 09290c3a0c82524138973b14f393379edf733753)

A ports exp-run (PR 283410) showed one port to be affected
(sysutils/procs), which has been fixed upstream and in the ports tree.
All additional indirect references to CRED_FLAG_CAPMODE we found after
the code search mentioned in the original commit message are
automatically generated from our headers by FFI mechanisms, so
automatically disappear at recompilation (and the KBI is not changed, as
explained above, so recompilation is not needed).
2025-04-08 15:38:14 +02:00
Konstantin Belousov
8476ab3558 gcore(1): dump NT_PROCSTAT_KQUEUES section
(cherry picked from commit 10626f7384f9e39a8c02dfd475b1fd14fd7395dd)
2025-04-07 04:28:22 +03:00
Konstantin Belousov
451fca2e9f procstat.1: document kqueues
(cherry picked from commit d76a31ca74cffda4aea63b1276f92c039ca76053)
2025-04-07 04:28:21 +03:00
Konstantin Belousov
a15cae4c74 procstat(1): dump kqueues
(cherry picked from commit 28f4cf9217c27edea42c5c024c9e71816890bb3c)
2025-04-07 04:28:21 +03:00
Christos Margiolis
1890f0b0df beep(1): Use AFMT_FLOAT
AFMT_FLOAT is supported by sound(4) as of FILLME, so use it here, since
the whole program works with floats already.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D47639

(cherry picked from commit 1166cfd96f3403edb082387fbc3a4d4aa249bce8)
2025-04-06 02:28:14 +02:00
Olivier Certner
68c46c41a7
mdo(1): Use setcred() to change credentials
As this is the only system call that MAC/do currently supports, and the
only one that really can be for transitions involving simultaneous
changes of user and group IDs.

Reviewed by:    bapt
Approved by:    markj (mentor)
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D47621

(cherry picked from commit e395e354823b690ba19ecc8e3688bacec6f67ad3)
2025-04-03 21:31:05 +02:00
Ed Maste
e683e7e0f8 usr.bin/Makefile: always build ELF Tool Chain strings(1)
strings(1) is not conditional on WITH_/WITHOUT_TOOLCHAIN, as it is a
small utility that is also useful outside of the toolchain context.
As of commit 1cae7121c667 we switched to WITH_LLVM_BINUTILS by default.

After this change building world with default options but installing
WITHOUT_TOOLCHAIN failed, because we would build LLVM's strings but
attempt to install ELF Tool Chain's version, which did not exist.
Address this by always including ELF Tool Chain strings in non-install
make targets, so that it will be available if options are changed at
install time.

PR:		285556
Reported by:	Michael Butler
Reviewed by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D49425

(cherry picked from commit fdc4db57224ce19b867c60fce4c410068be40c27)
2025-04-01 08:52:53 -04:00
Dag-Erling Smørgrav
a4251e93f8 top: Make locale issues non-fatal.
If the `setlocale()` call fails, emit a warning and sleep briefly so the
user has a chance to see the warning before we redraw the screen.  Note
that we have no way of knowing exactly what is wrong, but at least we
can suggest that they check their environment.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D49230

(cherry picked from commit 180065eb09e699820a1e1c45d3d00156e0effe29)
2025-03-31 18:35:33 +00:00
Alexander Ziaee
c541138270
top: Sync usage and synopsis
Switching between io and cpu sorting uses a great example in the usage.
[-m io | cpu]. Use that everywhere.

MFC after:		3 days
Reviewed by:		mhorne
Approved by:		mhorne (mentor)
Differential Revision:	https://reviews.freebsd.org/D49515

(cherry picked from commit 187d954eab94fdcb33609d91966dbd727acfd720)
2025-03-31 13:26:26 -04:00
Alexander Ziaee
1fdca2a3a9
top: Polish key bindings in usage and manual
Organize key bindings by ascii(7) for consistency and maintainability,
mark them as Interactive Commands, wordsmith them, and sync their
organization between the manual and help screen.

MFC after:		3 days
PR:			282734
Fixes:			c8aa5e526 (move command mapping to commands.c)
Reviewed by:		imp, mhorne, Jim Brown <jpb@jimby.name>
Approved by:		mhorne (mentor)
Differential Revision:	https://reviews.freebsd.org/D49462

(cherry picked from commit 0a85254d5a33800600477ce57fbaab64591aa6ea)
2025-03-31 13:26:15 -04:00
Konstantin Belousov
04e4dda94f procstat.1: document local SOCK_SEQPACKET socket display
(cherry picked from commit 03dfb8d0211cf9d7405c4fd7d541dde28047001c)
2025-03-31 05:41:32 +03:00
Konstantin Belousov
a02f377d95 procstat.1: correct local socket types descriptions.
(cherry picked from commit 991329f507a893076a4119c90bb463de0ac15be9)
2025-03-31 05:41:32 +03:00
Konstantin Belousov
fb8c944d2b procstat: decode SOCK_SEQPACKET unix domain socket type
(cherry picked from commit 8011df62f57f021a1b4f62d9beea4c25d9b37a23)
2025-03-31 05:41:32 +03:00
Ahmad Khalifa
c0e07c93e8 install: print directory name instead of file name if mkstemp fails
Printing the file name doesn't make sense since mkstemp failing means
that the file wasn't created.

Also add a test case for this.

Co-authored-by: Jose Luis Duran <jlduran@gmail.com>
Reviewed by: imp,jhb
Pull Request: https://github.com/freebsd/freebsd-src/pull/1383

(cherry picked from commit e8d027be6b84ac976eacd46283c286b934dd6f1f)
2025-03-25 19:28:39 -06:00
Alexander Ziaee
4c02b6589e
etdump.1: Polish + xref cd9660(5)
+ correct misfile in section 8
+ rewrite the document descirption to include -9660
+ markup command modifiers as such instead of bold
+ markup variables as defined variables, enabling apropos
+ correct option syntax in description section
+ unwrap list offsets for legibility
+ fix line wrapping for standard BSD console
+ crossreference cd9660(5) and vis versa
+ tag SPDX for both manuals

MFC after:		3 days
Reviewed by:		mhorne
Approved by:		mhorne (mentor)
Differential Revision:	https://reviews.freebsd.org/D48513

(cherry picked from commit 283be95ea29abd7f867e4084bafe368c47f6c038)
2025-03-23 21:40:28 -04:00
Konstantin Belousov
8025c3957b procstat.1: document rlimitusage
(cherry picked from commit 82897058342e9bfe7193283421055e3f07ac9b8f)
2025-03-20 05:13:39 +02:00
Konstantin Belousov
d9b7d0a548 procstat.1: sort subcommands
(cherry picked from commit 0832381247d7e6e93ae9ba1639d07f33a6f07882)
2025-03-20 05:13:38 +02:00
Maxim Konovalov
6207ca7b76 truncate.1: improve the example section
Notably:
 * spell "Megabytes" as "megabytes" consistently;
 * remove a stray asterisk from the /boot/kernel/kernel listing
 * avoid using a shell prompt in the examples consistently
 * fixes the size parameter
 * add an example how to increase the file size

PR:		273997
MFC after:	1 week

(cherry picked from commit 5460bdda9d4cb3ce1d7431824b6f53c545888b53)
2025-03-14 01:55:55 +00:00
Mark Johnston
0599d2a1c5 limits tests: Try to fix spurious cputime test failures
I very occasionally see test failures caused by the total CPU time being
several milliseconds under 3s.  The test runs "limits -t 3 time <busy
loop>" and verifies that the reported time elapsed is at least 3s (and
not too much more).  In particular, any time spent executing time(1)
itself is counted against the limit but not recorded in the output.

I think it makes more sense to reverse the order, so that the CPU time
limit is not applied to time(1) itself.  This also resolves the test
failures I was seeing, which were reproducible only under load (i.e.,
running many tests in parallel).

MFC after:	2 weeks
Sponsored by:	Klara, Inc.

(cherry picked from commit 0f63c4af5e4761680550b0aa08cc96f52076c08c)
2025-03-07 22:51:48 +00:00
Alexander Ziaee
3cedc5a9f1
resizewin.1: Fix option list width typo + spdx
MFC after:		3 days
Accepted by:		mhorne (mentor)
Differential Revision:	https://reviews.freebsd.org/D48349

(cherry picked from commit 4a5d51e73e48b27d90b21ed26999b23208f603d8)
2025-02-26 19:52:19 -05:00
Cy Schubert
6a4a1a2385 shar: Make sure a sed failure in the generated archive results in failure
Obtained from:	NetBSD hg commit 365369:21b92f0055b4
MFC after:	1 week

(cherry picked from commit f0c8d2cd622a47e06c08620a10e13ad7519e9102)
2025-02-24 16:37:46 -08:00
Cy Schubert
b006133ca1 shar: Handle special characters or white space in file names fed to shar
Obtained from:	NetBSD hg commit 365370:124268924386
MFC after:	1 week

(cherry picked from commit 1080f5315427b382221651b342227b4923106f83)
2025-02-24 16:37:46 -08:00
Emmanuel Vadot
9197c04a25 Deprecate publickey(5) stuff
This uses DES and it's likely that nobody uses that in 2025.
If somebody uses this we help them by deprecating and removing this.

Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D30682

(cherry picked from commit 723425f837270dd3b22098168ae9464a1ebe38c6)
2025-02-19 21:34:42 -05:00
Li-Wen Hsu
ef3ed0726f Canonicalize the name of the FreeBSD Foundation
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit dab59af3bcc7cb7ba01569d3044894b3e860ad56)
2025-02-19 09:58:47 -05:00
Dag-Erling Smørgrav
67cead936d unifdef: Fix collision check when adding symbols.
findsym() is intended for use while parsing input, so it should not be
called from addsym2() or indirectsym(), which are called before any
input is processed.

MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D48733

(cherry picked from commit c63af363c2458aebc30c01cd0b93b4b902580019)
2025-02-13 01:37:42 +01:00
Ed Maste
90702fb5de install: Fix METALOG ouptut for numeric -o and -g args
install's -o and -g flags both accept a name or a numeric argument.
In -U -M (non-root METALOG) mode it always emitted uname= and gname= in
the METALOG, but these are not appropriate for numeric IDs.

If the -o and/or -u arguments parse as an ID, emit uid= and/or gid=
respectively.

Note that if an argument is valid as both a name and numeric ID we will
prefer the name in normal (non -U -M) mode and the ID in -U -M mode.  We
don't want to require a passwd db in non-root mode, and entirely-numeric
user or group names are a terrible idea so just accept this discrepancy.

PR:		284119
Reviewed by:	jlduran
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48504

(cherry picked from commit 4b04f5d7e8a2bb0488ad5804ecaf45cef5b1d46f)
2025-02-11 16:27:17 -05:00
Ed Maste
036ce9b76e vtfontcvt: Improve error message for unsupported DWIDTH
vtfontcvt requires that all glyphs are 1x or 2x a common width,
reporting for example "bitmap with unsupported DWIDTH 27 0 on line xxx"
if the font is expected to be 32 pixels wide.

Add the expected / permitted values to the error message to make the
issue more clear - for the same example,
"bitmap with unsupported DWIDTH 27 0 (not 32 or 64)".

Reviewed by:	ziaee
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 3433daae0d20d55503084c4d17b8a3e685657ad2)
2025-02-04 08:38:09 -05:00
Alexander Ziaee
b40f5ebc45
man.1: Improve search + spdx
People are often stunned by robust manual search functionality on
the community discord, so improve introductory doc regarding search by:

+ explain what search related flags do instead of using similies
+ consolidate and standardize search options in synopsis and usage
+ mention that a page or file can be specified in synopsis and example
+ call regular expressions `expression`, which searches to re_format(7)
+ crossreference the regular expression manual instead of egrep(1)
+ improve MANPATH xref flow and explanation, matching MAILPATH in sh(1)
+ mark up aditional semantics for their inclusion in apropos

While here:
+ use consistent spacing and form (Ql) for quoted literals
+ clean a few linter errors regarding self xref and nospace
+ reset a list width to indent for consistency with style.mdoc
+ tidy examples + align files + tag spdx

Outstanding:
- example 3 shows no results on a typical bsdinstall'd system

MFC after:	3 days
Reviewed by:	elliejs, emaste, imp, Jessica Hawkwell, jlduran
Approved by:	imp

(cherry picked from commit 46a9fb7287f41eedf321d81a68a826f231d11bfe)
2025-02-03 19:58:00 -05:00
Maxim Konovalov
9c72da8894 genl: typo fixes
PR:	284017
(cherry picked from commit 8b5058ec78a6fad972f48e6cd5613c2750f43ad6)
2025-01-29 18:33:13 +00:00
Faraz Vahedi
6f34788b4e colrm(1): Replace magic exit codes with standard macros
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
Reviewed by:	markj, oshogbo
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1496

(cherry picked from commit fc26f24b3ef276b2a9f73c9778aecff7377b1aeb)
2025-01-29 10:51:34 +01:00
Faraz Vahedi
6285abfcf3 nl(1): Capsicumise the utility
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
Reviewed by:    markj, oshogbo
MFC after:      1 week
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1465

(cherry picked from commit dfd52321b7beba716fa2bdd4f54e57e9ac806e96)
2025-01-29 10:51:31 +01:00
Faraz Vahedi
a6d0bc7065 perror(1): Replace magic exit codes with standard macros
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
Reviewed by:    markj, oshogbo
MFC after:      1 week
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1492

(cherry picked from commit 4dd6597a56f8c7ff03d4f451b612a9e45442c549)
2025-01-29 10:51:28 +01:00
Faraz Vahedi
8cf0915c19 perror(1): Reorder headers alphabetically to meet style(9) compliance
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
Reviewed by:    markj, oshogbo
MFC after:      1 week
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1492

(cherry picked from commit 82e9f8c2d19ba5d132438a764352eb3b4826fc58)
2025-01-29 10:51:24 +01:00
Mariusz Zaborski
75c8e113e6 leave: we should also cache time zone
MFC after:	1 week

(cherry picked from commit 08a38bb098e96f2ec77b26fab3b22bc4be89332a)
2025-01-29 10:51:22 +01:00
Faraz Vahedi
ef3914a561 leave(1): Replace magic exit codes with standard macros
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
Reviewed by:	oshogbo
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1499

(cherry picked from commit f7a6cf3a020600b77795729d1c01780dae8e6d2e)
2025-01-29 10:51:18 +01:00
Faraz Vahedi
15261be600 leave(1): Capsicumise
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
Reviewed by:    oshogbo
MFC after:      1 week
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1499

(cherry picked from commit 24a7303821ad2343b9239ab3d12a569a70a2b99a)
2025-01-29 10:51:15 +01:00
Faraz Vahedi
ac068edaa8 perror(1): Capsicumise
Signed-off-by: Faraz Vahedi <kfv@kfv.io>
Reviewed by:    markj, oshogbo
MFC after:      1 week
Pull Request:   https://github.com/freebsd/freebsd-src/pull/1492

(cherry picked from commit adc02d5e3cfad9c9d7e12f776cad651795d9ad78)
2025-01-29 10:51:10 +01:00