Commit Graph

14964 Commits

Author SHA1 Message Date
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
Kyle Evans
dc94083273 xargs: add some long options for GNU compatibility
These are low-effort to add, so let's just do it.

Reported by:	"LukeShu" on Hacker News (-r / --no-run-if-empty)
MFC after:	1 week
2020-09-21 17:06:36 +00:00
Alex Richardson
86ce536521 Fix -Wpointer-sign warnings in usr.bin/grep
Reviewed By:	kevans
Differential Revision: https://reviews.freebsd.org/D26479
2020-09-21 09:03:37 +00:00
Kyle Evans
fe815331bb build: provide a default WARNS for all in-tree builds
The current default is provided in various Makefile.inc in some top-level
directories and covers a good portion of the tree, but doesn't cover parts
of the build a little deeper (e.g. libcasper).

Provide a default in src.sys.mk and set WARNS to it in bsd.sys.mk if that
variable is defined. This lets us relatively cleanly provide a default WARNS
no matter where you're building in the src tree without breaking things
outside of the tree.

Crunchgen has been updated as a bootstrap tool to work on this change
because it needs r365605 at a minimum to succeed. The cleanup necessary to
successfully walk over this change on WITHOUT_CLEAN builds has been added.

There is a supplemental project to this to list all of the warnings that are
encountered when the environment has WARNS=6 NO_WERROR=yes:
https://warns.kevans.dev -- this project will hopefully eventually go away
in favor of CI doing a much better job than it.

Reviewed by:	emaste, brooks, ngie (all earlier version)
Reviewed by:	emaste, arichardson (depend-cleanup.sh change)
Differential Revision:	https://reviews.freebsd.org/D26455
2020-09-18 17:17:46 +00:00
Konstantin Belousov
085e04945c Add pargs, penv, pwdx commands and aliases to procstat(1).
Intent is to mimic Solaris commands with the same names.

Submitted by:	Juraj Lutter <juraj@lutter.sk>
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D26310
2020-09-18 12:59:27 +00:00
Mark Johnston
c6dce83da8 Fix some posixshmcontrol nits.
- Exit with an error if no path is specified.
- Man page typo.
- Error message typo.

Reviewed by:	kib
Sponsored by:	Juniper Networks, Inc.
Sponsored by:	Klara, Inc.
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D26376
2020-09-15 13:36:19 +00:00
Andrew Turner
e7b841ae27 Cleanups for gprof:
* Remove identical or almost identical headers
 * Only build aout.c on amd64 and i386. None of the the other current
   architectures ever supported running a.out binaries
 * Enable on all architectures

Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D26369
2020-09-14 16:18:53 +00:00
Andrew Turner
2a6803de1c Use MACHINE_CPUARCH when checking for arm64
Use MACHINE_CPUARCH with arm64 (aarch64) when we build code that could run
on any 64-bit Arm instruction set. This will simplify checks in downstream
consumers targeting prototype instruction sets.

The only place we check for MACHINE_ARCH == aarch64 is when building the
device tree blobs. As these are targeting current generation ISAs.

Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D26370
2020-09-14 16:12:28 +00:00
Michael Tuexen
b98a21f64a Add a -C option to netstat to display the congestion control for
TCP connections.

Reviewed by:		rscheff
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D26414
2020-09-13 09:14:32 +00:00
Michael Tuexen
2ac089d0e6 Add a -C option to sockstat to display the congestion control for TCP
connections.

Reviewed by:		rscheff
MFC after:		1 week
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D26413
2020-09-13 09:12:25 +00:00
Kyle Evans
ecebb3cc1d Only set WARNS if not defined
This would allow interested parties to do experimental runs with an
environment set appropriately to raise all the warnings throughout the
build; e.g. env WARNS=6 NO_WERROR=yes buildworld.

Not currently touching the numerous instances in ^/tools.

MFC after:	1 week
2020-09-11 13:28:37 +00:00
Alex Richardson
b7b5bdba96 Ensure that the makewhatis symlink is added in the bootstrap-tools stage
We currently set MK_MAN=no in $BSARGS so MK_MAN_UTILS will also be false
which means that the makewhatis symlink will not be created.
This change fixes the build when using both -DBUILD_WITH_STRICT_TMPPATH and
-DBOOTSTRAP_ALL_TOOLS.

Tested by:	andrew
Differential Revision: https://reviews.freebsd.org/D16761
2020-09-10 15:37:29 +00:00
Alex Richardson
266b51ac6e Fix -Wpointer-sign warnings in bwstring.c 2020-09-10 15:37:19 +00:00
Konstantin Belousov
19fabdb70c Add posixshmcontrol(1) support for largepage shm objects.
Create op with -l <largepage> option can create it, stat displays
configured page size.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D24652
2020-09-09 22:22:02 +00:00
Baptiste Daroussin
110d525ec6 Update nvi to 2.2.0
Main changes:
* Vim-style expandtab option
* Provides Turkish translation
* Backspace now deletes \ rather than being escaped
* T during motion commands is now VI-compatible
* Encoding related fixes, such as UTF-8 detection
* Fixed a number of memory management issues

MFC after:	3 weeks
2020-09-09 08:38:47 +00:00
Gordon Bergling
2d955e4199 sort(1): Remove duplicate option check
Reviewed by:	lwhsu, emaste
Approved by:	emaste
Obtained from:	DragonFlyBSD
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D23892
2020-09-08 15:01:49 +00:00
Simon J. Gerraty
2c3632d14f Update to bmake-20200902
Lots of code refactoring, simplification and cleanup.
Lots of new unit-tests providing much higher code coverage.
All courtesy of rillig at netbsd.

Other significant changes:

o new read-only variable .SHELL which provides the path of the shell
  used to run scripts (as defined by  the .SHELL target).

o variable parsing detects more errors.

o new debug option -dl: LINT mode, does the equivalent of := for all
  variable assignments so that file and line number are reported for
  variable parse errors.
2020-09-05 19:29:42 +00:00
Warner Losh
84961358b4 Fix typo in comment.
Noticed by: bapt@
2020-09-05 04:20:29 +00:00
Gordon Bergling
cb55665190 fortune(6): Grammar fix for a hint on searching ports
PR:		249078
Submitted by:	PauAmma <pauamma at gundo dot com>
Reported by:	PauAmma <pauamma at gundo dot com>
MFC after:	3 days
2020-09-04 13:05:00 +00:00
Alan Somers
dc2541703c Fix output of nfsstat -cE in json or xml mode
Due to a copy/paste error, the "getacl" field was duplicated, but only in
XML or JSON mode, not in txt mode.

Discussed with:	rmacklem
MFC after:	1 week
Sponsored by:	Axcient
2020-09-02 17:36:30 +00:00
Warner Losh
44a3c7a3f8 Bump date for r365052 2020-09-01 16:13:09 +00:00
Warner Losh
f9177b6c91 Have script accept and ignore -e for Linux compat
In the util-linux version of script, it will always exit with succes.
Except when run with -e, in which case it will have the exit value of
the child. BSD Script already uses the child's exit value for its exit
value. Some config and other helper scripts depend on being able to
specify -e. Accept it for compatibility since we'll already to the
right thing, but otherwise we ignore it.
2020-09-01 16:11:23 +00:00
Baptiste Daroussin
fb0d1c6980 diff: always properly kill pr(1)
When diff is invoked with -l it will spawn the pr(1) program.
In some circumpstances the pr(1) was not properly killed when diff program
exits.

Submitted by:	Bret Ketchum
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D26232
2020-09-01 14:52:39 +00:00
Fernando Apesteguía
25641c7ccc who(1): Add EXAMPLES section
Add EXAMPLES section covering all the flags except -m and -bTu covered by
other flags.

Approved by:	manpages (bcr@)
Differential Revision:	https://reviews.freebsd.org/D26219
2020-08-30 17:40:59 +00:00
Fernando Apesteguía
9051d94e9a tsort(1): Add EXAMPLES section
Add a couple of simple examples to the man page

Approved by:	manpages (gbe@)
Differential Revision:	https://reviews.freebsd.org/D25883
2020-08-30 17:37:56 +00:00
Greg Lehey
23f93ed79b Update Hong Kong Liberation Day (hah!) 2020-08-27 03:50:34 +00:00
Colin Percival
bd4fcf75ee Remove whitespace which accidentaly snuck into r364831. 2020-08-26 19:28:30 +00:00
Colin Percival
437bab4828 Add -w option to lockf(1).
By default, lockf(1) opens its lock file O_RDONLY|O_EXLOCK.  On NFS, if the
file already exists, this is split into opening the file read-only and then
requesting an exclusive lock -- and the second step fails because NFS does
not permit exclusive locking on files which are opened read-only.

The new -w option changes the open flags to O_WRONLY|O_EXLOCK, allowing it
to work on NFS -- at the cost of not working if the file cannot be opened
for writing.

(Whether the traditional BSD behaviour of allowing exclusive locks to be
obtained on a file which cannot be opened for writing is a good idea is
perhaps questionable since it may allow less-privileged users to perform
a local denial of service; however this behaviour has been present for a
long time and changing it now seems like it would cause problems.)

Reviewed by:	rmacklem
Differential Revision:	https://reviews.freebsd.org/D26005
2020-08-26 19:26:48 +00:00
Alex Richardson
5bb9250e0a Add necessary Makefile.inc1 infrastructure for building on non-FreeBSD
The most awkward bit in this patch is the bootstrapping of m4:
We can't simply use the host version of m4 since that is not compatible
with the flags passed by lex (at least on macOS, possibly also on Linux).
Therefore we need to bootstrap m4, but lex needs m4 to build and m4 also
depends on lex (which needs m4 to generate any files). To work around this
cyclic dependency we can build a bootstrap version of m4 (with pre-generated
files) then use that to build the real m4.

This patch also changes the xz/unxz/dd tools to always use the host version
since the version in the source tree cannot easily be bootstrapped on macOS
or Linux.

Reviewed By:	brooks, imp (earlier version)
Differential Revision: https://reviews.freebsd.org/D25992
2020-08-25 13:29:57 +00:00
Fernando Apesteguía
3f8c71d1c9 w(1): Add EXAMPLES to man page
Add small example section showing general use and -d and -h flags

Approved by:	manpages (bcr@)
Differential Revision:	https://reviews.freebsd.org/D26172
2020-08-24 17:57:08 +00:00
Konstantin Belousov
da477bcdc0 procctl(8): usermode bits to force LA58/LA57 on exec.
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D25273
2020-08-23 20:44:15 +00:00
Konstantin Belousov
bc6f027a39 Reserve FreeBSD ELF feature control bit LA48 to control VA layout on amd64.
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D25273
2020-08-23 19:47:27 +00:00
Fernando Apesteguía
976e7c964b uptime(1): Add EXAMPLES section
Add a simple example

Approved by:	manpages (bcr@)
Differential Revision:	https://reviews.freebsd.org/D26063
2020-08-18 16:58:37 +00:00
Mark Johnston
48a528cfaa cpuset(1): Update the usage message.
Parameters related to domain selection were not listed.

MFC after:	1 week
Sponsored by:	Juniper Networks, Klara Inc.
2020-08-17 13:08:04 +00:00
Xin LI
941791759c Don't explicitly specify c99 or gnu99 as the default is now gnu99.
MFC after:	2 weeks
2020-08-17 05:57:02 +00:00
Warner Losh
c7cddf955f Remove heuristic for dealing with trailing newlines being truncated by mailers.
Every version of patch since the first one posted to mod.sources in 1985 have
included a heuristic for coping with the state of email messaging at the
time. This heuristic would add up to 4 blank lines to a patch if it thought it
needed it. The trouble is, though this causes at least one bug.

The bug in my case is that if you have a context diff whose last hunk only
deletes 3 or fewer lines, then if you try to reverse apply it with -R, it will
fail. The reason for this is the heuristic builds an internal representation
that includes those blank lines. However, it should really replicate the lines
from the pattern lines line it would any other time, not assume they are blank
lines. Removing this heuristic will prevent patch from misapplying the lines
removed after applying a 'fuzz' factor to the previous blank line in the file. I
believe this will only affect 'new-style' 4.3BSD context diffs and not the
older-style 4.2BSD diffs and plain, non-context diffs. It won't affect any of
the newer formats, since they don't use the 'omitted' construct in the same way.

Since this heuristic was put into patch at a time when email / etc ate trailing
white space on a regular basis, and since it's clear that this heuristic is the
wrong thing to do at least some of the time, it's better to remove it
entirely. It's not been needed for maybe 20 years since patch files are not
usually corrupted. If there are a small number of patch files that would benefit
from this corruption fixing, those already-currupt patches can be fixed by the
addition of blank lines. I'd wager that no one will ever come to me with an
example of a once-working patch file that breaks with this change. However, I
have 2 patches from the first 195 patches to 2.11BSD that are affected by this
bug, suggesting that the relative frequency of the issue has changed
signficantly since the original heuristic was put into place.

Reviewed by: phk@
Differential Revision: https://reviews.freebsd.org/D26081
2020-08-16 23:55:23 +00:00
Dimitry Andric
de6fc2e39b Merge ^/head r364082 through r364250. 2020-08-15 11:49:31 +00:00
Gordon Bergling
48bd73d9f5 tput(1): Several enhancements for the manual page
- a couple of descriptions are incomplete
- synopsis doesn't show that all arguments are optional
- missing an ENVIRONMENT section with TERM mentioned

PR:		84670
Submitted by:	Gary W. Swearingen <garys at opusnet dot com>
Reviewed by:	bcr
Approved by:	bcr
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D26009
2020-08-11 21:44:43 +00:00
Mark Johnston
8bc30d2afd script: Minor cleanups.
- Instead of using isatty() to decide whether to call tcgetattr(), just
  call tcgetattr() directly, since that's all that isatty() does anyway.
- Simplify error handling in termset().  Check for errno != ENOTTY from
  tcgetattr() to handle errors that may be raised while running
  script(1) under a debugger.

PR:		248377
Submitted by:	Soumendra Ganguly <soumendraganguly@gmail.com>
MFC after:	1 week
2020-08-11 14:19:05 +00:00
Mark Johnston
777c9f5a38 fortune, strfile: Improve validation of command-line arguments.
- Avoid potential overflow when parsing a percentage.
- Avoid truncation when copying file paths.

PR:		246050
Submitted by:	Akos Somfai <akos.somfai@gmail.com> (original)
MFC after:	1 week
2020-08-10 17:01:59 +00:00
Dimitry Andric
8460d7540b Merge ^/head r364051 through r364081. 2020-08-10 16:58:05 +00:00
Alexey Dokuchaev
f8024c3915 Document the order in which the kernel and the user environment versions
are printed when both -K and -U options are passed on the command line.

Approved by:	0mp
Differential Revision:	https://reviews.freebsd.org/D25970
2020-08-10 09:03:29 +00:00
Greg Lehey
cbc0517c2b Correct date for Nagasaki bombing. 2020-08-09 00:35:47 +00:00
Greg Lehey
5126cbe91b Remove incorrect duplicate. 2020-08-09 00:34:35 +00:00
Dimitry Andric
a3030502fb Merge ^/head r364041 through r364050. 2020-08-08 11:08:03 +00:00
Alex Richardson
dfb98e350c Fix i386 build of chpass after r363992
My change to allow bootstrapping pwd_mkdb (r363992) resulted in i386 build
failures because the bootstrap header was being included in non-bootstrap chpass.
Dropping the no longer required pwd_mkdb include path from chpass fixes
the build, but to be certain that the failure doesn't get re-introduced,
I've also moved the bootstrap pwd.h into a subdirectory so that adding
-I${SRCTOP}/usr.sbin/pwd_mkdb doesn't pull it in.

Reported by:	mjg
2020-08-08 10:05:27 +00:00
Dimitry Andric
b7f46c9348 Merge ^/head r363583 through r364040. 2020-08-07 19:33:54 +00:00
Mark Johnston
69bc4fa916 script: Put the terminal in raw mode when playing back a session.
Otherwise recorded sessions of some interactive programs do not play
back properly.

PR:		248377
Submitted by:	Soumendra Ganguly <0.gangzta@gmail.com>
MFC after:	1 week
2020-08-07 18:48:56 +00:00
Dimitry Andric
e53daa1d64 Merge ^/head r363989 through r364034. 2020-08-07 18:14:41 +00:00
Alex Richardson
4f971ddf33 Always install usr.bin/grep as grep when bootstrapping
We have to bootstrap grep when cross-building from macOS/Linux.
2020-08-07 16:04:01 +00:00
Gordon Bergling
88d241831d grep(1): correct typos for 'if a name patches' to 'if a name matches'
PR:		237635
Submitted by:	durin42 <raf atdurin42 dot com>
Reviewed by:	kevans
Approved by:	kevans
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D25994
2020-08-07 16:01:05 +00:00
Dimitry Andric
e383ec74e5 Merge ^/head r363739 through r363986. 2020-08-06 19:34:55 +00:00
Dimitry Andric
48aaf27bca Update Makefiles under lib/clang and usr.bin/clang for 11.0.0 builds,
and also bump the version in the mtree files.
2020-08-06 19:30:00 +00:00
Kyle Evans
cab7d341dc bsdgrep: switch to libregex for GNU_GREP_COMPAT
libregex is incomplete, but it's a bit less buggy than the in-base
libgnuregex and mostly OK.

While here, rename -DIWTH_GNU -> -DWITH_GNU_COMPAT; the option implies
that we're compatible with the GNU counterpart, not that we're including GNU
anything.
2020-08-04 02:47:24 +00:00
Stefan Eßer
f022d2cd17 Connect the tests provided with the new bc and dc
The tests compare the command output (including of error cases) with the
expected output and exit code.

Not all tests are executed, since some expect to have a known good bc and
dc binary installed and compare results of large amounts of generated data
being processed by both versions to test for regressions.
2020-08-03 20:26:04 +00:00
Stefan Eßer
2ead2969a0 Upgrade to version 3.1.4
This version omits the printing of a copyright header in interactive mode
and the dc command now exits after execution of the commands passed via -e
or -f instead of switching to interactive mode. To pass further commands
via STDIN when dc has been invoked with -e or -f, add "-f -" to the
parameter list.
2020-08-03 19:18:38 +00:00
Mateusz Piotrowski
ea27bce336 Document automatic handling of font height for BDF files
PR:		248395
Submitted by:	Dmitry Wagin <dmitry.wagin@ya.ru>
Reviewed by:	bcr, emaste, tsoome
Differential Revision:	https://reviews.freebsd.org/D25907
2020-08-02 16:41:36 +00:00
Kyle Evans
98369a6980 sed: fix hex_subst test after after r363679
r363679 is in-fact the future change referenced by the comment, helpfully
left and forgotten by kevans. Instead of just silently not matching, we
should now be erroring out with vigor.
2020-07-30 13:36:24 +00:00
Kyle Evans
ac05de1788 diff: fix side_by_side after r363679
It's currently unclear to me how this could have worked previously; \n here
is not a literal newline but actual '\' 'n', and was getting passed to the
underlying regex engine as such. regex(3) does not translate this to a
newline, and this became an error because we don't really allow escaping
of arbitrary ordinary characters anymore.

Run the pattern strings through printf to make sure we're dealing with real
newlines before passing them through to atf_check, which ultimately feeds
them directly to regcomp(3).

This fix is different than that will be needed for sed, in that this is the
proper way to inject newlines into search strings as long as regex(3)
won't combine \ + n as folks might expect.

Reported by:	Jenkins via lwhsu
MFC after:	1 week
2020-07-30 13:33:45 +00:00
Daniel Ebdrup Jensen
ee49c1d3e5 Add my entry to the calendar file
As part of onboarding, ensure that I'm listed in the FreeBSD calendar file,
while listening to Don't Take Away The Music by Tavares.

Reviewed by:	0mp, bcr
Approved by:	0mp (mentor), allanjude (mentor)
Differential Revision:	D25856
2020-07-29 11:19:57 +00:00
Fernando Apesteguía
bdfea496cf comm(1): Add EXAMPLES section
Add two very simple examples.

Approved by:	manpages (gbe@)
Differential Revision: https://reviews.freebsd.org/D25344
2020-07-27 16:51:23 +00:00
Fernando Apesteguía
c2895f1934 truncate(1): Add EXAMPLES section
Add four simple examples showing the use of -c, -r and -s

Approved by:	manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D25774
2020-07-27 15:25:04 +00:00
Ian Lepore
336ab722d2 Describe the value in the 're' column of vmstat(8) in terms of freebsd's vm
implementation.  The old description was left over from the 4.4 BSD Lite
import in 1994, and was a bit misleading (not all arches use simulated
reference bits, some implement reference tracking in hardware).
2020-07-26 18:33:29 +00:00
Ian Lepore
e9c003e51a Remove commented-out lines describing the old never-implemented -t option.
In 2018, r338094 removed the commented-out code for supporting the -t
command line option which had been present since the BSD 4.4 Lite import,
but was never implemented for freebsd.

This does the same for the man page.
2020-07-26 17:50:39 +00:00
Yuri Pankov
14fdf16371 sed: treat '[' as ordinary character in 'y' command
'y' does not handle bracket expressions, treat '[' as ordinary character
and do not apply bracket expression checks (GNU sed agrees).

PR:		247931
Reviewed by:	pfg, kevans
Tested by:	antoine (exp-run), Quentin L'Hours <lhoursquentin@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D25640
2020-07-26 09:15:05 +00:00
Fernando Apesteguía
f8f51b49d8 netstat(1): Add EXAMPLES section
* Add small EXAMPLES section
* Fix warning reported by mandoc (./netstat.1:747:2: WARNING: skipping paragraph
  macro: Pp before Ss)

Approved by:	manpages (gbe)
Differential Revision: https://reviews.freebsd.org/D25212
2020-07-21 16:17:23 +00:00
Craig Leres
c4cbf1fbab Fix some regressions with the zgrep(1) wrapper.
- Handle whitespace with long flags that take arguments:

	echo 'foo bar' > test
	zgrep --regexp='foo bar' test

 - Do not hang reading from stdin with patterns in a file:

	echo foobar > test
	echo foo > pattern
	zgrep -f pattern test
	zgrep --file=pattern test

 - Handle any flags after -e:

	echo foobar > test
	zgrep -e foo --ignore-case < test

These two are still outstanding problems:

 - Does not handle flags that take an argument if there is no
   whitespace:

	zgrep -enfs /etc/rpc

 - When more than one -e pattern used matching should occur for all
   patterns (similar to multiple patterns supplied with -f file).
   Instead only the last pattern is used for matching:

	zgrep -e rex -e nfs /etc/rpc

   (This problem is masked in the unpatched version by the "any
   flags after -e" problem.)

Add tests for the above problems.

Update the mange and add references to gzip(1) and zstd(1) and also
document the remaining known problems.

PR:		247126
Approved by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D25613
2020-07-20 23:57:53 +00:00
Simon J. Gerraty
e17f5b1d30 Oops missed Makefile.config 2020-07-19 23:54:00 +00:00
Allan Jude
4c0fab716a at(1): Markup environment variables with proper macros
Submitted by:	debdrup
Reported by:	0mp
Reviewed by:	imp
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D25721
2020-07-19 14:42:13 +00:00
Allan Jude
f4cf731d1a at(1): Fix location of at(1) crontab
With r318443, atrun was moved from /etc/crontab to /etc/cron.d/at,
but the man-page was unfortunately not updated to reflect this.

PR:		248048
Submitted by:	debdrup
Reported by:	yoitsmeremember+fbsd at gmail.com
Reviewed by:	Pau Amma <pauamma at gundo.com>
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D25709
2020-07-17 20:43:00 +00:00
Alex Richardson
0fd54da0b0 Allow install(1)'s create_tempfile() to work on Linux hosts
GLibc expects six 'X' characters in the mkstemp template argument and
will return EINVAL otherwise.

Reviewed By:	emaste, imp, mjg
Differential Revision: https://reviews.freebsd.org/D25662
2020-07-15 17:24:39 +00:00
Alex Richardson
00c61a3b43 Allow bootstrapping localdef on non-FreeBSD systems
The current localedef simply assumes that the locale headers on build system
are compatible with those on the target system which is not necessarily true.
It generally works on FreeBSD (as long as we don't change the locale headers),
but Linux and macOS provide completely different locale headers.

This change adds new bootstrap headers that namespace certain xlocale
structures defined or used by in the headers that localdef needs.
This is required since system headers *must* be able to include the "real"
locale headers for printf(), etc., but we also want to access the target
systems's internal locale structures.

Reviewed By: yuripv, brooks
Differential Revision: https://reviews.freebsd.org/D25229
2020-07-15 12:07:59 +00:00
Alex Richardson
2becc9efb5 Add missing newline and return in localedef error message
I hit those error messages when using a localedef built against headers
that don't match the target system (cross-building from a Linux host).
This problem will be fixed in the next commit.
2020-07-15 12:07:53 +00:00
Yuri Pankov
13858b8824 top: VIS_SAFE turned out to be unsafe
Unset VIS_SAFE flag as it turned out to be actually unsafe
for continuos top display as it's passing through sequences
resulting cursor movement (backspace, tab, carriage-return),
and explicitly set VIS_TAB for the same reason.

Reported by:	Mark Millard <marklmi@yahoo.com>, swills
Tested by:	Mark Millard <marklmi@yahoo.com>, swills
2020-07-14 22:43:40 +00:00
Jung-uk Kim
b53bb29fed MFV: r362513
Update byacc to 20200330.
2020-07-14 01:54:24 +00:00
Oleksandr Tymoshenko
e331252340 Fix invalid VHDX generation for image larger than 4Gb
- Part of BAT payload location was lost due to invalid
    BAT entry encoding type (32 bits instead of 64 bits)
- The sequence of PB/SB entries in BAT was broken due to
    off-by-one index check. It worked for smaller than
    4Gb because there were no SB entries in BAT.

MFC after:	1 day
2020-07-13 02:24:31 +00:00
Yuri Pankov
e4bfd2a675 sed/multi_test: print comment for current test, not next one
This is visible when e.g. 8.20 is failing:

not ok 96 8.20 # \ in y command

8.20's comment should be '[ as an s delimiter and its escapes'.
2020-07-13 01:32:37 +00:00
Eugene Grosbein
57f09d08c6 install(1): another correction after r363064
Make sure we call fsync(2) on strip result
in case of "safecopy" and "strip -o tempcopy -- src"
before renaming tempcopy to destination.

MFC after:	3 weeks
X-MFC-With:	r363064
2020-07-12 20:59:52 +00:00
Simon J. Gerraty
3841c28717 Update to bmake-20200710
Key changes include reduced noise at end of failed build log
and avoid evaluation of unnecessary terms in conditionals.
In META MODE; a target flagged .META is out-of-date if meta file
is missing

MFC after:      1 week
2020-07-12 01:11:48 +00:00
Michael Reifenberger
4b9ac8a0a6 Handle device removal and removal+add cases to fix infinity rate.
PR:		219829
Submitted by:	ota@j.email.ne.jp
Reported by:	rezo@live.cn
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D25226
2020-07-11 13:56:36 +00:00
Eugene Grosbein
a0b083fbda Fix the tests for install(1): add support for STRIPBIN's -o option.
Reported by:	lwhsu
MFC after:	1 week
2020-07-10 22:59:26 +00:00
Eugene Grosbein
cd88eaa5b4 install(1): addition to r363067
Also, make it not break if STRIPBIN points to strip version without -o support
and destination does not exist before installing.

Reported by:	lwhsu
MFC after:      1 month
X-MFC-With:     363064
2020-07-10 17:42:22 +00:00
Eugene Grosbein
8ce741ca77 install(1): correction after r363064
Make it not break if STRIPBIN points to strip version without -o support.
In that case, perform extra copy just like before r363064.

MFC after:	1 month
X-MFC-With:	363064
2020-07-10 00:45:34 +00:00
Eugene Grosbein
2d68fac9bd Optimize install(1) a bit.
Currently, "install -s -S" behaviour is inefficient for upgrade.
First it finds that destination file already exists and copies
source file to temporary file. Then it calls strip(1)
with name of temporary file as single agrument and our strip(1) creates
another temporary file in the /tmp (or TMPDIR) making another copy
that is finally copied to DESTDIR third time.

Meantime, strip(1) has an option "-o dst" to specify destination
so install(1) is allowed to skip initial copying from obj to DESTDIR.
This change makes it do so.

Take a look at https://reviews.freebsd.org/D25551 for details
and efficiency numbers (in short: upto 32% gained for installword).

MFC after:		1 month
Differential Revision:	https://reviews.freebsd.org/D25551
2020-07-10 00:24:42 +00:00
Mark Johnston
aa949e8ace whois: Handle referrals to rwhois servers.
PR:		243862
Submitted by:	ben@desync.com
Differential Revision:	https://reviews.freebsd.org/D25156
2020-07-09 17:27:14 +00:00
Simon J. Gerraty
9093286b6a Revert r363031 2020-07-09 03:46:07 +00:00
Simon J. Gerraty
2d147b4741 Update to bmake-20200704
Key changes include reduced noise at end of failed build log
and avoid evaluation of unnecessary terms in conditionals.

MFC after:	1 week
2020-07-08 21:20:12 +00:00
Greg Lehey
565a5f040f Be more precise about Percy Grainger's place of birth. 2020-07-08 01:47:20 +00:00
Fernando Apesteguía
2fe5e736c9 timeout(1): Add EXAMPLES section
Small EXAMPLES section showing the use of -s, -k and the different exit values

Approved by:	manpages (gbe)
Differential Revision:	https://reviews.freebsd.org/D25575
2020-07-07 17:02:23 +00:00
Fernando Apesteguía
50f54daf41 time(1): Add EXAMPLES section
Add EXAMPLES showing all five flags: -a, -h, -l, -o, -p

Approved by:	manpages (bcr)
2020-07-07 16:07:39 +00:00
Stefan Eßer
3aa99676b4 Update to version 3.1.1
This version fixes a regression with regard to tradtional behavior of the
non-standard FreeBSD option "-e". In the previous version "-e quit" caused
bc to exit before any computations had been performed, since all -e option
parameters were concatenated and parsed as a whole, with quit causing the
program to exit as soon as it was parsed. This version parses and executes
commands passed with -e one by one and only exits after all prior commands
have been executed.

This commit is not a SVN merge, since the vendor import had been performed
after the import to contrib. Instead the contents of contrib/bc has been
removed and the new version is copied over unchanged from vendor/bc/dist.
2020-07-07 07:51:09 +00:00
Pawel Biernacki
43ec732a2c truss: print more information about traced sysctls
MFC after:	2 weeks
Sponsored by:	Mysterious Code Ltd.
2020-07-05 19:53:54 +00:00
Ed Maste
957a8d7e74 bc: disable -flto on powerpc64
Previously bc segfaulted at start, on powerpc64.

PR:		247738
Submitted by:	luporl
Reported by:	pkubaj
MFC after:	1 week
2020-07-03 20:32:53 +00:00
Greg Lehey
22335c3c63 Use canonical description for Schlacht bei Königgrätz, add year. 2020-07-02 22:59:05 +00:00
Fernando Apesteguía
5dbd4b8e96 printf(1): Add EXAMPLES section
* Small addition with four simple examples
 * While here, remove three obsolete .Tn macros

Approved by:	manpages (gbe)
Differential Revision:	https://reviews.freebsd.org/D25462
2020-07-01 16:33:32 +00:00
Fernando Apesteguía
ac2adfb86d hexdump(1): Add EXAMPLES section
* Add examples showing the use of -f, -C, -s, -n
 * Rework the two already present examples that were *format* examples
 * Remove .Tn suggested by mandoc(1)
 * Remove reference to gdb(1) since it is not present in current

Approved by:	manpages (gbe)
Differential Revision:	https://reviews.freebsd.org/D25406
2020-06-29 15:15:14 +00:00
Dimitry Andric
874d8270d9 Fix llvm-strings.1 not installing, this was a copy/paste error.
MFC after:	3 weeks
2020-06-28 18:02:51 +00:00
Dimitry Andric
62cfcf62f6 Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
llvmorg-10.0.1-rc2-0-g77d76b71d7d.

Also add a few more llvm utilities under WITH_CLANG_EXTRAS:

* llvm-dwp, a utility for merging DWARF 5 Split DWARF .dwo files into
  .dwp (DWARF package files)
* llvm-size, a size(1) replacement
* llvm-strings, a strings(1) replacement

MFC after:	3 weeks
2020-06-28 07:43:43 +00:00
Konstantin Belousov
5211c24ddf top: do not try to use sysctl machdep.smp_active.
The sysctl was removed by r76078 in 2001.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2020-06-28 00:29:21 +00:00
Stefan Eßer
252884ae7e Import new 2-clause BSD licenced implementation of the bc and dc commands
These implementations of the bc and dc programs offer a number of advantages
compared to the current implementations in the FreeBSD base system:

- They do not depend on external large number functions (i.e. no dependency
  on OpenSSL or any other large number library)

- They implements all features found in GNU bc/dc (with the exception of
  the forking of sub-processes, which the author of this version considers
  as a security issue).

- They are significantly faster than the current code in base (more than
  2 orders of magnitude in some of my tests, e.g. for 12345^100000).

- They should be fully compatible with all features and the behavior of the
  current implementations in FreeBSD (not formally verified).

- They support POSIX message catalogs and come with localized messages in
  Chinese, Dutch, English, French, German, Japanese, Polish, Portugueze,
  and Russian.

- They offer very detailed man-pages that provide far more information than
  the current ones.

The upstream sources contain a large number of tests, which are not
imported with this commit. They could be integrated into our test
framework at a latter time.

Installation of this version is controlled by the option "MK_GH_BC=yes".
This option will be set to yes by default in 13-CURRENT, but will be off
by default in 12-STABLE.

Approved by:	imp
Obtained from:	https://git.yzena.com/gavin/bc
MFC after:	4 weeks
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D19982
2020-06-27 12:02:01 +00:00
Dimitry Andric
bd74205d6a Regenerate ReStructuredText based manpages for llvm-project tools:
* bugpoint.1
* clang.1
* llc.1
* lldb.1
* lli.1
* llvm-ar.1
* llvm-as.1
* llvm-bcanalyzer.1
* llvm-cov.1
* llvm-diff.1
* llvm-dis.1
* llvm-dwarfdump.1
* llvm-extract.1
* llvm-link.1
* llvm-mca.1
* llvm-nm.1
* llvm-pdbutil.1
* llvm-profdata.1
* llvm-symbolizer.1
* llvm-tblgen.1
* opt.1

Add newly generated manpages for:

* llvm-addr2line.1 (this is an alias of llvm-symbolizer)
* llvm-cxxfilt.1
* llvm-objcopy.1
* llvm-ranlib.1 (this is an alias of llvm-ar)

Note that llvm-objdump.1 is an exception, as upstream has both a plain
.1 file, and a .rst variant. These will have to be reconciled upstream
first.

MFC after:	3 days
2020-06-27 11:56:49 +00:00