Commit Graph

14964 Commits

Author SHA1 Message Date
Michael Reifenberger
8d06c3e7a4 Improve size readability.
Preserve more space for swap devise names.
Prevent line overflow with long devise name.
Don't draw a bar when swap is not used at all.
Simplify and optimize code.
Change the label to end at end of 100%.
PR:		251655
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D27496
2021-02-15 20:23:32 +01:00
Simon J. Gerraty
85d6747a69 bsd.links.mk wants full paths
The values in LINKS need to be full paths.
2021-02-15 10:05:00 -08:00
Simon J. Gerraty
ee10666327 Links for bmake and bmake.1
Some folk forget that make is bmake, and want the links...

MFC after: 1 week
2021-02-14 17:22:21 -08:00
Konstantin Belousov
25c6318c79 procstat: distinguish vm map guards in procstat vm output.
Requested and reviewed by:	rwatson (previous version)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D28658
2021-02-14 03:24:58 +02:00
Dimitry Andric
0ff1014944 Update Subversion to 1.14.1 LTS. See contrib/subversion/CHANGES for a
summary of changes, or for a more thorough overview:

https://subversion.apache.org/docs/release-notes/1.14

NOTE 1: There is no need to dump and reload repositories, and the
working copy format is still the same as Subversion 1.8 through 1.13.

NOTE 2: The upstream release also contains a fix for a security issue in
mod_dav_svn (CVE-2020-17525), but since we do not build or use any
Apache modules, it is not an issue for the FreeBSD base system.

Relnotes:	yes
MFC after:	3 days
2021-02-13 14:38:51 +01:00
Simon J. Gerraty
dba7b0ef92 Merge bmake-20210206
Changes of interest

  o unit-tests: use private TMPDIR to avoid errors from other users
  o avoid strdup in mkTempFile
  o always use vfork
  o job.c: do not create empty shell files in jobs mode
    reduce unnecessary calls to waitpid
  o cond.c: fix debug output for comparison operators in conditionals
2021-02-10 22:03:22 -08:00
Mateusz Piotrowski
e6f59be239 systat.1: Fix synopsis
systat does not have a "-display" flag. Use Ar to indicate that
"display" is meant to be substituted with an actual display command.

MFC after:	1 week
2021-02-10 18:09:49 +01:00
Mateusz Piotrowski
fcbaf46b76 systat.1: Remove Tn macros
They are no longer supported by mdoc(7).

MFC after:	1 week
2021-02-10 18:09:27 +01:00
Jessica Clarke
01d07b03ef localedef: Fix bootstrapping on Ubuntu 16.04
Glibc's stdlib.h defines various prototypes for GNU extensions that take
a locale_t. Newer versions use locale_t directly and include an internal
bits/types/locale_t.h in order to get its definition, but older versions
include xlocale.h for that, for which our bootstrap version is empty.
Moreover it expects to use the glibc-specific __locale_t type. Thus,
provide dummy definitions of both types in order to ensure the
prototypes don't give any errors, and guard against the header being
inadvertently included between the bootstrapping namespace.h and
un-namespace.h, where locale_t is #define'd.

This header is not used when bootstrapping on FreeBSD and exists solely
to stub out glibc's, so this should have no impact on FreeBSD hosts.

Reviewed by:	arichardson, emaste (comment only)
Differential Revision:	https://reviews.freebsd.org/D28317
2021-02-10 16:41:35 +00:00
Alex Richardson
81c3f64110 usr.bin/grep: Fix Address OOB read error
I found this when compiling all the bootstrap tools with -fsanitize=addres:

==65590==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62d000008400 at pc 0x000000473053 bp 0x7ffc1c7dd910 sp 0x7ffc1c7dd0b8
READ of size 32769 at 0x62d000008400 thread T0
    #0 0x473052 in regexec (/local/scratch/alr48/cheri/build/freebsd-amd64-build/local/scratch/alr48/cheri/freebsd/amd64.amd64/tmp/legacy/bin/grep+0x473052)
    #1 0x4c9cf3 in procline /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c:539:8
    #2 0x4c8687 in procfile /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c:379:18
    #3 0x4c6596 in main /local/scratch/alr48/cheri/freebsd/usr.bin/grep/grep.c:714:8

0x62d000008400 is located 0 bytes to the right of 32768-byte region [0x62d000000400,0x62d000008400)
allocated by thread T0 here:
    #0 0x493d5d in malloc (/local/scratch/alr48/cheri/build/freebsd-amd64-build/local/scratch/alr48/cheri/freebsd/amd64.amd64/tmp/legacy/bin/grep+0x493d5d)
    #1 0x4cad75 in grep_malloc /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c:656:13
    #2 0x4c8129 in procfile /local/scratch/alr48/cheri/freebsd/usr.bin/grep/util.c
    #3 0x4c6596 in main /local/scratch/alr48/cheri/freebsd/usr.bin/grep/grep.c:714:8

SUMMARY: AddressSanitizer: heap-buffer-overflow (/local/scratch/alr48/cheri/build/freebsd-amd64-build/local/scratch/alr48/cheri/freebsd/amd64.amd64/tmp/legacy/bin/grep+0x473052) in regexec

Reviewed By:	kevans
MFC after:	1 week
2021-02-09 17:13:32 +00:00
Kyle Evans
3e2d96ac97 grep: fix -A handling in conjunction with -m match limitation
The basic issue here is that grep, when given -m 1, would stop all
line processing once it hit the match count and exit immediately.  The
problem with exiting immediately is that -A processing only happens when
subsequent lines are processed and do not match.

The fix here is relatively easy; when bsdgrep matches a line, it resets
the 'tail' of the matching context to the value supplied to -A and
dumps anything that's been queued up for -B. After the current line has
been printed and tail is reset, we check our mcount and do what's
needed. Therefore, at the time that we decide we're doing nothing, we
know that 'tail' of the context is correct and we can simply continue
on if there's still more to pick up.

With this change, we still bail out immediately if there's been no -A
flag. If -A was supplied, we signal that we should continue on. However,
subsequent lines will not even bothere to try and process the line.  We
have reached the match count, so even if the next line would match then
we must process it if it hadn't. Thus, the loop in procfile() can
short-circuit and just process the line as a non-match until
procmatches() indicates that it's safe to stop.

A test has been added to reflect both that we should be picking up the
next line and that the next line should be considered a non-match even
if it should have been.

PR:		253350
MFC-after:	3 days
2021-02-08 12:41:22 -06:00
Emmanuel Vadot
8af54bdfca lastcomm(1): Only install if MK_ACCT is on
MFC after:	3 days
2021-02-06 20:41:39 +01:00
Mark Johnston
90da2c797b truss: Decode sendfile(2) arguments
MFC after:	2 weeks
2021-02-05 11:28:29 -05:00
Kyle Evans
2373acbbb7 grep: turn off -w if -x is specified
-x overcomes -w in gnugrep, and it should here as well.  Flip it off as
needed to avoid confusing other parts of grep.
2021-02-04 20:59:43 -06:00
Kyle Evans
f823c6dc73 grep: fix null pattern and empty pattern file behavior
The null pattern semantics were terrible because I tried to match gnugrep,
but I got it wrong.  Let's unwind that:

- The null pattern should match every line if neither -w nor -x.
- The null pattern should match empty lines if -x.
- The null pattern should not match any lines if -w.

The first two will stop processing (shortcut) even if additional patterns
are specified. In any other case, we will continue processing other
patterns.  If no other patterns are specified beside a null pattern, then
we match if neither -w nor -x or set and do not match if either of those
are specified.

The justification for -w is that it should match on a whole word, but the
null pattern deos not have a whole word to match on.

Empty pattern files should never match anything, and more importantly, -v
should cause everything to be written.

PR:		253209
MFC-after:	4 days
2021-02-04 20:59:42 -06:00
Alex Richardson
39a1f858ad du_test: Skip three tests if sparse files are not supported
This fixes running the du tests with /tmp as tmpfs (which is what we do in the
CheriBSD CI).

Obtained from:	CheriBSD
Reviewed By:	ngie
Differential Revision: https://reviews.freebsd.org/D28398
2021-02-03 17:06:07 +00:00
Olivier Cochard
b67df8d7c2 diff: Use unprivileged_user with report_identical test
Approved by:	bapt
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D28466
2021-02-03 17:18:59 +01:00
Baptiste Daroussin
c69047ca75 Revert "diff: eliminate a useless lseek"
This changes breaks when one of the files is stdin

This reverts commit fa977a3b2b.

Reported by:	olivier
2021-02-02 10:08:25 +01:00
Chuck Silvers
7787e7eed9 tail: fix "tail -F" file rotation detection
When checking if the newly opened file is the same as the old one,
we need to fstat() the new file descriptor, not the old one again.

Reviewed by:	glebius
Sponsored by:	Netflix
2021-02-01 16:21:14 -08:00
Kyle Evans
9ca71db495 ofed: fix the WITH_OFED_EXTRA build
This option was not tested when WARNS was globally lifted in the src tree up
to 6.  Drop WARNS back down to unbreak the build; note that this is still
enabling more warnings than it had before the WARNS change, so the gcc build
may need to be independently evaluated at this level.

PR:		252865
Reported-by:	Build Option Servey via Michael Dexter
MFC-after:	3 days
2021-01-29 23:52:13 -06:00
John Baldwin
9d4104b214 Fix ldd to work with more ELF files.
- Use libelf to parse ELF data structures and remove code duplication
  for ELF32.

- Don't require the OSABI field to be set to the FreeBSD OSABI for
  shared libraries.  Both AArch64 and RISC-V leave it set to "none"
  and instead depend on the ABI tag note.  For ldd, this means falling
  back to walking the notes in PT_NOTE segments to find the ABI tag
  note to determine if an ELF shared library without OSABI set in the
  header file is a FreeBSD shared library.

Reviewed by:	kib
MFC after:	5 days
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D28342
2021-01-29 10:53:50 -08:00
Kyle Evans
bf59049c27 du: tests: use dollar-single quotes where appropriate
No need for "foo$(printf "\t")", $'\t' is both more readable and still
functional.

Reported-by:	Jamie Landeg-Jones <jamie@catflap.org>
2021-01-28 21:02:58 -06:00
Baptiste Daroussin
7a57c9cb5a diff: eleminitate useless macros
The diff_output was not bringing any values but was obfuscating
the code.
2021-01-27 12:29:33 +01:00
Baptiste Daroussin
e43239f514 diff: simplify the hash functions
Instead of 3 different complex case they have all been folded into a
simple on based on switch
2021-01-27 12:28:26 +01:00
Baptiste Daroussin
e52546a3a7 diff: fix typo in a comment 2021-01-27 12:18:46 +01:00
Baptiste Daroussin
931ad51808 diff: remove stalled entries in headers 2021-01-27 12:18:45 +01:00
Baptiste Daroussin
15abb23286 diff: eliminate space at end of line
No functionnal changes
2021-01-27 12:18:45 +01:00
Baptiste Daroussin
fa977a3b2b diff: eliminate a useless lseek
fdopen with the "r" already position the stream at the beginning
of the file.
2021-01-27 12:18:45 +01:00
Baptiste Daroussin
c440e7870a diff: add a test case about the non regular file support 2021-01-27 12:18:45 +01:00
Jamie Landeg-Jones
fefb3c46a8 diff: fix incorrectly displaying files as duplicates
When diff hits certain access errors, function diffreg() shows the error
message, and then returns to the calling function, which calls
print_status() with the return value.

However, in these cases, the return value isn't changed from the initial
default value of D_SAME.

Normally, print_status() with a value of D_SAME does nothing, so this
works out ok, however, if the "-s" flag is set, a message is displayed
showing identicality:

case D_SAME:
                if (sflag)
                        printf("Files %s%s and %s%s are identical\n",                                                                                                       path1, entry, path2, entry);
                break;

This then produces such results as:

% diff  -s /COPYRIGHT /var/run/rpcbind.sock
diff: /var/run/rpcbind.sock: Operation not supported
Files /COPYRIGHT and /var/run/rpcbind.sock are identical

% diff  -s /COPYRIGHT /etc/master.passwd
diff: /etc/master.passwd: Permission denied
Files /COPYRIGHT and /etc/master.passwd are identical

Create a D_ERROR status which is returned in such cases, and
print_status() then deals with that status seperately from D_SAME

PR:		252614
MFC after:	1 week
2021-01-25 20:38:18 +01:00
Baptiste Daroussin
13860e71eb diff: add a test case for failed -s option 2021-01-25 20:37:58 +01:00
Konstantin Belousov
9940ac808d elfctl: Fix type errors.
Target value for val has uint32_t type, not uint, adjust used constant.
Change val type to unsigned so that left and right sides of comparision
operator do not expose different signed types of same range [*].

Switch to unsigned long long and strtoll(3) so that 0x80000000 is
accepted by conversion function [**].

Reported by:	kargl [*]
Noted by:	emaste [**]
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D28301
2021-01-23 17:24:32 +02:00
Ed Maste
f302fd1aa6 elfctl: fix typo from last-minute refactoring
Reported by:	jkim
Fixes:		86f33b5fcf
2021-01-22 16:35:05 -05:00
Ed Maste
86f33b5fcf elfctl: allow features to be specified by value
This will allow elfctl on older releases to set bits that are not yet
known there, so that the binary will have the correct settings applied
if run on a later FreeBSD version.

PR:		252629 (related)
Suggested by:	kib
Reviewed by:	gbe (manpage, earlier), kib
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28284
2021-01-22 14:38:52 -05:00
Lewis Cook
e808c8309c Complete Steps 5 and 9 from the Committer's guide
Summary:
Steps 5 and 9:
 - Update Mentor and Mentee Information
 - Update Ports with Personal Information

Reviewers: tcberner, fernape

Reviewed By: fernape

Subscribers: imp

Differential Revision: https://reviews.freebsd.org/D28281
2021-01-22 11:54:05 +00:00
Jessica Clarke
5faeda9037 Rename i386's Linux ELF to Linux ELF32
This is what amd64 calls the i386 Linux ABI in order to distinguish it
from the amd64 Linux ABI, and matches the nomenclature used for the
FreeBSD ABIs where they always have the size suffix in the name.

Reviewed by:	trasz
Differential Revision:	https://reviews.freebsd.org/D27647
2021-01-21 01:54:12 +00:00
Alex Richardson
c1a3d7f206 Remove remaining uses of ${COMPILER_FEATURES:Mc++11}
All supported compilers have C++11 support so these checks can be replaced
with MK_CXX guards.
See also https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=252759

PR:		252759
Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D28234
2021-01-19 21:37:36 +00:00
Martin Tournoij
f850fd2496 grep: fix LINKS in Makefile
zstdegrep was listed twice, instead of zstdfgrep

Pull Request:	https://github.com/freebsd/freebsd-src/pull/450
2021-01-18 11:22:48 +01:00
Ed Maste
c763f99d11 elfctl: prefix disable flags with "no"
Some ELF feature flags indicate a request to opt-out of some feature,
for example NT_FREEBSD_FCTL_ASLR_DISABLE indicates that ASLR should be
disabled for the tagged binary.  Using "aslr" as the short name for the
flag is confusing as it seems to indicate a request for ASLR to be
enabled.  Rename "noaslr", and make a similar change for other opt-out
flags.

Reviewed by:	bapt, manu, markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D28139
2021-01-14 15:09:13 -05:00
Ed Maste
3dfcb70b6a elfctl: add backwards compatibility for "no" prefixes
I am going to prefix opt-out ELF feature flag names with "no" to make
their meaning more clear (review D28139), but there are some uses of the
existing names already (e.g., the PR referenced below).

For now accept the older, unprefixed name as well, and emit a warning.
We can revert this after FreeBSD 13 branches.

% elfctl -e +aslr foo
elfctl: interpreting aslr as noaslr; please specify noaslr

PR:		239873 (related)
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28140
2021-01-14 15:09:08 -05:00
Simon J. Gerraty
06b9b3e0ad Merge bmake-20210110
Quite a lot of churn on style, but lots of
good work refactoring complicated functions
and lots more unit-tests.
Thanks mostly to rillig at NetBSD

Some interesting entries from ChangeLog

o .MAKE.{UID,GID} represent uid and gid running make.

o allow env var MAKE_OBJDIR_CHECK_WRITABLE=no to skip writable
  checks in InitObjdir.  Explicit .OBJDIR target always allows
  read-only directory.

o add more unit tests for META MODE

Merge commit '8e11a9b4250be3c3379c45fa820bff78d99d5946' into main

Change-Id: I464fd4c013067f0915671c1ccc96d2d8090b2b9c
2021-01-13 22:21:37 -08:00
Ed Maste
f6d95a0110 elftcl: add -i flag to ignore unknown flags
This may allow an identical elfctl invocation to be used on multiple
FreeBSD versions, with features not implemented on older releases being
silently ignored.

PR:		252629 (related)
Reviewed by:	kib
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28130
2021-01-13 00:10:13 -05:00
Ed Maste
80445b7a3f cmp: fix -s (silent) when used with skip offsets
-s causes cmp to print nothing for differing files, for use when only
the exit status is of interest.

-z compares the file size first, for regular files, and fails the
comparison early if they do not match.

Prior to this change -s implied -z as an optimization, but this is not
valid when file offsets are specified.  Now, enable the -z optimization
for -s only if both skip arguments are not provided / 0.

Note that using -z with differing skip values will currently always
fail.  We may want to compare size1 - skip1 with size2 - skip2 instaead,
and in any case the man page should be clarified.

PR:		252542
Fixes:		3e6902efc8
Reported by:	William Ahern
Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D28071
2021-01-10 19:02:56 -05:00
Ed Maste
1f7661742d cmp: use C99 bool for flags
MFC after:	1 week
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28072
2021-01-10 19:02:55 -05:00
Ed Maste
c8eee7c0bf ldd: renumber executable type constants
ldd had #defines for AOUT, ELF, and ELF32.  The removal of AOUT left a
possibly confusing gap.  These are not used anywhere but this file so
renumber to avoid the gap.

Reported by:	allanjude
2021-01-09 13:34:58 -05:00
Ed Maste
12a8d3027d diff: honour flags with -q
Previously -q (just print a line when files differ) ignored flags like
-w (ignore whitespace).  Avoid the D_BRIEF short-circuit when flags are
in effect.

PR:		252515
Reported by:	Scott Aitken
Reviewed by:	kevans
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D28064
2021-01-09 13:34:06 -05:00
Fernando Apesteguía
53c8d22495 last(1): Add EXAMPLES section
Add two simple examples showing the use of the flags: d, n, s, t
While here, reorder cross references properly by section
Bump .Dd

Approved by: manpages (gbe@)
Differential Revision: https://reviews.freebsd.org/D27540

last(1): Bump .Dd
2021-01-09 18:37:25 +01:00
Fernando Apesteguía
9e23004023 man(1): Bump .Dd
From commit df965a6829
2021-01-09 18:22:08 +01:00
Fernando Apesteguía
df965a6829 man(1): Add EXAMPLES section
Add some examples showing the use of the flags: a, k, P, w

Reviewed by: gbe@, yuripv@
Approved by: manpages (gbe@)
Differential Revision: https://reviews.freebsd.org/D27545
2021-01-09 17:57:47 +01:00
Ed Maste
0713c7b88c ldd: Retire aout support
Userland aout support has not been required since FreeBSD 2.x.
If someone needs to use FreeBSD 2 shared libraries they will be best
served by using a FreeBSD 2 ldd, perhaps as part of a jail with a full
FreeBSD 2.x install.

Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27478
2021-01-07 19:14:01 -05:00
Kyle Evans
3c5c39c7ad du: tests: make H_flag tests more strict about output requirements
The current version of this test will effectively pass as long as one of the
specified paths is in the output, and it could even be a subset of one of
the paths.

Strengthen up the test a little bit:
  * Specify beginning/end anchors for each path
  * Add egrep -v checks to make sure we don't have any *additional* paths
  * Ratchet down paths2 to exactly the two paths we expect to appear

Reviewed by:	ngie
Differential Revision:	https://reviews.freebsd.org/D27984
2021-01-07 16:37:28 -06:00
Kyle Evans
4832d2e8ae du: tests: fix the H_flag test (primarily grep usage)
This test attempts to use \t (tab intended) in a grep expression.  With the
former /usr/bin/grep (i.e. gnugrep), this was interpreted as a literal 't'.
The expression would work anyways because the tr(1) usage would ultimately
replace all of the spaces with a single newline, and they would match the
paths whether they were correctly fromatted or not.

Current /usr/bin/grep (i.e. bsdgrep) is less-tolerant of ordinary-escapes, a
property of the underlying regex(3) engine, to make it easier to identify
when stuff like this happens. In-fact, this expression broke after the
switch happened.

This revision does the bare basics to fix the usage by using a printf to get
a literal tab character to insert into the expression. It also swaps out the
manual insertion of the line prefix into the grep expression by pulling
that part out of $sep and reusing it for the leading path.

The secondary issue was the tr(1) usage, since tr would only replace the
first character of string1 with the first character of string2.  This has
instead been replaced by a sed expression, which similary understands \n to
be a newline on all supported versions of FreeBSD.  Each path now gets
prefixed with the appropriate context that should be there (i.e. numeric
sequence followed by a tab).

PR:		252446
Reviewed by:	emaste, ngie
Differential Revision:	https://reviews.freebsd.org/D27983
2021-01-07 16:36:31 -06:00
Alex Richardson
7fa2f2a62f Rename NO_WERROR -> MK_WERROR=no
As suggested in D27598. This also supports MK_WERROR.clang=no and
MK_WERROR.gcc=no to support the existing NO_WERROR.<compiler> uses.

Reviewed By:	brooks
Differential Revision: https://reviews.freebsd.org/D27601
2021-01-07 09:31:03 +00:00
Alex Richardson
fe41c64b57 Fix -Wpointer-sign warnings in makefs and mkimg
Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D27175
2021-01-07 09:26:21 +00:00
Mateusz Piotrowski
d41149a8e9 Add some examples to script.1
While here:

- Split synopsis into two parts. The first explains how to record
  sessions, while the second one explains how to replay (some of)
  the recorded sessions.
- Fix the -width argument of the environment variables list.

MFC after:	1 week
2021-01-05 16:32:27 +01:00
Mateusz Piotrowski
225afb6cad Improve readability of the options list
MFC after:	3 days
2021-01-05 15:46:56 +01:00
Emmanuel Vadot
066a8c691e pkgbase: Install atf and kyua in the tests package
While here make sure that all tests dirs are taggued correctly.

Reviewed by:	bapt, emaste
Differential Revision:	https://reviews.freebsd.org/D27714
2021-01-04 16:20:47 +01:00
Gordon Bergling
c949ba1d20 fortune(6): Add EXIT STATUS and HISTORY sections
Obtained from:	OpenBSD
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D27941
2021-01-03 23:51:39 +01:00
Yoshihiro Takahashi
0cdfa49564 unzip: Sync with NetBSD upstream.
- Ignore malformed directory entries as created by Dropbox ("/").
  (rev 1.24)
- Use libarchive 3.x interface: check result for archive_read_free()
  and don't call archive_read_close manually. (rev 1.23)
- Always overwrite symlinks on extraction, ever if they're newer than
  entries in archive.
- Use getline() rather than getdelim().

PR:		231827
Submitted by:	ak
Reviewed by:	mm
Obtained from:	NetBSD
MFC after:	2 weeks
2021-01-02 10:50:08 +09:00
Stefan Eßer
a3c29cdbd4 Replace strcat, strcpy and snprintf with bounds checking versions 2020-12-31 12:37:37 +01:00
Alexander Motin
ccdd2b2b3c Add "-n" flag to sockstat.
sockstat can "hang" on getpwuid() calls in situations when FreeBSD
is joined to a directory service (AD/LDAP etc) and the directory
service fail to answer in a timely manner when trying to resolve
numeric UIDs to user names.

Submitted by:	Caleb St. John <caleb@ixsystems.com>
MFC after:	1 week
2020-12-30 13:45:53 -05:00
Stefan Eßer
e163cae76e Make calendarhome buffer static
the value may be used in error messages after leaving this function.
2020-12-30 13:44:33 +01:00
Xin LI
2ff66a9155 bsdcat,cpio,tar: derive version string from archive.h
Reviewed by:	mm
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D27823
2020-12-29 14:21:50 -08:00
Fernando Apesteguía
f3f16c31fe look(1): Add EXAMPLES section
Add two simple examples. In this case I opted to show a small portion of
the output since it helps to understand what the tool does. It shows the use
of the -t flag too.

PR:
Submitted by:
Reported by:
Reviewed by:	gbe@
Approved by:	manpages (bcr@)
Obtained from:
MFC after:
MFH:
Relnotes:
Security:
Sponsored by:
Differential Revision:	https://reviews.freebsd.org/D27543
2020-12-29 21:48:12 +01:00
Fernando Apesteguía
0ce6e534d3 lsvfs(1): Add EXAMPLES section
Add one simple exapmle and contrast some of the information using mount(8)

PR:
Submitted by:
Reported by:
Reviewed by:	gbe@, yuripv@
Approved by:	manpages (bcr@)
Obtained from:
MFC after:
MFH:
Relnotes:
Security:
Sponsored by:
Differential Revision:	https://reviews.freebsd.org/D27544
2020-12-29 21:35:24 +01:00
Martin Matuska
70a567c2c3 bsdcat,cpio,tar: Bump version number to 3.5.1
Matches import of libarchive 3.5.1
2020-12-28 00:37:06 +01:00
Stefan Eßer
dbb25cbe55 Adjust to display more than 999 sleeping threads 2020-12-27 22:32:22 +01:00
Stefan Eßer
6fe8fbdc1c Statistics are for threads, not processes 2020-12-27 22:32:22 +01:00
Konstantin Belousov
67af9aba6b Decode and report native eventfd descriptors from libprocstat and procstat.
Submitted by:   greg@unrelenting.technology
Reviewed by:    markj (previous version)
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D26668
2020-12-27 12:57:27 +02:00
Ed Maste
9bc6c7219a gprof: Retire a.out support
FreeBSD has used ELF binaries/libraries for decades, but still has some
support for legacy a.out binaries.  Portions of this have been retired
over time, but support remained in ldd, ldconfig, and gprof.

Retire gprof support; if anyone needs to do development on a.out
binaries still they will be best served by installing a full FreeBSD 2.x
or other obsolete version in a jail.

Kernel support for executing a.out binaries is unchnaged.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D27480
2020-12-26 11:47:47 -05:00
Kyle Evans
d1c965f143 grep: tests: stop testing for a nonexistent version of grep
Differential Revision:	https://reviews.freebsd.org/D27732
2020-12-25 15:16:33 -06:00
Kyle Evans
8aff76fb37 build: remove the option to build gnugrep
Unconditionally install bsdgrep as grep, bootstrap or not. Remove all
build glue and stop installing both gnugrep and libgnuregex now that
all consumers of the latter are gone.

Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D27732
2020-12-25 15:14:17 -06:00
Gordon Bergling
a2f1c81b28 patch(1): Fix a few mandoc related issues
- no blank before trailing delimiter

MFC after:	1 week
2020-12-19 13:00:17 +00:00
Gordon Bergling
3f6cdd59fe uname(1): Fix a typo in the man page date
MFC after:	3 days
2020-12-19 12:55:27 +00:00
Gordon Bergling
a5b4dfcfbc ident(1): Normalizing date format
MFC after:	3 days
2020-12-19 12:54:00 +00:00
Pedro F. Giffuni
dcc6f62526 login(1): when exporting variables check the result of setenv(3)
When exporting a variable we correctly check all the preconditions that
could make setenv(3) fail. Checking the setenv(3) return value seems
redundant, but given that login(1) is critical, it doesn't hurt to have
a post-check.

This change is based on the "Principles of Secure Coding" course by
Matthew Bishop, PhD., which specifically discusses this code in FreeBSD.

(This change redoes r368776 due to a silly mistake)
2020-12-19 03:07:38 +00:00
Pedro F. Giffuni
a0bed90198 Revert r368776:
login(1): when exporting variables check the result of setenv(3)

mismatch: the return value upon error is -1, so the code was not
doing nothing.
2020-12-19 02:42:14 +00:00
Pedro F. Giffuni
ebb4fcc7cf login(1): when exporting variables check the result of setenv(3)
When exporting a variable we correctly check all the preconditions that
could make setenv(3) fail. Checking the setenv(3) return value seems
redundant, but given that login(1) is critical, it doesn't hurt to have
a post-check.

This change is based on the "Principles of Secure Coding" course by
Matthew Bishop, PhD., which specifically discusses this code in FreeBSD.

Differential Revision:	https://reviews.freebsd.org/D26966
2020-12-19 02:23:53 +00:00
Konstantin Belousov
673e2dd652 Add ELF flag to disable ASLR stack gap.
Also centralize and unify checks to enable ASLR stack gap in a new
helper exec_stackgap().

PR:	239873
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2020-12-18 23:14:39 +00:00
Emmanuel Vadot
395cb8fbc0 kyua: Only install examples if requested
Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D27638
2020-12-17 17:06:57 +00:00
Juraj Lutter
7bd0c4c47d Complete steps 5 and 9 from Committer's guide
Reviewed by:		osa (mentor)
Approved by:		osa (mentor)
Differential Revision:	https://reviews.freebsd.org/D27632
2020-12-16 16:59:52 +00:00
Stefan Eßer
d87cb51f56 Fix WITHOUT_ICONV build
Move the include of langinfo.h out of the WITH_ICONV condition block,
since it is not dependent on ICONV. This was correct when nl_langinfo()
had only been called in the WITH_ICONV case, but that is no longer the
case.

Submitted by:	yuripv
2020-12-13 19:06:59 +00:00
Stefan Eßer
8a428dfecb Revert r368606
The issue will be fixed in a different way.

Reported by:	yuripv
2020-12-13 19:03:38 +00:00
Stefan Eßer
c6e0073a42 Fix WITHOUT_ICONV build
There was an unprotected use of nl_langinfo() to determine the order of
day vs. month in the generated output.

When building without ICONV support, the order will be: month, day.
2020-12-13 09:38:50 +00:00
Yuri Pankov
0d2dcf2166 xargs: compile yesexpr as ERE
yesexpr is an extended regular expression for quite some time now,
use appropriate flag when compiling it.

PR:		238762
Reviewed by:	kevans
Differential Revision:	https://reviews.freebsd.org/D27509
2020-12-12 15:38:32 +00:00
Stefan Eßer
6f139d796f Use getlocalbase() instead of compiled in LOCALBASE to locate calendars 2020-12-12 11:51:29 +00:00
Fernando Apesteguía
c06f992b02 lock(1): Add EXAMPLES section
Add simple example showing the use of the flags: p, t, v

Reviewed by:	gbe@, yuripv@
Approved by:	manpages (yuripv@)
Differential Revision:		https://reviews.freebsd.org/D27541
2020-12-11 19:27:21 +00:00
Stefan Eßer
580a173a05 Install 2 forgotten shell scripts required to run the tests
Submitted by:		arichardson (Alexander Richardson)
Differential Revision:	https://reviews.freebsd.org/D27568
2020-12-11 13:23:59 +00:00
Guangyuan Yang
92b959f120 Fix a grammar error on locate(1).
While here, also fix a useless .Tn reported by mandoc.

PR:		251746
MFC after:	1 week
Sumbitted by:	David Schlachter <fbsd-bugzilla@schlachter.ca>
2020-12-11 08:04:54 +00:00
Kenneth D. Merry
78adacd4ea Add the LTO-9 density code to libmt and the mt(1) man page.
These values are taken directly from the density report from an
IBM LTO-9 tape drive.  (Using mt getdensity)

A LTO-9 drive stores 18TB raw (45TB with compression) on an LTO-9 tape.

lib/libmt/mtlib.c:
        Add the LTO-9 density code, and bpmm/bpi values.

usr.bin/mt/mt.1:
        Add the LTO-9 density code, bpmm/bpi values and number of
	tracks.  Bump the man page date.

MFC after:	3 days
Sponsored by:	Spectra Logic
2020-12-10 21:06:06 +00:00
Fernando Apesteguía
97c8162543 id(1): Add EXAMPLES section
Add some examples covering the flags: G, n, P, p, u

Add reference to groups(1)

Approved by:	manpages (gbe@)
Differential Revision:		https://reviews.freebsd.org/D27539
2020-12-10 18:34:15 +00:00
Fernando Apesteguía
fc89b27576 groups(1): Add EXAMPLE
Add a super simple example

Approved by:	manpages (gbe@)
Differential Revision:		https://reviews.freebsd.org/D27538
2020-12-10 17:48:34 +00:00
Thomas Munro
bb24ee2b7e truss: Add AIO syscalls.
Display the arguments of aio_read(2), aio_write(2), aio_suspend(2),
aio_error(2), aio_return(2), aio_cancel(2), aio_fsync(2), aio_mlock(2),
aio_waitcomplete(2) and lio_listio(2) in human-readable form.

Reviewed by:	asomers
Differential Revision:	https://reviews.freebsd.org/D27518
2020-12-10 07:13:15 +00:00
Kyle Evans
df546c3b73 grep: replace the internal queue with a ring buffer
We know up front how many items we can have in the queue (-B/Bflag), so
pay the cost of those particular allocations early on.

The reduced queue maintenance overhead seemed to yield about an ~8%
improvement for my earlier `grep -C8 -r closefrom .` test.

MFC after:	2 weeks
2020-12-09 05:27:45 +00:00
Kyle Evans
281412ce7b grep: tests: stop expecting a failure of gnuext w/ bsdgrep
libregex now supports these and we no longer offer to not link against
libregex.
2020-12-09 05:12:04 +00:00
Kyle Evans
c2679dd779 kdump/truss: decode new _umtx_op flags
In both cases, print the flag bits first followed by the command.

Output now looks something like this:

(ktrace)
_umtx_op(0x8605f7008,0xf<UMTX_OP_WAIT_UINT_PRIVATE>,0,0,0)
_umtx_op(0x9fffdce8,0x80000003<UMTX_OP__32BIT|UMTX_OP_WAKE>,0x1,0,0)

(truss)
_umtx_op(0x7fffffffda50,UMTX_OP_WAKE,0x1,0x0,0x0) = 0 (0x0)
_umtx_op(0x9fffdd08,UMTX_OP__32BIT|UMTX_OP_WAKE,0x1,0x0,0x0) = 0 (0x0)

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D27325
2020-12-09 03:24:09 +00:00
Bryan Drewery
2dfa4b66b3 fts_read: Handle error from a NULL return better.
This is addressing cases such as fts_read(3) encountering an [EIO]
from fchdir(2) when FTS_NOCHDIR is not set.  That would otherwise be
seen as a successful traversal in some of these cases while silently
discarding expected work.

As noted in r264201, fts_read() does not set errno to 0 on a successful
EOF so it needs to be set before calling it.  Otherwise we might see
a random error from one of the iterations.

gzip is ignoring most errors and could be improved separately.

Reviewed by:	vangyzen
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D27184
2020-12-08 23:38:26 +00:00
Kyle Evans
6e5a5dc03d bsdgrep: don't link against libregex for bootstrap
r368355 removed the GNU_GREP_COMPAT knob (off by default) and forgot that
bsdgrep may be built/used for bootstrap on some systems.

All base uses should strive to use only POSIX-compliant expressions anyways
and we haven't had libregex by default here up to this point, so just don't
do that if we're bootstrapping.

Note that the resulting binary has the wrong `grep -V` information as it
falsely claims to be GNU compatible, but it is only for bootstrap.

Reported by:	GitHub cross-builds via yuripv
2020-12-06 17:45:42 +00:00
Kyle Evans
7c2f310f6d Retire GNU_GREP_COMPAT knob
This was introduced and then disabled by default primarily to avoid dealing
with bugs in libgnuregex. rS363823 switched to using libregex for it, so
let's just rip the option out now so we can make sure we're getting tested
with libregex via bsdgrep.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D27476
2020-12-05 02:21:58 +00:00
Martin Matuska
c3afd20f13 MFV r368207:
Update libarchive to 3.5.0

Relevant vendor changes:
  Issue #1258: add archive_read_support_filter_by_code()
  PR #1347: mtree digest reader support
  Issue #1381: skip hardlinks pointing to itself on extraction
  PR #1387: fix writing of cpio archives with hardlinks without file type
  PR #1388: fix rdev field in cpio format for device nodes
  PR #1389: completed support for UTF-8 encoding conversion
  PR #1405: more formats in archive_read_support_format_by_code()
  PR #1408: fix uninitialized size in rar5_read_data
  PR #1409: system extended attribute support
  PR #1435: support for decompression of symbolic links in zipx archives
  Issue #1456: memory leak after unsuccessful archive_write_open_filename

MFC after:	1 week
2020-12-01 15:53:12 +00:00
Fernando Apesteguía
f2f1a2a0a0 iconv(1): Add EXAMPLE
Just a small example to show simple usage.

Approved by:	manpages (0mp@)
MFC after:	2 weeks
Differential Revision:		https://reviews.freebsd.org/D27385
2020-11-29 18:22:14 +00:00
Stefan Eßer
76810a9564 Make generated C files depend on this Makefile
The contents of lib.c, lib2.c, bc_help.c, and dc_help.c depends on the
parameters passed to strgen.sh in this Makefile. A change to the number
of parameters of strgen.sh has been applied to the invocation of this
command, but this did not cause a rebuild of the generated files.

Reported by:	Cy.Schubert@cschubert.com
2020-11-27 09:00:21 +00:00
Stefan Eßer
891bc22d39 Update Makefile for new version 3.2.0 2020-11-26 19:38:02 +00:00
Benedict Reuschling
6b8f0ba8e2 Drop superfluous "of" from the systat example. 2020-11-25 10:21:29 +00:00
John Baldwin
688f8b822c Remove the cloned file descriptors for /dev/crypto.
Crypto file descriptors were added in the original OCF import as a way
to provide per-open data (specifically the list of symmetric
sessions).  However, this gives a bit of a confusing API where one has
to open /dev/crypto and then invoke an ioctl to obtain a second file
descriptor.  This also does not match the API used with /dev/crypto on
other BSDs or with Linux's /dev/crypto driver.

Character devices have gained support for per-open data via cdevpriv
since OCF was imported, so use cdevpriv to simplify the userland API
by permitting ioctls directly on /dev/crypto descriptors.

To provide backwards compatibility, CRIOGET now opens another
/dev/crypto descriptor via kern_openat() rather than dup'ing the
existing file descriptor.  This preserves prior semantics in case
CRIOGET is invoked multiple times on a single file descriptor.

Reviewed by:	markj
Relnotes:	yes
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D27302
2020-11-25 00:10:54 +00:00
Michael Reifenberger
2717b998b2 Improve number reading by rounding up to a next unit earlier for memory display.
Submitted by:	ota@j.email.ne.jp
Differential Revision:	https://reviews.freebsd.org/D26503
2020-11-21 19:14:11 +00:00
Gordon Bergling
69109a4fbd iscsi.conf(5): Fix a mandoc warning
- new sentence, new line
2020-11-20 16:41:32 +00:00
Eugene Grosbein
1032f7b82b bzgrep: make flag --no-filename work
PR:		248813
MFC after:	1 week
2020-11-20 09:56:46 +00:00
Simon J. Gerraty
e2eeea75eb Merge bmake-20201117
o allow env var MAKE_OBJDIR_CHECK_WRITABLE=no to skip writable
  checks in InitObjdir.  Explicit .OBJDIR target always allows
  read-only directory.

o More code cleanup and refactoring.

o More unit tests

MFC after:	1 week
2020-11-20 06:02:31 +00:00
Fernando Apesteguía
7e9e52e7a7 fstat(1): Add EXAMPLES section
* Add examples covering -f, -m and -p flags.

While here, extend the initial description paragraph to note that fstat(1)
will report on all opened files, belonging to processes the user has access to.
The current paragraph may lead to understand that you can get information on
opened files from processes belonging to other users.

Reviewed by:	bjk@, danfe@, gbe@
Approved by:	manpages (gbe@)
Differential Revision:		https://reviews.freebsd.org/D26949
2020-11-19 19:05:16 +00:00
Fernando Apesteguía
5be3f744b4 grep(1): Add more EXAMPLES
* Add more EXAMPLES covering flags: -A, -B, -c, -f, -i, -H, -l, -q, -R, -w
* While here, change existing wording to use the imperative (remove "To
  find")
* Reword first example to be consistent with how grep(1) understand
  words (-w)

Approved by:	manpages (bcr@)
Differential Revision:		https://reviews.freebsd.org/D27264
2020-11-19 18:58:15 +00:00
Mateusz Piotrowski
c2364e5a41 Partially revert r367756 (chpass(1) synopsis changes)
Let's have two entries in the synopsis:
- chpass now lists options which can be used for non-NIS-specific
  functionalities.
- ypchpass additionally lists the NIS-specific flags.

Technically, it is an artificial distinction, as chpass and ypchpass behave
identically. Nevertheless, it might help navigating the synopsis section.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D27251
2020-11-17 16:54:12 +00:00
Mateusz Piotrowski
dda1987fe5 Add an example for the -s flag
MFC after:	2 weeks
2020-11-17 12:04:29 +00:00
Mateusz Piotrowski
303869edc7 Improve readability of the lists of options
- Sort options alphabetically
- Add missing arguments (e.g., "list" to -a)
- Adjust the width of Bl

MFC after:	1 week
2020-11-17 10:57:28 +00:00
Mateusz Piotrowski
c8f6f8e450 Clean up the synopsis section & fix mandoc warnings
The synopsis section had two very similar entries. The flags documented by
the first one were a strict subset of the second one. Let's just keep only
the second entry for simplicity.

MFC after:	1 week
2020-11-17 10:48:01 +00:00
Mitchell Horne
a521f21164 bsdiff: fix off-by-one error
The program reads oldsize bytes from oldfile, and proceeds to initialize
a suffix array of oldsize elements using divsufsort(). As per the
function's API [1], array indices 0 through n-1 are initialized.

Later, search() is called, but with index bounds [0, n]. Depending on
the contents of the malloc'd buffer, accessing this uninitialized index
at the end of can result in a segmentation fault. Fix this by passing
oldsize-1 to search(), limiting the search bounds to [0, n-1].

This bug is a result of r303285, which introduced divsufsort() as an
alternate suffix sorting function to the existing qsufsort(). It seems
that qsufsort() did initialize the final empty element, meaning it could
be safely accessed. This difference in the implementations was missed at
the time.

[1] https://github.com/y-256/libdivsufsort

Discussed with:	cperciva
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D26911
2020-11-16 18:41:49 +00:00
Baptiste Daroussin
09ef995baf Change the default locale to C.UTF-8
The C.UTF-8 locales is the same as the actual C locale except it does support
the unicode character set. But the collation etc are still the same as the C
locale one.

Reviewed by:	many
Approved by:	many
Differential Revision:	https://reviews.freebsd.org/D26973
2020-11-14 19:16:39 +00:00
Mateusz Piotrowski
ea09ac5275 Explicitly note in the EXAMPLES section that uname(3) contains more details
MFC after:	1 week
2020-11-13 14:48:37 +00:00
Mateusz Piotrowski
a4848c103c Document in the synopsis that -0 cannot be used with the utility argument 2020-11-11 14:53:03 +00:00
Mateusz Guzik
6fcc846b59 vmstat: drop the HighUse field from malloc dump
It is hardwired to "-" since its introduction in 2005.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D27141
2020-11-09 23:00:29 +00:00
Mateusz Guzik
b54ed68408 vmstat: remove spurious newlines when reporting zones 2020-11-09 00:05:45 +00:00
Thomas Munro
cc7edd258c Add collation version support to querylocale(3).
Provide a way to ask for an opaque version string for a locale_t, so
that potential changes in sort order can be detected.  Similar to
ICU's ucol_getVersion() and Windows' GetNLSVersionEx(), this API is
intended to allow databases to detect when text order-based indexes
might need to be rebuilt.

The CLDR version is extracted from CLDR source data by the Makefile
under tools/tools/locale, written into the machine-generated Makefile
under shared/colldef, passed to localedef -V, and then written into
LC_COLLATE file headers.  The initial version is 34.0.
tools/tools/locale was recently updated to pull down 35.0, but the
output hasn't been committed under share/colldef yet, so that will
provide the first observable change when it happens.  Other versioning
schemes are possible in future, because the format is unspecified.

Reviewed by:	bapt, 0mp, kib, yuripv (albeit a long time ago)
Differential Revision:	https://reviews.freebsd.org/D17166
2020-11-08 02:50:34 +00:00
Simon J. Gerraty
956e45f6fb Update to bmake-20201101
Lots of new unit-tests increase code coverage.

Lots of refactoring, cleanup and simlpification to reduce
code size.

Fixes for Bug 223564 and 245807

Updates to dirdeps.mk and meta2deps.py
2020-11-07 21:46:27 +00:00
Stefan Eßer
0357fa2632 Restrict locale settings to the file they occur in
This prevents LANG= in an included file from affecting the interpretation
of month and day names in the including file.

Make the internal pre-processor accept white space between the "#" at
the start of the line and the keyword for better compatibility with cpp.

Add support for the cpp keywords #warning and #error.

MFC after:	3 days
2020-11-05 08:58:21 +00:00
Stefan Eßer
2ceb17a8be Add regression tests for conditions and comments
Fix one case where #else was not corerctly processed and simplify the
conditions logic.

Fix parsing of day and month names in the locale specified in the calendar
file. The previous version would expect those names to match the locale of
the user.

Mention that comments are now correctly processed and that // is supported
in addition to /* ... */.

MFC after:	3 days
2020-11-04 22:29:01 +00:00
Stefan Eßer
321b3540eb Update man-page to document changes made to the calendar program.
MFC after:	3 days
2020-11-03 22:13:16 +00:00
Dimitry Andric
07bab4417d Add WITH_LLVM_CXXFILT option to install llvm-cxxfilt as c++filt
Since elftoolchain's cxxfilt is rather far behind on features, and we
ran into several bugs, add an option to use llvm-cxxfilt as an drop-in
replacement.

It supports the same options as elftoolchain cxxfilt, though it doesn't
have support for old ARM (C++ Annotated Reference Manual, not the CPU)
and GNU v2 manglings. But these are irrelevant in 2020.

Note: as we already compile the required libraries as part of libllvm,
this will not add any significant build time either.

PR:		250702
Reviewed by:	emaste, yuri
Differential Revision: https://reviews.freebsd.org/D27071
MFC after:	2 weeks
2020-11-03 19:57:28 +00:00
Stefan Eßer
f1560bd080 Consistently print calendar dates in the locale of the user
Calendar files that specify LANG=... to specify their character encoding did
also set the date format defined for that locale, resulting in output like:

Nov  4 	Gabriel Faure dies from pneumonia in Paris, France, 1924
 4 nov. 	N'oubliez pas les Charles !

After this commit the output is always printed in a consistent format
according to the user's current locale, e.g.:

Nov  4 	Gabriel Faure dies from pneumonia in Paris, France, 1924
Nov  4 	N'oubliez pas les Charles !

I'll open a review asking for opinions whether this format change should
be merged to -STABLE.

Relnotes:	yes
2020-11-03 12:15:08 +00:00
Stefan Eßer
cc9fbfafbe Check that #ifdef, #ifndef, and #undef are used with a single name
This restores the parameter validation that has been peformed by cpp
for defining and testing of names used in conditions.

MFC after:	3 days
2020-11-03 11:37:19 +00:00
Mateusz Guzik
828afdda17 malloc: export kernel zones instead of relying on them being power-of-2
Reviewed by:	markj (previous version)
Differential Revision:	https://reviews.freebsd.org/D27026
2020-11-02 17:38:08 +00:00
Stefan Eßer
ab34af0746 Fix psoition reporting for calendar data file in system directory
MFC after:	3 days
2020-11-01 20:38:35 +00:00
Adrian Chadd
c2a5b2abc7 [iscsictl] Fix compile issues that creep up with gcc-6.4
This fixes two warnings:

* double-definition of a symbol in a yacc header
* Comparison of an unsigned int being >= 0; that's always
  going to be true.

Reviewed by:	imp, rscheff
Differential Revision:	https://reviews.freebsd.org/D27036
2020-11-01 15:57:14 +00:00
Ed Maste
e128bd0ff9 readelf: Add -z decompression support
Compatible with GNU readelf, -z decompresses sections displayed by
-x or -p.

ELF Tool Chain ticket #555
https://sourceforge.net/p/elftoolchain/tickets/555/

Submitted by:	Tiger Gao <tig@FreeBSDFoundation.org>
Reviewed by:	markj
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:    https://reviews.freebsd.org/D26909
2020-10-31 15:27:45 +00:00
Stefan Eßer
8e8c5da47f Improve calendar file parsing and consistency tests
Add line number information to more warning and error messages.
Detect #else and #endif without corresponing #ifdef/#ifndef as error.
Detect missing #endif at end of file and print warning but continue.

Support for #undef has been added to reverse the effect of a prior #define.
It is no error if the argument value has not been defined before.

These changes may cause error aborts on malformed input files (e.g. with
spurious #else or #endif), but no such errors exist in the calendar files
in the FreeBSD base system and the calendar-data port and all tests pass.

More tests will be added in a follow-up commit to detect regressions that
might affect the newly added features.

This commit ends a series of updates that enhance the pre-processor and
make it behave much more like prior versions of the calendar progarm that
called cpp to pre-process the data files.

MFC after:	3 days
Relnotes:	yes
2020-10-31 15:11:24 +00:00
Stefan Eßer
6688708624 Add file names and line numbers to debug messages
MFC after:	3 days
2020-10-31 13:55:10 +00:00
Stefan Eßer
1462201cd5 Add file names and line numbers to calendar format error messages
Without file name and line number it is very cumbersum to identify the
locations of errors in calendar files.

MFC after:	3 days
2020-10-31 13:32:08 +00:00
Stefan Eßer
ddad3a3875 Print calendar entries in the order they occur
The calendar program used to output entries in reverse order, due to the
way an internal linked list was built up.

A regression test with 2 entries for the same day has been adapted to the
now non-reversed order.

MFC after:	3 days
2020-10-30 15:43:52 +00:00
Stefan Eßer
cb895863ac Revert debug output committed in r367166 by accident
MFC after:	3 days
2020-10-30 14:34:51 +00:00
Stefan Eßer
6bdb89a898 Fix length calculation in memmove
MFC after:	3 days
2020-10-30 14:32:13 +00:00
Stefan Eßer
0f352f4e25 Re-implement comment parsing missing in the internal pre-processor
The internal pre-processor ignored lines that did not parse a calendar
entries, but did not support multi-line comments in the way the external
cpp did.

The calendar files distributed with the base system (now in a port) do
use comments, though.

Implement comment processing for single-line (//) and multi-line comments
(/* */) with same semantics as in a standard C pre-processor.

All tests pass with this version, but there are no tests that specifically
verify comment processing.

Reported by:	jhs@berklix.com (Julian H. Stacey)
MFC after:	3 days
2020-10-30 10:44:46 +00:00
Fernando Apesteguía
86e149e16e fetch(1): Fix style
Fix style problems introduced in r367141:

* s/Ql/Pa/ for file names
* Break line properly in macro
* Properly generate back slash character

Not bumping .Dd

Reported by:	xtouqh@icloud.com, steffen@sdaoden.eu
Approved by:	0mp@
Differential Revision:		https://reviews.freebsd.org/D26946
2020-10-30 09:48:41 +00:00
Fernando Apesteguía
b139a8fa79 fold(1): Add EXAMPLES section
A couple of examples covering -s and -w flags.

Approved by:	manpages (bcr@)
Differential Revision:		https://reviews.freebsd.org/D26948
2020-10-29 18:39:04 +00:00
Fernando Apesteguía
22d3f87c80 fmt(1): Add EXAMPLES section
Very small EXAMPLES section.

While here, remove reference to nroff(1).

Approved by:	manpages (bcr@)
Differential Revision:		https://reviews.freebsd.org/D26947
2020-10-29 18:37:20 +00:00
Fernando Apesteguía
538d212d13 fetch(1): Add EXAMPLES section
Add a few examples covering flags: 1, R, a, o, q, r, s, v

Approved by:	manpages (bcr@)
Differential Revision:		https://reviews.freebsd.org/D26946
2020-10-29 18:34:47 +00:00
Li-Wen Hsu
80d8e42662 Update the due date of the quarterly status report
While here, move the date to keep 2 weeks ahead notificaion
and fix the part of speech.

Reviewed by:	debdrup
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D26998
2020-10-29 14:21:25 +00:00
Stefan Eßer
ac04cf18bb Simplify test for closing delimiter of #include argument (no functional
change).

While here: Fix invalid parameters of a commented-out debug printf() found
when testing with this code enabled.

MFC after:	3 days
2020-10-29 08:31:47 +00:00
Stefan Eßer
3fa2a149d6 Fix calendar -a processing of files included in the user's home directory
The existing code performed a chdir() into the home directory, but the
parser fell back to using the invoking user's home directory as the base
directory for the search for an include file.

Since use of the -a option is limited to UID==0, the directory searched
was typically ~root/.calendar, not the .calendar directory of the user
whose file is being processed.

PR:		205580
Reported by:	greg.bal4@gmail.com (Greg Balfour)
MFC after:	3 days
2020-10-29 08:26:38 +00:00
Mateusz Piotrowski
e4c79332a0 Update the list of searched manual sections after r367013 2020-10-28 16:54:37 +00:00
Stefan Eßer
19b5c30754 Add support for nested conditionals
The previous behavior was to support nested #ifdef and #ifndef, but to
return to unconditional parsing after the next #endif, independently of
the number of previously parsed conditions.

E.g. after "#ifdef A / #ifdef B / #endif" the following lines were
unconditially parsed again, independently of A and/or B being defined.

The new behavior is to count the level of false conditions and to only
restart parsing of calendar entries when the corresponding number of
#endif tokens have been seen.

In addition to the above, an #else directive has been added, to toggle
between parsing and ignoring of the following lines.

No validation of the correct use of the condition directives is made.
#endif without prior #define or #ifndef is ignored and #else toggles
between parsing and skipping of entries.

The MFC period has been set to 1 month to allow for a review of the
changes and for a discussion, whether these modifications should not
be merged at all.

No correct input file is parsed differently than before, but if calendar
data files are published that use these new features, those data files
will not parse correctly on prior versions of this program.

MFC after:	1 month
2020-10-28 14:48:58 +00:00
Edward Tomasz Napierala
bce7ee9d41 Drop "All rights reserved" from all my stuff. This includes
Foundation copyrights, approved by emaste@.  It does not include
files which carry other people's copyrights; if you're one
of those people, feel free to make similar change.

Reviewed by:	emaste, imp, gbe (manpages)
Differential Revision:	https://reviews.freebsd.org/D26980
2020-10-28 13:46:11 +00:00
Stefan Eßer
e0e29f9425 Fix off-by-one error in processing of #ifdef lines
The convention in this program is to parse the line immediately starting
after the token (e.g. #defineA and #ifdefA define respectively look-up "A"),
and this commit restores this behavior instead of skipping an assumed
white-space character following #ifdef.

Reported by:	kevans
MFC after:	3 days
2020-10-28 13:30:24 +00:00
Stefan Eßer
2939897921 Fix parsing of #ifdef in calendar files
There was code to process an #ifndef tokens, but none for #ifdef.
The #ifdef token was mentioned as unsupported in the BUGS section,
but no reason was given and I do not see why it should stay omitted.

Misleading information in The BUGS section of the man-page regarding
the maximum number of #define and #include statements supported has
been removed. These limits might have applied to a prior version of
this program, but do not seem to apply to the current implementation.

I have not tried to test for the existence of the limits, but the
include file processing just recursively calls the parser (without
counting the recursion depth) and the stringlist functions do not
impose a limit on the number of entries.

Reported by:	jhs@berklix.com
MFC after:	3 days
2020-10-28 13:06:39 +00:00
Mateusz Piotrowski
6453a246f4 Correct USB HID item in examples
It turns out that examples were incorrectly referring to Volume_Up
and Volume_Down, which are not defined at all.

PR:		250683
Reported by:	corvid%openmailbox.org
MFC after:	2 weeks
2020-10-28 08:29:31 +00:00
Fernando Apesteguía
f8ae041a04 renice(8): Clarify "who" parameters.
There was a question raised in freebsd-questions@ mail list[1] about the
"who" parameters in this man page. It seems OpenBSD[2] amd NetBSD[3]
both have more legible descriptions so I borrowed some of their ideas to try
and make this page clearer.

[1] https://lists.freebsd.org/pipermail/freebsd-questions/2020-October/291914.html
[2] https://man.bsd.lv/renice
[3] https://man.netbsd.org/renice.8

Approved by:	manpages (bcr@)
Differential Revision:		https://reviews.freebsd.org/D26950
2020-10-27 12:32:17 +00:00
Kyle Evans
b0d30b27f0 diff: don't force the format to 'context' with -p immediately
Instead, leave the fomat as unspecified (if it hasn't been) and use the
-p flag as a hint to 'context' if no other formatting option is specified.

This fixes `diff -purw`, used frequently by emaste, and matches the behavior
of its GNU counterpart.

PR:		250015
Reviewed by:	emaste
MFC after:	1 week
2020-10-27 12:27:26 +00:00
Stefan Eßer
1f474190fc Replace literal uses of /usr/local in C sources with _PATH_LOCALBASE
Literal references to /usr/local exist in a large number of files in
the FreeBSD base system. Many are in contributed software, in configuration
files, or in the documentation, but 19 uses have been identified in C
source files or headers outside the contrib and sys/contrib directories.

This commit makes it possible to set _PATH_LOCALBASE in paths.h to use
a different prefix for locally installed software.

In order to avoid changes to openssh source files, LOCALBASE is passed to
the build via Makefiles under src/secure. While _PATH_LOCALBASE could have
been used here, there is precedent in the construction of the path used to
a xauth program which depends on the LOCALBASE value passed on the compiler
command line to select a non-default directory.

This could be changed in a later commit to make the openssh build
consistently use _PATH_LOCALBASE. It is considered out-of-scope for this
commit.

Reviewed by:	imp
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D26942
2020-10-27 11:29:11 +00:00
Mateusz Piotrowski
790c70c825 Clean up backlight.8
- Sort flags
- Stylize incr|+ and decr|- properly
- Add a missing period at the end of the description
- Use the standard layout for the EXAMPLES section (remove the list macro
  and add indentation to the code block)
2020-10-27 09:41:01 +00:00
Scott Long
2586d44d14 Correct calendar entry for myself 2020-10-26 05:22:52 +00:00
Warner Losh
d20d655018 calendar: remove all datafiles except freebsd one
Move all the data files for the calendar(1) program, except
calendar.freebsd to the calendar-data package. When a file
can't be found, and /usr/local/share/calendar doesn't exist
provide a helpful hint to install this package.

Reviewed by: se@
Differential Revision:  https://reviews.freebsd.org/D26926
2020-10-26 03:26:18 +00:00
Mateusz Piotrowski
50f7cdf21c calendar.1: Fix locale of the month in Dd ;) 2020-10-25 16:01:03 +00:00
Ryan Moeller
ae37905b93 sockstat: Fix error message when jail_attach fails
jail_errmsg is for libjail, jail_attach() is a system call.
2020-10-24 22:36:20 +00:00
Richard Scheffenegger
4dfbcffbb9 Add network QoS support for PCP to iscsi initiator.
Make the Ethernet PCP codepoint configurable
for L2 local traffic, to allow lower latency for
iSCSI block IO. This addresses the initiator
side only.

Reviewed by:	mav, trasz, bcr
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D26739
2020-10-24 21:07:13 +00:00
Ryan Moeller
73577bf01d flua: Add a libjail module
libjail is pretty small, so it makes for a good proof of concept demonstrating
how a system library can be wrapped to create a loadable Lua module for flua.

* Introduce 3lua section for man pages
* Add libjail module

Reviewed by:	kevans, manpages
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D26080
2020-10-24 17:08:59 +00:00
Fernando Apesteguía
f7585b288b getent(1): Add EXAMPLES section
Add 3 small examples to the EXAMPLES section.

Approved by:	manpages (gbe@)
Differential Revision:		https://reviews.freebsd.org/D26866
2020-10-24 16:40:34 +00:00
Alan Somers
b3baff23fe nfsstat: delete unused fields
Ever since r192762 nfsstat has included a few fields whose values were
always 0. They were copied from OpenBSD, but have never been used on
FreeBSD. Don't display them.

Reviewed by:	rmacklem
Sponsored by:	Axcient
Differential Revision:	https://reviews.freebsd.org/D26920
2020-10-24 05:52:29 +00:00
Stefan Eßer
c77b04884c Udpate calendar man-page to mention the search path added in r366962.
Calendar files in /usr/lcoal/share/calendar take precedence over files in
the base system. They can be provided by a port or package, but since such
a port has not been committed, yet, no specific port name is suggested.

In fact, multiple ports could exist (e.g. per locale) without conflicting
with each other.
2020-10-23 10:00:56 +00:00
Stefan Eßer
34b38e1245 Add search of LOCALBASE/share/calendar for calendars supplied by a port.
Calendar files in LOCALBASE override similarily named ones in the base
system. This could easily be changed if the base system calendars should
have precedence, but it could lead to a violation of POLA since then the
port's files were ignored unless those in base have been deleted.

There was no definition of _PATH_LOCALBASE in paths.h, but verbatim uses
of /usr/local existed for _PATH_DEFPATH. Use _PATH_LOCALBASE here to ease
a consistent modification of this prefix.

Reviewed by:	imp, pfg
Differential Revision:	https://reviews.freebsd.org/D26882
2020-10-23 09:22:23 +00:00
Fernando Apesteguía
8a27a63745 col(1): Add EXAMPLES section
Add a small example.
Cross reference clean up for colcrt, nroff and tbl.

Reviewed by:	gbe@, bcr@
Approved by:	gbe@
Differential Revision:		https://reviews.freebsd.org/D26864
2020-10-21 16:30:34 +00:00
Fernando Apesteguía
ea772485d1 compress(1): Add EXAMPLES section
Add 5 examples showing basic usage.

Approved by:	manpages (gbe@)
Differential Revision:		https://reviews.freebsd.org/D26865
2020-10-20 13:05:25 +00:00
Mark Johnston
4caea9b169 icmp6: Count packets dropped due to an invalid hop limit
Pad the icmp6stat structure so that we can add more counters in the
future without breaking compatibility again, last done in r358620.
Annotate the rarely executed error paths with __predict_false while
here.

Reviewed by:	bz, melifaro
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D26578
2020-10-19 17:07:19 +00:00
Warner Losh
618cdd8964 Add more explicit instructions about updating motd
Not that you can regenerate the motd by editing motd.template and
running 'service motd restart' rather than rebooting.

Small wordsmithing by me, and updated the example from FreeBSD 2.1.6.1
release to 12.1 release.

Submitted by: Dan Mack
2020-10-19 01:16:39 +00:00
Alex Richardson
3ac62888fc Significantly speed up mkimg_test
It turns out that the majority of the test time for the mkimg tests isn't
mkimg itself but rather the use of jot and hexdump which can be quite slow
on emulated platforms such as QEMU.

On QEMU-RISC-V this reduces the time for `kyua test mkimg_test` from 655
seconds to 200. And for CheriBSD on QEMU-CHERI this saves 4-5 hours (25%
of the time for the entire testsuite!) since jot ends up triggering slow
functions inside the QEMU emulation a lot.

Reviewed By:	lwhsu
Differential Revision: https://reviews.freebsd.org/D26796
2020-10-18 18:35:23 +00:00
Greg Lehey
bce7d45450 Correct location and date of the Boston Shoemakers' organization,
which significantly predated the USA.

Reference: http://www.famousdaily.com/history/boston-shoemakers-form-first-us-labor-organization.html
2020-10-18 03:01:26 +00:00
Alex Richardson
6e4162c60c install(1): Avoid unncessary fstatfs() calls and use mmap() based on size
According to git blame the trymmap() function was added in 1996 to skip
mmap() calls for NFS file systems. However, nowadays mmap() should be
perfectly safe even on NFS. Importantly, onl ufs and cd9660 file systems
were whitelisted so we don't use mmap() on ZFS. It also prevents the use
of mmap() when bootstrapping from macOS/Linux since on those systems the
trymmap() function was always returning zero due to the missing MFSNAMELEN
define.

This change keeps the trymmap() function but changes it to check whether
using mmap() can reduce the number of system calls that are required.
Using mmap() only reduces the number of system calls if we need multiple read()
syscalls, i.e. if the file size is > MAXBSIZE. However, mmap() is more expensive
than read() so this sets the threshold at 4 fewer syscalls. Additionally, for
larger file size mmap() can significantly increase the number of page faults,
so avoid it in that case.

It's unclear whether using mmap() is ever faster than a read with an appropriate
buffer size, but this change at least removes two unnecessary system calls
for every file that is installed.

Reviewed By:	markj
Differential Revision: https://reviews.freebsd.org/D26041
2020-10-14 12:28:41 +00:00
Gordon Bergling
4c3191b2d1 cpuset(1): Fix a typo
- 'at at' -> 'at a'

MFC after:	1 week
2020-10-10 13:01:04 +00:00
Gordon Bergling
3d265fce43 Fix a few mandoc issues
- skipping paragraph macro: Pp after Sh
- sections out of conventional order: Sh EXAMPLES
- whitespace at end of input line
- normalizing date format
2020-10-09 19:12:44 +00:00
Mark Johnston
6b43126f81 col(1): Fix a couple of bugs
- When flushing extra lines after all input has been processed, make
  sure that local state is reinitialized correctly.
- When -f is specified, make sure to end output with a full newline.
- Fix some style issues and update comments.
- Add some regression tests.

PR:		249308
Submitted by:	Yang Zhong <yzhong@freebsdfoundation.org>
MFC after:	3 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D26536
2020-10-09 15:27:37 +00:00
Richard Scheffenegger
bfabdade5c Add DSCP support for network QoS to iscsi initiator.
Allow the DSCP codepoint also to be configurable
for the traffic in the direction from the initiator
to the target, such that writes and any requests
are also treated in the appropriate QoS class.

Reviewed by:	mav
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D26714
2020-10-09 14:33:09 +00:00
Gordon Bergling
6d6d6c3603 Fix a few mandoc issues
- no blank before trailing delimiter
- whitespace at end of input line
- sections out of conventional order
- normalizing date format
- AUTHORS section without An macro
2020-10-09 14:03:45 +00:00
Andrey V. Elsukov
39aff95fe2 Fix EINVAL message when CPU binding information is requested for IRQ.
`cpuset -g -x N` along with requested information always prints
message `cpuset: getdomain: Invalid argument'. The EINVAL is returned
from kern_cpuset_getdomain(), since it doesn't expect CPU_LEVEL_WHICH
and CPU_WHICH_IRQ parameters.

To fix the error, do not call cpuset_getdomain() when `-x' is specified.

MFC after:	1 week
2020-10-09 11:24:19 +00:00
Richard Scheffenegger
0e5e35e322 Extend netstat to display TCP stack and detailed congestion state
Adding the "-c" option used to show detailed per-connection
congestion control state for TCP sessions.

This is one summary patch, which adds the relevant variables into
xtcpcb. As previous "spare" space is used, these changes are ABI
compatible.

Reviewed by:	tuexen
MFC after:	2 weeks
Sponsored by:	NetApp, Inc.
Differential Revision:	https://reviews.freebsd.org/D26518
2020-10-09 10:07:41 +00:00
Fernando Apesteguía
d643ff21f4 ul(1): Remove references to colcrt(1) and nroff(1)
colcrt(1) and nroff(1) where removed in r319664.
Remove references to these commands in ul(1) man page.

PR:	244127
Reported by:	freebsd@tim.thechases.com
Approved by:	manpages (gbe@)
Differential Revision:	https://reviews.freebsd.org/D2614
2020-10-07 14:43:16 +00:00
Baptiste Daroussin
cf64bfef77 backlight: check the lenght if the input before trimming '%'
Reported by:	hps
Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D26693
2020-10-06 08:18:09 +00:00
Baptiste Daroussin
4d1308f49b backlight: accept '%' in the brightness input value
Improve friendlyness of the command line by accepting the percent brightness
in both format: with or without a trailing '%'

Reviewed by:	manu
Differential Revision:	https://reviews.freebsd.org/D26692
2020-10-06 08:05:19 +00:00
Ryan Moeller
92e17803cd Enable iterating all sysctls, even ones with CTLFLAG_SKIP
Add an "nextnoskip" sysctl that allows for listing of sysctls intended to be
normally skipped for cost reasons.

This makes it so the names/descriptions of those sysctls can be discovered with
sysctl -aN/sysctl -ad/sysctl -at.

It also makes it so children are visited when a node flagged with CTLFLAG_SKIP
is explicitly requested.

The intended use case is to mark the root "kstat" node with CTLFLAG_SKIP so that
the extensive and expensive stats are skipped by default but may still be easily
obtained without having to know them all (which may not even be possible) and
request each one-by-one.

Reviewed by:	jhb
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D26560
2020-10-05 20:13:22 +00:00
Fernando Apesteguía
fd92b91c71 procstat(1): Add EXAMPLES section
* Add some examples showing binary, arguments and file info from living
  processes.
* Show information from core dumps including an attempt using an old core file.
* While here, fix warning 'no blank before trailing delimiter' reported by igor.

Approved by:	manpages (0mp@)
Differential Revision:	https://reviews.freebsd.org/D25467
2020-10-05 14:07:32 +00:00
Gordon Bergling
095bc8eb65 cpuset(1): Fix some issues reported by mandoc
- whitespace at end of input line
- new sentence, new line

MFC after:	1 week
2020-10-03 19:10:54 +00:00
Alexander V. Chernikov
fedeb08b6a Introduce scalable route multipath.
This change is based on the nexthop objects landed in D24232.

The change introduces the concept of nexthop groups.
Each group contains the collection of nexthops with their
 relative weights and a dataplane-optimized structure to enable
 efficient nexthop selection.

Simular to the nexthops, nexthop groups are immutable. Dataplane part
 gets compiled during group creation and is basically an array of
 nexthop pointers, compiled w.r.t their weights.

With this change, `rt_nhop` field of `struct rtentry` contains either
 nexthop or nexthop group. They are distinguished by the presense of
 NHF_MULTIPATH flag.
All dataplane lookup functions returns pointer to the nexthop object,
leaving nexhop groups details inside routing subsystem.

User-visible changes:

The change is intended to be backward-compatible: all non-mpath operations
 should work as before with ROUTE_MPATH and net.route.multipath=1.

All routes now comes with weight, default weight is 1, maximum is 2^24-1.

Current maximum multipath group width is statically set to 64.
 This will become sysctl-tunable in the followup changes.

Using functionality:
* Recompile kernel with ROUTE_MPATH
* set net.route.multipath to 1

route add -6 2001:db8::/32 2001:db8::2 -weight 10
route add -6 2001:db8::/32 2001:db8::3 -weight 20

netstat -6On

Nexthop groups data

Internet6:
GrpIdx  NhIdx     Weight   Slots                                 Gateway     Netif  Refcnt
1         ------- ------- ------- --------------------------------------- ---------       1
              13      10       1                             2001:db8::2     vlan2
              14      20       2                             2001:db8::3     vlan2

Next steps:
* Land outbound hashing for locally-originated routes ( D26523 ).
* Fix net/bird multipath (net/frr seems to work fine)
* Add ROUTE_MPATH to GENERIC
* Set net.route.multipath=1 by default

Tested by:	olivier
Reviewed by:	glebius
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D26449
2020-10-03 10:47:17 +00:00
Emmanuel Vadot
9ddaa99d9d Add backlight(8)
This tool is used to configure registered backlights.
It can incr/decr (default to 10%) or accept a percentage value directly.

Reviewed by:	manpages (gbe@)
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D26251
2020-10-02 18:21:30 +00:00
Eric van Gyzen
63c8336d4d zgrep: fix exit status with multiple files
zgrep should exit with success when given multiple files and the
pattern is found in at least one file.  Prior to this change,
it would exit with success only if the pattern was found in _every_ file.

Reviewed by:	dab ngie
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D26616
2020-10-01 21:48:22 +00:00
Baptiste Daroussin
755cc40c21 Update nvi to 2.2.0-05ed8b9
This version incorporates many fixes in particular a fix for vi -w
Another approach was proposed to merge those fixes (see review), I find
it easier to track changes if we keep importing snapshot on regular
basis

PR:		241985
Reported by:	fernape
Differential Revision:	https://reviews.freebsd.org/D26158
2020-10-01 04:46:23 +00:00
Kyle Evans
7cc42f6d25 Do a sweep and remove most WARNS=6 settings
Repeating the default WARNS here makes it slightly more difficult to
experiment with default WARNS changes, e.g. if we did something absolutely
bananas and introduced a WARNS=7 and wanted to try lifting the default to
that.

Drop most of them; there is one in the blake2 kernel module, but I suspect
it should be dropped -- the default WARNS in the rest of the build doesn't
currently apply to kernel modules, and I haven't put too much thought into
whether it makes sense to make it so.
2020-10-01 01:10:51 +00:00
Mateusz Piotrowski
c9370e5cec Bump manual page date after 366243
While here, address mandoc warnings.
2020-09-29 10:07:46 +00:00
Greg Lehey
314c5b3583 Document the fact (bug?) that the -a option will normally process
root's calendar files three times, once each for root, toor and
daemon.

This relates to bug 246943, but does not solve it.  See discussion in
bug report for more details.

PR:		246943
Reported by:	wcarson.bugzilla@disillusion.net
2020-09-29 05:49:45 +00:00
Konstantin Belousov
34d7dd1561 procstat: Fix regression after 365880.
Basically it reverts one chunk that reversed the parsing logic, making
legacy variants of invocation, like `procstat -a -f', non-operational.

Reported and tested by:	Dewayne Geraghty <dewayne@heuristicsystems.com.au>
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2020-09-29 00:20:58 +00:00
Konstantin Belousov
b65eb2f8a8 Consistently use __FBSDID("FreeBSD") for ids in usr.bin/procstat.
Submitted by:	Juraj Lutter <juraj@lutter.sk>
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D26568
2020-09-27 23:01:54 +00:00
Fernando Apesteguía
347307b8e4 Fix typo and environment variable macro
Follow up for r366119

Reported by:	xtouqh@mm.st
Differential Revision:	https://reviews.freebsd.org/D26182
2020-09-24 16:42:17 +00:00
Fernando Apesteguía
f0f718ce96 which(1): Add EXAMPLES section to manpage
Add EXAMPLES section showing the use of -a and -s flags and how which(1)
treates duplicates.

Approved by:	manpages (gbe@)
Differential Revision:	https://reviews.freebsd.org/D26182
2020-09-24 16:11:53 +00:00
Greg Lehey
02d18aea06 Remove claim that Allied Forces created "West Germany" in 1953. I can
find no historic substantiation for such a claim.  The Federal
Republic of Germany was created by Germans on 23 May 1949, as also
noted in this file.
2020-09-21 22:55:51 +00:00
Alex Richardson
335770ac08 mkcsmapper: Fix UBSan signed shift error
usr.bin/mkcsmapper/yacc.y:466:18: runtime error: left shift of 1 by 31 places cannot be represented in type 'int'
2020-09-21 19:03:17 +00:00