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.
Tracking newer versions of C (and C++) permits assuming newer language
features in the base system. Some C11 extensions are already used in
the base system but implemented on top of GNU C extensions such as
_Alignas and _Static_assert. In some cases the fallback versions in
cdefs.h are more limited than the native C11 extensions.
Even though C11 is the next major version of C, C17 is chosen instead
since C17 does not add new features to C but merely fixes defects in
C11. It is also well supported by a wide range of clang (7.0.0+) and
GCC (8.1+) versions.
Along with changing the default, this change also removes explicit
requests for c11 via the CSTD variable in various Makefiles.
Libraries and binaries for ZFS continue to use c99.
PR: 284039 (exp-run)
Reviewed by: imp, arichardson, emaste
Differential Revision: https://reviews.freebsd.org/D43237
Summary:
Fix short flags without whitespace, e.g:
zgrep -wefoo test
Fix multiple -e flags:
zgrep -e foo -e xxx test
Previously only the last pattern would be used.
Clean up possible leading blank in ${grep_args}.
Update comment: 2.51 -> 2.6.0
Add a test case for the last known zgrep wrapper issue: recursion
(-r) not implemented.
Reviewers: markj, kevans, ngie, bapt
Reviewed By: markj
Subscribers: imp
Differential Revision: https://reviews.freebsd.org/D48873
Following c2aa91745e ("netstat: restore printing the "default"
keyword, provide -nn option"), consistently use bool where appropriate
for commandline flags.
Reviewed by: glebius
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48832
Avoid POLA breakage and preserve output standard that really predates
the FreeBSD project itself. There are scripts in the wild that rely
on the behavior.
Provide option to specify -nn twice to have a completely numeric
output of the routing tables.
Fixes: 9206c79961
This reverts commit e090646d6f.
Reviewed by: zlei, gallatin, melifaro, allanjude, markj, emaste
Differential Revision: https://reviews.freebsd.org/D48729
The uncommented #ifdef _KERNEL originates from 1997 by wollman@ (see
57bf258e3d) with no clear original reason. Since these old times two
abusers of the header leak were created - libprocstat(3) and netstat(1).
These two already have a lot of _WANT_FOO hacks, so satisfy them with
_WANT_PROTOSW.
While here, cleanup and sort forward declaraions.
The file obtains some kernel structures in a dirty way and needs
forward declaration of struct sockopt for that. Make it explicit
instead of getting it via headers that were not designed for that.
Use a separate file for the RPC parser. Potentially it may get bigger.
Also to avoid include RPC header pollution of the genl.c.
Reviewed by: rmacklem
Differential Revision: https://reviews.freebsd.org/D48551
The input for the hash_comment test case was damaged in a cleanup sweep.
Restore the original input and tweak it slightly so it no longer matches
the regex used in said sweep.
Sponsored by: Klara, Inc.
Fixes: 5e3934b15a
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
This option list was tabbed over 19 characters. style.mdoc(5) asks
that lists are set to the longest item, or if that's too long then
to use indent. Resetting it to indent buys us two lines at MANWIDTH
80, and three at 59.
MFC after: 3 days
Approved by: mhorne (mentor)
Differential Revision: https://reviews.freebsd.org/D48350
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
While here, use isxdigit(3) instead of a home-rolled version.
Reviewed by: mav, asomers
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D48593
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/D30683
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
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
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
This program has two modes: monitor a single family and dump known
families. The former uses directly snl_get_genl_family_info() which uses
supposedly internal struct _getfamily_attrs as the argument. The latter
uses a parser named genl_family_parser that makes a mixture of local
definitions and definitions from <netlink_snl_generic.h>. While the
struct genl_family_parser is local, it points at struct
snl_genl_ctrl_mcast_groups and struct snl_genl_ctrl_mcast_group that are
supposedly private to netlink_snl_generic.h, as are hanging off the
underscored _getfamily_attrs.
Rewrite this mess by using same parser for both modes, that is fully
implemented locally. This parser has another very important difference to
the one declared in the header library. It will copy strings out of the
message into memory allocated within the snl_state. With the header
library parser strings point into received packet and contents will be
overwritten on next netlink message. This is not a bug with existing
genl(1) program, but it would be with future changes.
Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D48479
These macros have substantially identical implementations on each
platform. Use roundup2/rounddown2 for round_page/trunc_page.
This version standardizes on not using explicit casts and instead
preserving the original type. A couple of tweaks were required to
make this work.
Reviewed by: brooks, kib, markj
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D48450
In preparation for more arguments, switch bintrans qp argument parsing
to getopt_long, while here make the decodign argument being -d|--decode
for compatibility with base64 encoding/decoding
MFC After: 1 week
Reviewed by: pstef
Differential Revision: https://reviews.freebsd.org/D48380
cy@ was kind enough to preemptively create a port from the version of
this script in base for those that need this exact interface; add a
pointer to it so that interested individuals could start installing it
sooner rather than later.
Noted by: cy
MFC after: 3 days
The shar(1) program is simple, but the fundamental idea of a sh archive
is risky at best and one that we probably shouldn't be promoting as
prominently as a program in $PATH and a manpage. Let's deprecate and
remove it, since the same functionality can easily be found in
tar(1) instead.
Reviewed by: emaste, philip
Reviewed by: allanjude, brooks, delphij, des, imp, rpokala (previous)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D48130
We already fell back to Stone for FIFOs, but we actually need to fall
back to Stone for everything except regular files, because libdiff's
atomizer needs to know the size of its input in advance, and neither
FIFOs nor devices can be trusted to report their size.
MFC after: 1 week
Reported by: mav
Reviewed by: mav, allanjude
Differential Revision: https://reviews.freebsd.org/D48181
The "c" command should start the next cycle as clarified in POSIX 2024.
This is also consistent with historical and gnu sed behavior.
This patch is from OpenBSD by way of NetBSD with a tweak to the man page
date by me.
Confirmed the test case in the bug now works.
PR: 271817
Obtained from: NetBSD (1.39 uwe), OpenBSD (1.39 millert)
Sponsored by: Netflix
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
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
I added a third value for kern.logsigexit to mean 'auto' as an abundance
of caution, but I don't know how much it matters -- that can be easily
consolidated back to boolean-ish.
This is primarily targeted towards people running test suites under CI
(e.g. buildbot, jenkins). Oftentimes tests entail segfaults that are
expected, and logs get spammed -- this can be particularly high volume
depending on the application. Per-process control of this behavior is
desirable because they may still want to be logging legitimate
segfaults, so the system-wide atomic bomb kern.logsigexit=0 is not a
great option.
This adds a process flag to disable it, controllable via
procctl(2)/proccontrol(1); the latter knows it as "sigexitlog" due to
its length, but it's referred to almost everywhere else as
"sigexit_log."
Reviewed by: kib (earlier version), pstef
Differential Revision: https://reviews.freebsd.org/D21903
When printing only duplicated lines, the first line of each set is not
printed until we encounter the second. When that happens, we need to
increment the repetition count between printing the first and the
second line, so that if we are also printing counts, we don't print the
same (pre-increment) count twice.
MFC after: 1 week
PR: 275764
Reported by: Yu-Sheng Ma <s110062131@m110.nthu.edu.tw>
Submitted by: Daniel Tameling <tamelingdaniel@gmail.com> (original patch)
Sponsored by: Klara, Inc.
Reviewed by: tamelingdaniel_gmail.com, asomers, emaste
Differential Revision: https://reviews.freebsd.org/D48000
The -D option takes an optional argument; modify the usage message
and the manual page's synopsis to correctly reflect this. Also
update the tests to exercise -D with and without an argument.
MFC after: 1 week
Sponsored by: Klara, Inc.
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D47999