Commit Graph

15187 Commits

Author SHA1 Message Date
Baptiste Daroussin
6d38604fc5 mandoc: import version 1.14.6
MFC after: 3 weeks
2021-11-15 16:58:58 +01:00
Konstantin Belousov
0864ab3d32 procstat auxv: print out FXRNG
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-11-15 02:32:00 +02:00
Rick Macklem
75c666197c nfsstat: Add output for counts of new RPCs to the "-E" option
Add output to the "-E" option for new RPCs related
to NFSv4.1/4.2. Also, add output of the counts for
allocated layouts and the title for the "Client"
section (which was lost during a previous commit).

MFC after:	2 weeks
2021-11-14 13:36:14 -08:00
Dimitry Andric
28a41182c0 Merge llvm-project 13.0.0 release
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-13.0.0-0-gd7b669b3a303, aka 13.0.0 release.

PR:		258209
MFC after:	2 weeks
2021-11-13 21:49:29 +01:00
Dimitry Andric
fe6060f10f Merge llvm-project main llvmorg-13-init-16847-g88e66fa60ae5
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-13-init-16847-g88e66fa60ae5, the last commit before
the upstream release/13.x branch was created.

PR:		258209
MFC after:	2 weeks
2021-11-13 21:39:49 +01:00
Felix Johnson
5504d83942 sockstat(1): Update Synopsis section
Update sockstat(1) manpage so the Synopsis section includes q (silent
mode) and the -j argument name is consistent.

PR:		256795
MFC after:	3 days
Reported by:	Nick Reilly <nreilly@blackberry.com>
2021-11-10 15:22:06 -05:00
Kyle Evans
4c14980baa grep: fix/remove references to -P
-P in gnugrepland means PCRE, which we do not support.  We may eventually
support it if onigmo ends up getting imported as a more performant regex
implementation, and we can re-add it properly in these places (and more)
when that time comes.

The optstr change is a functional nop; the case was not explicitly handled,
thus ending in usage() anyways.

Reported by:	Vladimir Misev (via twitter)
2021-11-10 00:42:42 -06:00
Mike Karels
a2e7dfca86 systat: clean up code assuming network classes
Similar to netstat, clean up code that uses inet_lnaof() to check for
binding to "host 0" (lowest host on network) as a "network" bind.
Such things don't happen, and current networks are seldom if ever
found in /etc/networks.

MFC after:	1 month
Reviewers:	tuexen
Differential Revision: https://reviews.freebsd.org/D32720
2021-11-09 09:35:16 -06:00
Mike Karels
64acb29b7d sockstat: change check for wildcard sockets to avoid historical classes
sockstat was checking whether a bound address was "host 0", the lowest
host on a network, using inet_lnaof().  This only works for class A/B/C.
However, it isn't useful to bind such an address unless it is really
the unspecified address INADDR_ANY.  Change the check to to use that.

MFC after:	1 month
Reviewd by:	tuexen
Differential Revision: https://reviews.freebsd.org/D32715
2021-11-09 09:34:44 -06:00
Mike Karels
bd27c71c45 netstat: reduce use of historical Internet classes
When attempting to characterize bound addresses, netstat was checking
for host 0 on a (historical) net using inet_lnaof().  Such addresses
are not normally bound, as they would not work, with the exception
of the unspecified address, INADDR_ANY.  Check for that explicitly.
Similarly, don't check bound addresses for a match to a network name.

MFC after:	1 month
Reviewed by:	tuexen
Differential Revision: https://reviews.freebsd.org/D32714
2021-11-09 09:34:22 -06:00
Dries Michiels
ecf58c066c Complete steps 5 and 9 for new committers (driesm)
Reviewed by: 0mp (mentor)
Approved by: 0mp (mentor)
Differential Revision: https://reviews.freebsd.org/D32890
2021-11-08 17:19:57 +01:00
Felix Johnson
52dbe1a0f4 find(1): Update date format reference and remove cvs(1) references
cvs(1) is not installed by default. Change the date format reference to
note that find(1) understands ISO8601 and RFC822 date formats. Also
remove references to cvs(1).

PR:		254894
MFC after:	3 days
Reported by:	danielsh@apache.org
2021-11-08 01:14:58 -05:00
Warner Losh
517e52b6c2 awk: Move to using two sets of tests
Upstream one-true-awk has two sets of tests. These are in addition to
NetBSD's tests we're using. The 'bugs-fixed' tests from upstream are
ready to use as-is (more or less). However, the 'tests' from upstream
are not, so for now we'll just use the netbsd and bugs-fixed tests.
They provide an OK workout and are better than nothing, though the tests
themselves are for specific esoteric things.

The upstream bugs-fixed tests are *ALMOST* a drop in. However, 3 test
for errors and the upstream test jig mashes stdout and stderr together,
which atf doesn't do, so make a tiny tweak to the upstream tests that I
hope to upstream. Plus upstream has ../a.out: instead of awk: in the
output. Not sure how to deal with this yet, so I've not proposed
anything upstream and have changed the test locally.

In addition, the system-status.awk test is not suitable to run in ATF.
It wants to force sh to dump core, but kyua doesn't seem to allow that
sometimes so the test will fail or pass based on whether or not a core
dump can be created. Since it's unstable, remove it.

This required moving the netbsd tests to a new direcotry, so update
mtree files as well. The change is useless for 'make check' without it.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31376
2021-11-05 08:53:36 -06:00
Hans Petter Selasky
8abfbe5a79 beep(1): Initial version of utility to create terminal beep via soundcard.
Reviewed by:	imp@, emaste@ and pstef@
Differential Revision:	https://reviews.freebsd.org/D32672
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-11-04 09:00:46 +01:00
Mateusz Piotrowski
3693250e8a dpv.1: Do not use mdoc macros for Bl width
Macros do not expand there.

MFC after:	3 days
2021-11-02 08:30:11 +01:00
Mateusz Piotrowski
f7c7a6ac00 dpv.1: Fix an example
dpv(1) requires a label to be specified.

MFC after:	3 days
2021-11-02 08:30:11 +01:00
Mateusz Piotrowski
a85aa7f9d3 dpv: Fix synopsis formatting & sort options
MFC after:	3 days
2021-11-02 08:30:11 +01:00
Mateusz Guzik
932c2667d9 systat: fix stack overflow when running -iostat
The new buffer is arbitrarily sized to likely "big enough".

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-11-01 23:57:27 +00:00
Mateusz Guzik
6d88f9fed6 systat: mostly clean up warns
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-11-01 23:11:16 +00:00
Andriy Gapon
e18fbe6f19 fuser: restore functionality by fixing fsid type
Use types from sys/stat.h for the filesystem and inode numbers for extra
safety.

PR:		259504
Reported by:	Markus Wild <freebsd-bugs@virtualtec.ch>
MFC after:	1 week
2021-11-01 08:45:26 +02:00
Stefan Eßer
20f8331aca usr.bin/stat: honour locale for "-t %+"
The man page states that "-t %+" prints time information in the same
format as date with no format specifier.

This was not the case, the format used was always that of date for the
POSIX locale.

The fix suggested by the reporter leads to output that matches the
documentation.

Reported by:	Jamie Landeg-Jones <jamie@catflap.org>
MFC after:	3 days
2021-10-30 09:00:34 +02:00
Mark Johnston
e9bfb50d5e sort: Fix random sort
bwsrawdata() is supposed to return the string buffer.

PR:		259451
Reported by:	sigsys@gmail.com
Fixes:		d053fb22f6 ("usr.bin/sort: Avoid UBSan errors")
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2021-10-29 14:29:50 -04:00
Baptiste Daroussin
1a4d5f13ba ident: replace sbuf(9) with open_memstream(3)
This change makes ident only dependant on libc functions

This makes our ident(1) more portable, also the fact that we only
depend on libc which is maintained with excellent backward compatibility
means that if one day ident is removed from base, someone using FreeBSD
22 will be able to fetch ident from FreeBSD 14 to run ident against
FreeBSD 1.0 binary

MFC After:	1 week
2021-10-28 15:51:23 +02:00
Ed Maste
48cb3fee25 Retire obsolete iscsi_initiator(4)
The new iSCSI initiator iscsi(4) was introduced with FreeBSD 10.0, and
the old intiator was marked obsolete shortly thereafter (in commit
d32789d95c, MFC'd to stable/10 in ba54910169).  Remove it now.

Reviewed by:	jhb, mav
Relnotes:	yes
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32673
2021-10-26 16:17:35 -04:00
Konstantin Belousov
57e5da2c98 Augment systat(1) -swap to display large swap space processes
This change updates the systat(1) -swap display to use libprocstat to
obtain and display per-process swap space usage infomation following its
existing swap devise/file statistics. It also incorporates the disk I/O
information from the -vmstat display.

The new screen looks like below with 'systat -swap':
                    /0   /1   /2   /3   /4   /5   /6   /7   /8   /9 /10
     Load Average   |

Device/Path       Size  Used |0%  /10  /20  /30  /40  / 60\  70\  80\ 90\ 100|
ada0s1b          2048M 2034M
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
zvol/sys/tempora 1024M 1015M
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
zvol/sys/swap    1024M 1014M
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Total            4096M 4063M
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Pid    Username   Command     Swap/Total Per-Process    Per-System
 24153 hiro       seamonkey   98M /   1G  7%              2%
 23677 hiro       xfce4-pane  28M /  81M 34% XXX          0%
 23629 hiro       xfce4-sess  25M / 118M 21% XX           0%
 23681 hiro       xfdesktop   20M /  58M 34% XXX          0%
 23678 hiro       thunar      15M /  43M 36% XXX          0%
 23658 hiro       at-spi-bus  14M /  23M 63% XXXXXX       0%
 23660 hiro       gvfsd       12M /  21M 56% XXXXX        0%

Disks  ada0  ada1  ada2   cd0 pass0 pass1 pass2 pass3
KB/t   8.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
tps       0     0     0     0     1     0     0     0
MB/s   0.00  0.00  0.00  0.00  0.00  0.00  0.00  0.00
%busy     0     0     0     0     0     0     0     0

Submitted by:	Yoshihiro Ota
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29754
2021-10-26 15:50:29 +03:00
Kyle Evans
f1f7f31366 cmp: initialize limit to avoid stack garbage limits
Pointy hat:	kevans
Fixes:	4e380e8474 ("cmp: add -n, --bytes to limit number of bytes [...]")
Sponsored by:	Klara, Inc.
2021-10-21 11:30:55 -05:00
Mateusz Piotrowski
12615938c6 timeout.1: Fix typos in examples
MFC after:	3 days
2021-10-21 13:07:32 +02:00
Konstantin Belousov
2c7a6dad4d ldd: do not use dlopen(RTLD_TRACE) for dso when format is specified
Problem is that rtld cannot reliably access updated environment.
This was made more obvious by bfd4c875a1.  The application
environment can be in arbitrary state and place, system components
can observe it only during execve(2), or in case of rtld, right after
execve, when environment is still at know location and format.

Instead spawn ld-elf.so.1 in direct exec mode which can correctly read
all inherited updates to the environment.

PR:	259069
Reviewed by:	arichardson, jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32464
2021-10-21 03:09:14 +03:00
Konstantin Belousov
ca8c576d10 ldd: style
Reviewed by:	arichardson, jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32464
2021-10-21 03:09:03 +03:00
Baptiste Daroussin
3f550f0191 timeout: style fixes 2021-10-20 10:44:32 +02:00
Baptiste Daroussin
68914dab43 timeout: eliminate usage of sysexits
It brings no value at all the sysexits and maybe misleading as the
return value of timeout(1) matters.
2021-10-20 10:39:34 +02:00
Gleb Smirnoff
1fec1fa814 sockstat: don't query jail vnet if system is running without VIMAGE.
Fixes:  f1cd4902bf
2021-10-19 09:49:35 -07:00
Gleb Smirnoff
32723a3ba9 sockstat: make err(3) on jail errors more verbose. 2021-10-19 09:49:35 -07:00
Ed Maste
e1d6d6f924 lorder: process read-only data symbols
Previously they were skipped.  lorder(1) serves no functional purpose
today but we might as well address this longstanding bug while it is
still in the tree.

PR:		133860
MFC after:	1 week
Submitted by:	John Hein
2021-10-18 17:21:17 -04:00
Alex Richardson
367ec75323 Fix a syntax error in 1b85b68da0
Reported by:	Michael Butler, jenkins
2021-10-14 17:46:28 +01:00
Cameron Katri
1b85b68da0 llvm-readobj: Attach to buildsystem
Also install it as readelf when MK_LLVM_BINUTILS is set.

Reviewed By:	dim, arichardson
Differential Revision: https://reviews.freebsd.org/D32058
2021-10-14 17:18:05 +01:00
Piotr Pawel Stefaniak
8da2705253 last: improve non-UTF8 locale output after libxo support was added
Some strftime(3) conversion specifications will generate strings encoded
with the current locale, not necessarily UTF8. As per xo_format.5, use
the h string modifier so that libxo interprets it appropriately.

Reviewed by:	eugen, philip
Differential Revision:	https://reviews.freebsd.org/D32437
2021-10-11 19:02:12 +02:00
Piotr Pawel Stefaniak
902cde5d0a Revert "last(1): unbreak for 8-bit locales"
This reverts commits 8e67c427b5 (unbreak for 8-bit locales), 0ca58ca151
(correction after r351413), and f424ec1b80 (fix style after r351459).

A simpler fix can be done by using the h modifier for strings that are
encoded with the current locale.

Reviewed by:	eugen, philip
Differential Revision:	https://reviews.freebsd.org/D32437
2021-10-11 19:01:57 +02:00
Yoshihiro Takahashi
2c614481fd unzip: Fix segmentation fault if a zip file contains buggy filename.
PR:             259011
Reported by:    Robert Morris
Submitted by:   ak
MFC after::     1 week
2021-10-10 20:49:19 +09:00
Mariusz Zaborski
824bbb9a40 diff: consider two files with same inodes as identical
Obtained from:	OpenBSD
MFC after:	1 week
2021-10-07 17:07:00 +02:00
Kyle Evans
7f4bb50176 login: use sizeof(audit_cond) consistently, NFC
The other three instances were already converted to use audit_cond, this
one was just changed from sizeof(long) -> sizeof(int).
2021-10-05 23:25:29 -05:00
Elyes HAOUAS
7102ec5226 unifdef.1: Fix typo on "input"
Pull request: https://github.com/freebsd/freebsd-src/pull/549
Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
2021-10-05 20:27:16 -04:00
Mateusz Guzik
ae4fb190fd netstat: split ipsec and ipsec6 statistics in libxo
In particular fixes --libxo json

PR:		254673
Reported by:	j.vandeville@gmail.com
Sponsored by:   Rubicon Communications, LLC ("Netgate")
2021-10-05 09:42:58 +00:00
Stefan Eßer
b8d895faf4 contrib/bc: re-enable tests after the import of version 5.1.0
The tests have been fixed to not write any data outside of the
temporary work directory provided by the test framework.

MFC after:	3 days
2021-10-04 22:14:27 +02:00
Warner Losh
d6dffbae96 lastcomm/sa: Remove sparc64 tests, they aren't needed.
These tests will run only on a sparc64 system, and so never run anymore.

Sponsored by:		Netflix
2021-10-04 10:51:15 -06:00
Baptiste Daroussin
cbc83e378a ncurses: chase dependency changes in the source tree
Differential Revision:	https://reviews.freebsd.org/D32098
2021-10-04 11:38:24 +02:00
Stefan Eßer
f774652b0e contrib/bc: temporarily disconnect the tests for 5.0.2
The tests that come with version 5.0.2 have been extended to cover the
line editing functions. It has been found that these tests generate
false negative results in FreeBSD, most likely due to an issue in the
pexpect functionality used.

These history tests are skipped on systems that do not have python and
py-pexpect installed (and thus are unlikely to cause CI test failures),
but in order to not cause irritating failures on systems were these
packages are in fact installed, I temporarily disconnect them.

I had planned to skip this version due to the issue with the history
tests, but some committer has asked me to go ahead since the currently
used version 5.0.0 contains a macro name that collides with a project
he is working on.

No MFC of this version is planned. A version 5.0.3 is expected to be
released soon, and that version will allow to reconnect the tests and
will be MFCed.
2021-10-04 09:50:44 +02:00
Randall Stewart
a36230f75e tcp: Make dsack stats available in netstat and also make sure its aware of TLP's.
DSACK accounting has been for quite some time under a NETFLIX_STATS ifdef. Statistics
on DSACKs however are very useful in figuring out how much bad retransmissions you
are doing. This is further complicated, however, by stacks that do TLP. A TLP
when discovering a lost ack in the reverse path will cause the generation
of a DSACK. For this situation we introduce a new dsack-tlp-bytes as well
as the more traditional dsack-bytes and dsack-packets. These will now
all display in netstat -p tcp -s. This also updates all stacks that
are currently built to keep track of these stats.

Reviewed by: tuexen
Sponsored by: Netflix Inc.
Differential Revision: https://reviews.freebsd.org/D32158
2021-10-01 10:36:27 -04:00
Kyle Evans
f66b9b40f4 cmp: add -b, --print-bytes
This is compatible with GNU cmp.

Reviewed by:	bapt, markj (earlier version)
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32074
2021-09-29 13:04:57 -05:00
Kyle Evans
8d546b6832 cmp: add -i, --ignore-initial, an alternative to skip1/skip2 args
This is compatible with GNU cmp.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32073
2021-09-29 13:03:34 -05:00
Kyle Evans
4e380e8474 cmp: add -n, --bytes to limit number of bytes to compare
This is compatible with GNU cmp.

Reviewed by:	markj
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32072
2021-09-29 13:03:34 -05:00
Kyle Evans
f6787614fd cmp: accept SI suffixes for skip1 and skip2
This is compatible with GNU cmp.

Reviewed by:	bapt (earlier version), markj, imp
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32071
2021-09-29 13:03:34 -05:00
Yasuhiro Kimura
74237127e3 Add myself to calendar.freebsd
It corresponds to the 9th step of the procedure described in section
7.1 of Committer's Guide.

Approved by:	meta (mentor)
Differential Revision:	https://reviews.freebsd.org/D32153
2021-09-27 17:47:01 +09:00
Yoshihiro Takahashi
a4724ff481 unzip: sync with NetBSD upstream to add passphrase support
- Add support for password protected zip archives.
  We use memset_s() rather than explicit_bzero() for more portable
  (See PR).
- Use success/failure macro in exit()
- Mention ZIPX format in unzip(1)

Submitted by:	Mingye Wang and Alex Kozlov (ak@)
PR:		244181
Reviewed by:	mizhka
Obtained from:	NetBSD
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D28892
2021-09-26 01:32:42 +09:00
Kyle Evans
f555b39e6b man: reset OPTIND before parsing args
From jilles: POSIX requires that a script set `OPTIND=1` before using
different sets of parameters with `getopts`, or the results will be
unspecified.

The specific problem observed here is that we would execute `man -f` or
`man -k` without cleaning up state from man_parse_args()' `getopts`
loop.  FreeBSD's /bin/sh seems to reset OPTIND to 1 after we hit the
second getopts loop, rendering the following shift harmless; other
/bin/sh implementations will leave it at what we came into the loop at
(e.g., bash as /bin/sh), shifting off any keywords that we had.

Input from:	jilles
Reviewed by:	allanjude, bapt, imp
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D32063
2021-09-23 14:13:34 -05:00
Olivier Houchard
f4b7018af1 truss: Decode correctly 64bits arguments on 32bits arm.
Mostly revert ebbc3140ca.
We don't need to special-case anything for arm64, the check for the pointer
size is already done for us, just keep the bits about having arm and arm64
having to add padding for 32bits binaries.

MFC after:	1 week
2021-09-23 01:26:42 +02:00
Olivier Houchard
ebbc3140ca truss: Decode correctly 64bits arguments on 32bits arm.
When decoding 32bits arm syscall, make sure we account for the padding when
decoding 64bits args. Do it too when using a 64bits truss on a 32bits binary.

MFC After:	1 week
PR:		256199
2021-09-23 01:04:16 +02:00
Konstantin Belousov
cf0ee8738e Drop cloudabi
According to https://github.com/NuxiNL/cloudlibc:
CloudABI is no longer being maintained. It was an awesome experiment,
but it never got enough traction to be sustainable.

There is no reason to keep it in FreeBSD.

Approved by:	ed (private mail)
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D31923
2021-09-22 00:18:44 +03:00
Kevin Bowling
007c2463d6 calendar.freebsd: Fix off-by-one error 2021-09-17 16:07:23 -07:00
Konstantin Belousov
ac8af19380 proccontrol(1): Add wxmap control
Reviewed by:	brooks, emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31779
2021-09-17 15:42:07 +03:00
Konstantin Belousov
1349891a0e Style
Reviewed by:	brooks, emaste, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31779
2021-09-17 15:41:54 +03:00
Piotr Pawel Stefaniak
12061d2626 diff: link with libm for sqrt()
Reported by:	Jenkins
Fixes:		bcf2e78dc4
2021-09-16 09:31:44 +02:00
Piotr Pawel Stefaniak
e51aabf8cb diff: implement option -F (--show-function-line)
With unified and context diffs, show the last line that matches the
provided pattern before the context.

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D31714
2021-09-16 01:46:44 +02:00
Cameron Katri
f38702e5a5 diff(1): Add --color support
Adds a --color flag to diff(1) that supports the same options as GNU's
diff(1). The colors are customizable with the env var DIFFCOLORS in
a format similar to grep(1)'s GREPCOLORS. An example would be 04;36:41
for additions to be underlined light blue, and deletions have a red
background.

Differential Revision:	https://reviews.freebsd.org/D30545
2021-09-16 01:46:44 +02:00
Piotr Pawel Stefaniak
7760b85414 diff: decrease indent level
An upcoming change will add more code in the loop.
2021-09-16 01:46:44 +02:00
Piotr Pawel Stefaniak
2171b2cbe0 diff: avoid applying offsets to null pointer
This was the only instance of undefined behavior I could find so far.
2021-09-16 01:46:44 +02:00
Piotr Pawel Stefaniak
bcf2e78dc4 diff: replace isqrt() with sqrt()
Remove cruft and use a system-provided and maintained function instead.
2021-09-16 01:46:43 +02:00
Piotr Pawel Stefaniak
e43df07e37 diff: move functions around and reduce their visibility
Most of them become static. There will be more such functions added in
upcoming commits, so they would be inconsistent with existing code.
Improve the existing code instead of reinforcing the unwanted pattern.
2021-09-16 01:36:41 +02:00
Piotr Pawel Stefaniak
b5541f456d diff: convert boolean flag variables to bool
There will be more boolean flags added in upcoming commits and they
would have to be stored in ints in order to be consistent with existing
code. Change the existing code to use the bool type.
2021-09-16 01:36:41 +02:00
Piotr Pawel Stefaniak
0358202111 diff: improve code style
Reflow comments, strip trailing space, improve wrapping of lines.
2021-09-16 01:36:41 +02:00
John Baldwin
4c9cb057bd top: Remove a duplicate extern declaration for show_args.
This fixes a -Wnested-extern error with GCC 9.  There is an existing
extern declaration in top.h.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D31937
2021-09-15 09:03:17 -07:00
Pietro Cerutti
41ba691f92 tee: use queue(9) in place of a custom linked list
Approved by: cognet
2021-09-15 11:04:24 +00:00
Jessica Clarke
f28c1d0c5c llvm-objcopy: Install llvm-strip, and optionally strip, links
Just as elftoolchain's objcopy doubles as strip, so does LLVM's. This
ensures that a strip binary is still present for WITH_LLVM_BINUTILS
builds. Note that we do not currently have a committed copy of the
manpage generated from the rST source so no manpage is installed for
(llvm-)strip.

Reported by:	Shawn Webb <shawn.webb@hardenedbsd.org>
Tested by:	Shawn Webb <shawn.webb@hardenedbsd.org>
MFC after:	1 week
2021-09-13 21:52:40 +01:00
Warner Losh
d780a23a99 tabs: a hacky version of tabs appeared in 1st edition Unix
First edition Unix had an /etc/tabs file. It contained the escape
sequences to set tabs to every 8 stops on an old Teletype Model 37 and
compatible terminals. One would 'cat /etc/tabs' to reset them.  Unix at
the time effectively mandated this because the delays in the tty driver
assumed this and tabs didn't work when they were too different from '8'.
Document this historical niggle in HISTORY after it was brought to my
attention on a Hacker News thread.

Sponsored by: Netflix
2021-09-09 17:11:18 -06:00
John Grafton
4ccbbe5f06 top(1): indicate how to reset grep string
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/536/files
2021-09-07 20:56:45 -06:00
Emmanuel Vadot
b5be5c35db pkgbase: Create a FreeBSD-ftp package
ftp tools aren't that useful nowadays but some might want them.
Create a FreeBSD-ftp package so users have a choice to have
them or not.

Differential Revision:	https://reviews.freebsd.org/D31794
2021-09-07 10:25:23 +02:00
Emmanuel Vadot
a30235a4c3 pkgbase: Create a FreeBSD-kerberos package
This allows users to install or not kerberos related utilities
and libs.

Differential Revision:	https://reviews.freebsd.org/D31801
2021-09-07 10:23:14 +02:00
Emmanuel Vadot
cab6a39d7b pkgbase: Create a FreeBSD-rdma package
Put all the rdma related tools into this package.

Differential Revision:	 https://reviews.freebsd.org/D31799
2021-09-07 10:22:16 +02:00
Emmanuel Vadot
c7fd29f0f2 pkgbase: Create a FreeBSD-telnet package
both telnet and telnetd aren't that useful nowadays but some
might want them.
Create a FreeBSD-telnet package so users have a choice to have
them or not.

Differential Revision:	https://reviews.freebsd.org/D31791
Reviewed by: emaste
2021-09-07 10:18:11 +02:00
Alex Richardson
021385aba5 Add WITH_LLVM_BINUTILS to install LLVM binutils instead of Elftoolchain
When WITH_LLVM_BINUTILS is set, we will install the LLVM binutils as
ar/ranlib/nm/objcopy/etc. instead of the elftoolchain ones.
Having the LLVM binutils instead of the elftoolchain ones allows us to use
features such as LTO that depend on binutils that understand LLVM IR.
Another benefit will be an improved user-experience when compiling with
AddressSanitizer, since ASAN does not symbolize backtraces correctly if
addr2line is elftoolchain addr2line instead of llvm-symbolizer.
See https://lists.freebsd.org/archives/freebsd-toolchain/2021-July/000062.html
for more details.

This is currently off by default but will be turned on by default at some
point in the near future.

Reviewed By:	emaste

Differential Revision: https://reviews.freebsd.org/D31060
2021-09-06 09:49:49 +01:00
Alex Richardson
8e1c989abb Don't build and install {llvm,clang,lldb}-tblgen for the target
The tablegen binaries are only needed to build software that uses
LLVM's infrastructure for command line options,
disassembler tables, etc. They are not user-facing binaries and
should therefore not be installed by default.

Reviewed By:	emaste
Differential Revision: https://reviews.freebsd.org/D31058
2021-09-06 09:32:41 +01:00
Mitchell Horne
4d0dc60f14 xinstall: fix invocation of llvm-strip
When executing strip(1), '--' is passed as an argument to explicitly
terminate the getopt(3) loop. The option parsing in llvm-strip doesn't
support this however, so setting XSTRIPBIN=llvm-strip results in an
unsupported argument error. llvm-strip(1) is otherwise
commandline-compatible with FreeBSD's strip(1), so just use the
documented argument format that is common to both.

Special care needs to be taken for filenames beginning with a '-'.

Reviewed by:	arichardson, eugen (earlier version, both)
Discussed with:	jilles
Sponsored by:	NetApp, Inc.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D30614
2021-08-30 11:56:10 -03:00
Konstantin Belousov
17fc43bc01 ldd: Remove non-functional -v option
It seems -v only worked for a.out.  Remove it, not even keeping the current
nop for compat.  Also remove more mentions of a.out format from the man
page.

Reviewed by:	dim, emaste
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31708
2021-08-28 23:39:16 +03:00
Gordon Bergling
5bdf58e196 Fix some common typos in source code comments
- s/priviledged/privileged/
- s/funtion/function/
- s/doens't/doesn't/
- s/sychronization/synchronization/

MFC after:	3 days
2021-08-28 18:57:23 +02:00
Piotr Pawel Stefaniak
9f7a81b133 diff3: document and test -T
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D31650
2021-08-25 18:20:59 +02:00
Jessica Clarke
c8edd05426 clang: Support building with GCC and DEBUG_FILES disabled
If MK_DEBUG_FILES=no then the Clang link rule has clang as .TARGET,
rather than clang.full, causing the implicit ${CFLAGS.${.TARGET:T}} to
be CFLAGS.clang, and thus pull in flags intended for when your compiler
is Clang, not when linking Clang itself. This doesn't matter if your
compiler is in fact Clang, but it breaks using GCC as, for example,
bsd.sys.mk adds -Qunused-arguments to CFLAGS.clang. This is seen when
trying to build a bootstrap toolchain on Linux where GCC is the system
compiler.

Thus, introduce a new internal NO_TARGET_FLAGS variable that is set by
Clang to disable the addition of these implicit flags. This is a bigger
hammer than necessary, as flags for .o files would be safe, but that is
not needed for Clang.

Note that the same problem does not arise for LDFLAGS when building LLD
with BFD, since our build produces a program called ld.lld, not plain
lld (unlike upstream, where ld.lld is a symlink to lld so they can
support multiple different flavours in one binary).

Suggested by:	sjg
Fixes:		31ba4ce889 ("Allow bootstrapping llvm-tblgen on macOS and Linux")
MFC after:	1 week
Reviewed by:	dim, imp, emaste
Differential Revision:	https://reviews.freebsd.org/D31532
2021-08-24 15:04:25 +01:00
Piotr Pawel Stefaniak
3cbf98e2be diff: read whole files to determine if they are ASCII text
Before this change, only the first BUFSIZE bytes were checked.

Reviewed by:	bapt (previous version)
Differential Revision:	https://reviews.freebsd.org/D31639
2021-08-23 16:09:05 +02:00
Gordon Bergling
72a92f91f4 nfsstat(1): Fix a typo in an error message
- s/priviledged/privileged/

MFC after:	1 week
2021-08-23 09:21:28 +02:00
Piotr Pawel Stefaniak
54a3415cb6 diff3: implement --strip-trailing-cr
Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D31626
2021-08-23 07:04:28 +02:00
Piotr Pawel Stefaniak
e8ff95356c diff3.1: update manual page to match code 2021-08-23 07:04:28 +02:00
Piotr Pawel Stefaniak
702dda4368 diff3: improve style 2021-08-23 07:04:28 +02:00
Piotr Pawel Stefaniak
7f7b03f389 diff3: sync with upstream
* replace realloc calls with reallocarray calls
 * fix merging of files that lack newlines

Obtained from:	OpenBSD
2021-08-23 07:04:28 +02:00
Piotr Pawel Stefaniak
af2f016431 diff: don't output carriage returns that were stripped on input
--strip-trailing-cr worked as intended for comparison between files,
but the characters were still present in final output.
2021-08-23 07:04:28 +02:00
Thomas Munro
f30a1ae8d5 lio_listio(2): Allow LIO_READV and LIO_WRITEV.
Allow multiple vector IOs to be started with one system call.
aio_readv() and aio_writev() already used these opcodes under the
covers.  This commit makes them available to user space.

Being non-standard extensions, they're only visible if __BSD_VISIBLE is
defined, like the functions.

Reviewed by:    asomers, kib
MFC after:      2 weeks
Differential Revision:  https://reviews.freebsd.org/D31627
2021-08-22 23:00:42 +12:00
Ka Ho Ng
ce71a0fa99 truncate(1): Update tests' golden output
After commit 5ee2c35751 truncate(1)'s usage output was extended.
Update the golden output in test cases to match the changes made.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	lwhsu
Differential Revision:	https://reviews.freebsd.org/D31628
2021-08-21 17:04:21 +08:00
Ka Ho Ng
a54abe119e truncate(1): Fix missing -d option manpage
Mention that either one of the -r, -s and -d options must be specified.

Sponsored by:	The FreeBSD Foundation
2021-08-19 18:45:25 +08:00
Ka Ho Ng
5ee2c35751 truncate(1): Add hole-punching support
This commit adds hole-punching support to the truncate(1) utility. If
the option -d is specified, truncate(1) performs zeroing, and if
possible hole-punching in case the operation is supported by the
underlying file system of the specified files.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D31556
2021-08-19 18:30:41 +08:00
Ka Ho Ng
89c0d2b190 truncate(1): main() return statement style fix
Sponsored by:	The FreeBSD Foundation
2021-08-18 23:45:59 +08:00
Mark Johnston
58b1a126b9 tail: Add regression tests for -f and -F
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31055
2021-08-14 11:19:42 -04:00
Mark Johnston
7e11889959 tail: Fix -f with stdin
Based on a patch from swills@.

MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D31113
2021-08-14 11:19:32 -04:00
Gordon Bergling
288e553623 Fix a few typos in source code comments
- s/procesing/processing/

MFC after:	5 days
2021-08-14 10:08:49 +02:00
Ed Maste
866c807472 ar: remove duplicate function declaration in header
Sponsored by:	The FreeBSD Foundation
2021-08-13 16:58:18 -04:00
Ed Maste
57aaefdcec ar: diff reduction against ELF Tool Chain
Remove ar_mode_* wrappers and call ar_read_archive / ar_write_archive
directly.

(This was originally committed in d20e9e02db but reverted due to a
regression, now fixed with an update from cy@.)

Obtained from:	ELF Tool Chain
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31496
2021-08-13 11:17:46 -04:00
Ed Maste
086f090877 ar: diff reduction against ELF Tool Chain
Drop exit status from bsdar_errc.  ELF Tool Chain always returns
EXIT_FAILURE in bsdar_errc.

Recommit of one part of d20e9e02db / review D31496.

Obtained from:	ELF Tool Chain
Sponsored by:	The FreeBSD Foundation
2021-08-13 10:39:44 -04:00
Stefan Eßer
44d4804d19 usr.bin/ghä-bc, contrib/bc: update to version 5.0.0
Merge commit 2f57ecae4b

This is a new major release with a number of changes and extensions:

- Limited the number of temporary numbers and made the space for them
  static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
  and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
  environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
  and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
  left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.

MFC after:	1 week
2021-08-13 11:28:06 +02:00
Ed Maste
c5bf58add0 Revert "ar: diff reduction against ELF Tool Chain"
This reverts commit d20e9e02db.
It caused port build failures.

Reported by:	cy
2021-08-12 14:26:37 -04:00
Ed Maste
d20e9e02db ar: diff reduction against ELF Tool Chain
- Drop exit status from bsdar_errc.  ELF Tool Chain always returns
  EXIT_FAILURE in bsdar_errc.

- Remove ar_mode_* wrappers and call ar_read_archive / ar_write_archive
  directly.

Obtained from:	ELF Tool Chain
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31496
2021-08-11 19:12:46 -04:00
Ed Maste
09319f7d3f ar: remove invalid extra param in bsdar_warnc calls
A number of warnings passed an exit status code to bsdar_warnc, but it
does not take exit status (as a warning, it does not exit).

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-08-11 13:27:19 -04:00
Ed Maste
38911b3c2c ar: provide error exit status upon failure
Previously ar and ranlib returned with exit status 0 (success) in the
case of a missing file or other error.  Update to use error handling
similar to that added by ELF Tool Chain after that project forked
FreeBSD's ar.

PR:		PR257599 [exp-run]
Reported by:	Shawn Webb, gehmehgeh (on HardenedBSD IRC)
Reviewed by:	markj
Obtained from:	elftoolchain
MFC after:	2 months
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31402
2021-08-10 17:08:10 -04:00
Gordon Bergling
6bddade611 mkimg(1): Correct a typo in the usage output
- s/partion/partition/

MFC after:  5 days
2021-08-09 13:53:30 +02:00
Gordon Bergling
04389c855e Fix some common typos in comments
- s/configuraiton/configuration/
- s/specifed/specified/
- s/compatiblity/compatibility/

MFC after:	5 days
2021-08-08 10:16:06 +02:00
Ed Maste
a0d701f614 vtfontcvt: minor style(9) fixes from clang-format
Found during clang-format experiments (in D26340).

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30237
2021-08-04 15:08:21 -04:00
Warner Losh
aaccfdde3d awk: Enable tests again
Since we now pass all 24 of the NetBSD awk tests, re-enable these tests.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D31370
2021-08-02 15:53:26 -06:00
Alex Richardson
31ba4ce889 Allow bootstrapping llvm-tblgen on macOS and Linux
This is needed in order to build various LLVM binutils (e.g. addr2line)
as well as clang/lld/lldb.

Co-authored-by: Jessica Clarke <jrtc27@FreeBSD.org>
Test Plan:	Compiles on ubuntu 18.04 and macOS 11.4
Reviewed By:	dim
Differential Revision: https://reviews.freebsd.org/D31057
2021-08-02 14:36:03 +01:00
Alex Richardson
2de949cf85 Remove mkcsmapper_static and mkesdb_static from build-tools
Build them as part of the bootstrap-tools phase instead.

Reviewed by:	emaste (no objections)
Differential Revision: https://reviews.freebsd.org/D28181
2021-08-02 14:33:25 +01:00
Warner Losh
a226a9cf8e awk: use awkgram.tab.h consistently
yacc makes awkgram.h. However, one true awk includes awkgram.tab.h, so
we link to for the builds. Make sure that we consistently link to it.
Also, restore the awkgram.tab.h dependency to maketab. It should not
have been deleted, despite apparently making meta build on stable/12
work. The important missing arc was proctab.c's dependence on
awkgram.tab.h.

MFC After:	1 day (build breakage)
Fixes:		c50c8502cb
Sponsored by:	Netflix
2021-07-31 16:24:12 -06:00
Warner Losh
c50c8502cb awk: Fix dependencies
proctab.c is generated from awktab.h, so needs to depend on it.
maketab does not depend on awktab.h, and gets the maketab.c dependency
automatically, so remove them both.

Normally, these don't matter. However, for a meta build, they can cause
us to build maketab twice (once host, once for target) resulting in a
binary that can't run on the host due to proctab.c racing maketab in
parallel legs. In stable/12, this was a reliably lost race, while in
main I've been unable to trigger the race at all (maybe due to dirdep
changes making main more robust).

MFC After:	1 day (build breakage)
Reported by:	kp
Sponsored by:	Netflix
2021-07-31 15:48:26 -06:00
Warner Losh
f7f76c200a awk: Document deprecated behavior of hex constants and locales.
FreeBSD will convert "0x12" from hex and print it as 18. Other awks will
convert it to 0. This extension has been removed upstream, and will be
removed in FreeBSD 14.0.

FreeBSD used to set the locale on startup, and make the ranges use that
locale. This lead to weird results like "[A-Z]" matching lower case
characters in some locales. This bug has been fixed.

MFC After:		3 days
Sponsored by:		Netflix
2021-07-30 23:41:39 -06:00
Warner Losh
4e52f5db35 awk: Flag -Ft as deprecated behavior
Upstream is poised to deprecate the -Ft wart in one true awk. None of
the other awks do this, and the gawk maintainer says that he's had no
requests for it in gawk in 30 years maintaining it. github can find a
few instances of it in the wild. As such, warn that it's deprecated and
will go away in the future.

MFC After:		3 days
Sponsored by:		Netflix
2021-07-30 23:33:37 -06:00
Poul-Henning Kamp
272144ab41 hexdump: Flush stdout after '*' (repeat) lines.
The canonical annoying example being:   hexdump < /dev/zero | less
2021-07-29 06:40:57 +00:00
Baptiste Daroussin
fe787aa3b2 calendars: fix tabs vs space indentation 2021-07-27 18:55:31 +02:00
Robert Wing
0626b0a89c Add myself to the calendar 2021-07-24 16:12:17 -08:00
Pedro F. Giffuni
c384a27805 patch: cleanup variable initialization a bit.
musl libc fgetln is a bit more pickier.

Hinted by:	chimera-linux (git 31491e1de2e1241885984cd9e4b978965f14eda4)
2021-07-22 14:23:22 -05:00
Warner Losh
b891aedcdd awk: Add more details top the FS variable
The current description of the FS is true, but only part of the
truth. Add information about single characters and note that FS="" is
undefined by the standard, though the two other awk implenetations (mawk
and gawk) also have this interpretation.

PR:		226112
Sponsored by:	Netflix
2021-07-19 22:33:26 -06:00
Xin LI
4bcc6d14e2 Fix build
MFC after:	2 weeks
2021-07-17 22:51:28 -07:00
Xin LI
30a1828c51 less: upgrade to v590.
MFC after:	2 weeks
2021-07-17 22:20:44 -07:00
Mariusz Zaborski
24c681a7f6 grep: fix combination of quite and count flag
When the quite (-q) flag is provided, we don't expect any output.
Currently, the behavior is broken:
$ grep -cq flag util.c
1

$ grep -cs flag util.c
55

First of all, we print a number to stdout. Secondly, it just returns
0 or 1 (which is unexpected). GNU grep with c and q flags doesn't
print anything.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D31108
2021-07-09 14:09:14 +02:00
Warner Losh
f39dd6a978 one-true-awk: import 20210221 (1e4bc42c53a1) which fixes a number of bugs
Import the latest bsd-features branch of the one-true-awk upstream:

o Move to bison for $YACC
o Set close-on-exec flag for file and pipe redirects that aren't std*
o lots of little fixes to modernize ocde base
o free sval member before setting it
o fix a bug where a{0,3} could match aaaa
o pull in systime and strftime from NetBSD awk
o pull in fixes from {Net,Free,Open}BSD (normalized our code with them)
o add BSD extensions and, or, xor, compl, lsheift, rshift (mostly a nop)

Also revert a few of the trivial FreeBSD changes that were done slightly
differently in the upstreaming process. Also, our PR database may have
been mined by upstream for these fixes, and Mikolaj Golub may deserve
credit for some of the fixes in this update.

Suggested by:		Mikolaj Golub <to.my.trociny@gmail.com>
PR:			143363,143365,143368,143369,143373,143375,214782
Sponsored by:		Netflix
2021-07-07 19:25:43 -06:00
Alex Richardson
c78f449d85 usr.bin/diff: fix UBSan error in readhash
UBSan complains about the `sum = sum * 127 + chrtran(t);` line below since
that can overflow an `int`. Use `unsigned int` instead to ensure that
overflow is well-defined.

Reviewed By:	imp
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D31075
2021-07-06 12:16:40 +01:00
Alex Richardson
4d552825ec usr.bin/login: send errors to console if syslog isn't running
I was debugging why login(1) wasn't working as expected on a minimal
MFS_ROOT disk image. This image doesn't have syslogd running so the
warnings were lost and I had to use GDB to find out why login(1) was
failing (missing PAM libraries) instead of being able to see it in
the console output.

MFC after:	1 week
Reviewed By:	pfg
Differential Revision: https://reviews.freebsd.org/D30892
2021-07-06 10:51:16 +01:00
Alex Richardson
d053fb22f6 usr.bin/sort: Avoid UBSan errors
UBSan complains about out-of-bounds accesses for zero-length arrays. To
avoid this we can use flexible array members. However, the C standard does
not allow for structures that only contain flexible array members, so we
move the length parameters into that structure too.

Split out from D28233.

Reviewed By:	markj
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D31009
2021-07-06 10:51:05 +01:00
Li-Wen Hsu
1678975109
freebsd-tips: Fix the description of fetch(1) to match the command
Reported by:	jrtc27
MFC with:	ffe6afc4f0
2021-07-05 10:14:25 +08:00
Li-Wen Hsu
ffe6afc4f0
freebsd-tips: Use a fetchable URL as example
MFC after:	3 days
2021-07-04 22:00:46 +08:00
Alex Richardson
89da04fcaa Revert "Remove lib/kyua from the build"
Accidentally removed it from the wrong file...

This reverts commit 8ec4ba8a76.
2021-07-02 10:17:03 +01:00
Alex Richardson
8ec4ba8a76 Remove lib/kyua from the build
I forgot to include this line in 2eb9ad4274.

Reported by:	Jenkins CI
MFC after:	1 week
Fixes:		2eb9ad427475190ei ("Simplify and speed up the kyua build")
2021-07-02 09:56:05 +01:00
Alex Richardson
2eb9ad4274 Simplify and speed up the kyua build
Instead of having multiple kyua libraries, just include the files as part
of usr.bin/kyua. Previously, we would build each kyua source up to four
times: once as a .o file and once as a .pieo. Additionally, the kyua
libraries might be built again for compat32. As all the kyua libraries
amount to 102 C++ sources the build time is significant (especially when
using an assertions enabled compiler). This change ensures that we build
306 fewer .cpp source files as part of buildworld.

Reviewed By:	brooks
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D30967
2021-07-02 09:21:05 +01:00
Edward Tomasz Napierala
acb1f1269c proccontrol(1): implement 'nonewprivs'
This adds the 'nonewprivs' mode, corresponding to newly added
procctl(2) commands PROC_NO_NEW_PRIVS_CTL and PROC_NO_NEW_PRIVS_STATUS.

Reviewed By:	kib
Sponsored By:	EPSRC
Differential Revision:	https://reviews.freebsd.org/D30940
2021-07-02 08:50:36 +01:00
Stefan Eßer
c5b8d7b7c1 netstat: Fix typo
Correct spelling of "received packers" to "received packets".

PR:		256926
Reported by:	ghuckriede@blackberry.com
MFC after:	3 days
2021-07-02 08:42:34 +02:00
Ceri Davies
d93a2f5d67 fortune: correct documentation of default FORTUNE_PATH.
While here, fix a typo in a comment relating to FORTUNE_PATH
2021-07-01 14:02:00 +01:00
John Grafton
a00d703f2f top(1): support command name and argument grepping
Obtained from:  OpenBSD
Reviewed by:	imp@
Pull Request:	https://github.com/freebsd/freebsd-src/pull/479
2021-06-29 17:51:18 -06:00
Simon J. Gerraty
68c4481aac Update to bmake-20210621
MFC after:	1 week
2021-06-25 16:02:40 -07:00
Jose Luis Duran
d98a4eb807 mkimg: Add fat32lba partition type
Syntactic sugar for a `gpart add -t '!12' ...` equivalent.

Reviewed by:	emaste
Pull Request:	https://github.com/freebsd/freebsd-src/pull/484
2021-06-21 21:04:58 -04:00
Mark Johnston
6fa0b2893f diff tests: Require root for report_identical
This test switches users and either hangs or fails when run as an
unprivileged user.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-06-21 11:07:03 -04:00
Warner Losh
b77e235dd5 banner: Correct history.
Banner appeared in the 6th edition of AT&T Research unit. It was
subsequently on all the Berkeley tapes, as well as PWB, System III and
System V. The PWB/AT&T and BSD banner programs were different, and the
current FreeBSD banner program shares many elements of the 3BSD one,
though the font has changed.

Sponsored by:		Netflix
2021-06-21 08:40:54 -06:00
Warner Losh
3c22b4f832 vmstat: correct history
vmstat dates back to 3BSD, but wasn't in 32V nor the 7th edition. It
does not seem to have been in AT&T's commercial offerings at all.

Sponsored by:		Netflix
2021-06-21 08:40:54 -06:00
Warner Losh
f394c73666 basename: fix history
Basename(1) first appeared in the 7th edition. It was not in the 6th
edition, or PWB releases. It's on all the subsequent descendants.

Dirname(1) first appeared in System III, and was later picked up in
4.3-Reno and 8th edition research unix (though was not in 4.1BSD where
the bulk of 8th edition came from). In System III and V8 it was a shell
script, though the BSD version is in C.

Sponsored by:		Netflix
2021-06-21 08:40:54 -06:00
Emmanuel Vadot
081fb64492 pkgbase: Create a FreeBSD-nfs package
And move all the nfs related commands there.

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D30754
Sponsored by:	Diablotin Systems
2021-06-19 17:49:50 +02:00
Mariusz Zaborski
7ad30f58dd sockstat: use cap_pwd
The sockstat is using password database operations to obtain
the username. Such operations are disallowed in capability mode.
For such operations Casper is required.

Reported by:	olivier@
Tested by:	olivier@
2021-06-18 18:08:30 +02:00
Mariusz Zaborski
bfb5947bb1 sockstat: fix core dump
The get_proto_type function is used before creating the Casper function.
This is why we have to distinguish when the Casper service is allocated or not.

Reported by:	olivier@
Tested by:	olivier@
2021-06-18 18:05:14 +02:00
Cyril Zhang
68d3790ba0 sort: Change default algorithm to mergesort
This results in a significant improvement in the runtime of sort(1) when
radix sort cannot be used.  This comes at the expense of increased
memory usage, but this is small relative to sort's overall memory usage.

PR:		255551
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30319
2021-06-17 13:53:03 -04:00
Alex Richardson
31dddc6a19 truss: minor cleanup and pedantic warning fixes
Noticed while porting the recent truss compat32 changes to CheriBSD.
This also fixes i386 tracing by zero-extending user addresses instead
of sign-extending them.

Reviewed By:	jhb
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D30211
2021-06-16 16:35:55 +01:00
Alex Richardson
8ba2e89e98 truss: fix handling of 64-bit arguments/return values for compat32
Deciding whether to combine two values to a 64-bit one should be based on
the process ABI, and not dependent on whether truss is compiled for an
LP64 ABI. This is a follow-up cleanup for D27625. I found this while
looking for uses of the `__LP64__` macro (since using this is wrong for
CHERI systems).

Test Plan: truss still works. Since I tested on AMD64 and all syscalls
in the trace have their quad argument last there was no difference
in the output. Should fix output for compat32 on MIPS64 though.

Reviewed By:	jhb
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D27637
2021-06-16 16:29:57 +01:00
Alex Richardson
1a3a57d745 kdump: use VIS_NOLOCALE when printing output
Attempting to parse the output as UTF-8 exposed an out-of-bounds read
in vis(3) (see https://reviews.freebsd.org/D30771). However, I don't
think it makes much sense to decode this output at all. Additionally,
passing one byte at a time will almost certainly result in incorrect
output for multi-byte characters.

Reviewed By:	brooks
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D30772
2021-06-16 16:28:27 +01:00
Alan Somers
4a06e93773 id: sanitize arguments better
The -[AMc] flags ignore the user argument.  Better if id rejects
invocations that include a user argument along with any of those flags.

PR:		256554
MFC after:	2 weeks
Reviewed by:	trasz
Sponsored by:	Axcient
Differential Revision: https://reviews.freebsd.org/D30734
2021-06-15 06:51:16 -06:00
Dimitry Andric
d409305fa3 Merge llvm-project 12.0.0 release
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12.0.0-0-gd28af7c654d8, a.k.a. 12.0.0 release.

PR:		255570
MFC after:	6 weeks
2021-06-13 22:01:15 +02:00
Dimitry Andric
e8d8bef961 Merge llvm-project main llvmorg-12-init-17869-g8e464dd76bef
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-12-init-17869-g8e464dd76bef, the last commit before the
upstream release/12.x branch was created.

PR:		255570
MFC after:	6 weeks
2021-06-13 21:37:19 +02:00
John Baldwin
0333fad1b7 Remove svnlite.
Reviewed by:	bcr, imp, emaste
Differential Revision:	https://reviews.freebsd.org/D30737
2021-06-11 14:56:41 -07:00
Michael Gmelin
278e370066 freebsd-tips: Add fortune on kern.tty_info_kstacks
Add fortune explaining how to use `sysctl kern.tty_info_kstacks' to
alter the output of ^T (tty info).

Reviewed by: ceri
Differential Revision: https://reviews.freebsd.org/D30388
2021-06-09 23:35:38 +02:00
Jessica Clarke
6d2648bcab tip: Fix pointer-vs-integer confusion
Currently IREMOTE assumes that every value is (initially) a pointer to a
long. This is true for NUMBERs, but false for STRINGs, which are instead
pointers to pointers, though on ILP32 and LP64 systems these happen to
have the same representation, but this is still a strict aliasing
violation, and of course breaks on systems where the representations are
not the same, such as CHERI. We do not currently have any BOOLs (short,
curiously) or CHARs used with IREMOTE, though the code should not be
relying on that.

This removes the unused setaddress macro, and the now-unused address
macro due to the above issue.

Reviewed by:	imp, kib
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D30697
2021-06-08 18:30:59 +01:00
Jessica Clarke
de295884c4 tip: Cast via intptr_t not long when casting between pointer and int
Whilst all FreeBSD architectures have the same representation for
intptr_t and long (even if the former is int on ILP32 architectures),
this is more general and correct, and on CHERI they are not the same so
warnings are generated by default for integer-to-pointer casts that
aren't via (u)intptr_t.

Reviewed by:	imp, kib
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D30696
2021-06-08 18:30:59 +01:00
Stefan Eßer
35b8fd0b69 usr.bin/calendar: do not treat // in text as comment
The C++-style comment marker "//" has been added with the rewrite of
the preprocessor features. Since this character sequence occurs	in
ULRS, the reminder of the URL was considered a comment and stripped
from the calendar line.

Change parsing of "//" to only start a comment at the begin of a line
or when	preceeded by a white-space character.

PR:		256455
Reported by:	Philippe Michel (philippe.michel7 at free.fr)
MFC after:	3 days
2021-06-07 15:55:23 +02:00
Ryan Moeller
c5a2d8c5f5 sockstat: Use libcasper to capsicumize
Drop rights we do not need. This has to be done after jail_attach.

Reviewed by:	oshogbo
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D26958
2021-06-05 08:36:55 -04:00
jocki84
8790fe3058 Fix confusing example in paste(1)
Paste's man page contains an example for a reimplementation of
nl(1). This example uses the command line
    sed = myfile | paste -s -d '\t\n' - -
in order to concatenate consecutive lines with an intervening tab.

However, the way the example uses the switches -s and -d and two `dash`
input files is redundant. There are in fact two equivalent but simpler
ways to achieve the desired result:
    sed = myfile | paste -s -d '\t\n' -
uses the same style as the previous example, while
    sed = myfile | paste - -
is arguably even simpler and illustrates the final sentence of the
DESCRIPTION.

Reviewed by:		imp@
Pull Request:		https://github.com/freebsd/freebsd-src/pull/163
2021-05-31 16:12:44 -06:00
Ed Maste
3f2508b7f3 elfctl: avoid touching file if no change made
Suggested by:	brooks
Reviewed by:	brooks, markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30452
2021-05-26 10:12:12 -04:00
Ceri Davies
17054abf5b usr.bin/chpass: Correct manpage regarding path to temp files
Approved by:	blackend (mentor)
2021-05-25 16:23:20 +01:00
Baptiste Daroussin
6680e5a52f import nvi 2.2.0-3bbdfe4 2021-05-21 22:51:21 +02:00
Marcin Wojtas
4a27bf128b usr.bin/elfctl: Allow for cross-endian operations.
Detect if host endian is different than target endian and swap
byte order of ELF note fields instead of failing.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Reviewed by: imp
Obtained from: Semihalf
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D29550
2021-05-21 15:32:04 +02:00
Wojciech Macek
741afc6233 ip_mroute: refactor bw_meter API
API should work as following:
- periodicaly report Lower-or-EQual bandwidth (LEQ) connections
  over kernel socket, if user application registered for such
  per-flow notifications
- report Grater-or-EQual (GEQ) bandwidth as soon as it reaches
  specified value in configured time window

Custom implementation of callouts was removed. There is no
point of doing calout-wheel here as generic callouts are
doing exactly the same. The performance is not critical
for such reporting, so the biggest concern should be
to have a code which can be easily maintained.

This is ia preparation for locking rework which is highly inefficient.

Approved by:    mw
Sponsored by:   Stormshield
Obtained from:  Semihalf
Differential Revision:  https://reviews.freebsd.org/D30210
2021-05-21 06:43:41 +02:00
Ceri Davies
c1a148873d sys/*/conf/*, docs: fix links to handbook
While here, fix all links to older en_US.ISO8859-1 documentation
in the src/ tree.

PR:             255026
Reported by:    Michael Büker <freebsd@michael-bueker.de>
Reviewed by:    dbaio
Approved by:    blackend (mentor), re (gjb)
MFC after:      10 days
Differential Revision: https://reviews.freebsd.org/D30265
2021-05-20 09:27:10 +01:00
Mark Johnston
186ba88a7c sort: Hook NetBSD tests up to the build
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-05-13 09:34:01 -04:00
Cyril Zhang
71ec05a212 sort: Cache value of MB_CUR_MAX
Every usage of MB_CUR_MAX results in a call to __mb_cur_max.  This is
inefficient and redundant.  Caching the value of MB_CUR_MAX in a global
variable removes these calls and speeds up the runtime of sort.  For
numeric sorting, runtime is almost halved in some tests.

PR:		255551
PR:		255840
Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30170
2021-05-13 09:33:19 -04:00
Cyril Zhang
fa43162c63 sort: Stop "fixing" obsolete key syntax after -- flag
PR:		255798
Reviewed by:	markj
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30234
2021-05-13 09:33:19 -04:00
Ceri Davies
82483ea7ad find(1): Document the -f option
PR:	223127
Reported by:	Mathieu Arnold <mat at FreeBSD dot org>
Reviewed by:	bcr, gbe
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D30215
2021-05-13 10:10:22 +02:00
Mark Johnston
cd497bd40b truss: Decode FreeBSD 11 mknod(2) and mknodat(2)
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-05-12 12:52:05 -04:00
Alex Richardson
3cbad8287a truss: Add missing underscore to compat_prefix for FreeBSD32
I accidentally dropped this in the final version of D27625, so it didn't
actually work as intended. I found this while testing the MFC to stable/13.

MFC after:	immediately
Fixes:		7daca4e204 ("truss: improved support for decoding compat32 arguments")
2021-05-11 10:53:02 +01:00
Kirk McKusick
9e16b9530a Clean up copyright messages.
Reported by:  Yoshihiro Ota
MFC after:    3 days
Differential Revision: https://reviews.freebsd.org/D29354
2021-05-10 23:14:35 -07:00
Richard Scheffenegger
c55b340f82 netstat: fix typo from 0471a8c734 2021-05-10 20:49:19 +02:00
Richard Scheffenegger
0471a8c734 tcp: SACK Lost Retransmission Detection (LRD)
Recover from excessive losses without reverting to a
retransmission timeout (RTO). Disabled by default, enable
with sysctl net.inet.tcp.do_lrd=1

Reviewed By: #transport, rrs, tuexen, #manpages
Sponsored by: Netapp, Inc.
Differential Revision: https://reviews.freebsd.org/D28931
2021-05-10 19:06:20 +02:00
Konstantin Belousov
73e8f06ac5 gcore: add option to dump core using kernel facility
-k switch causes gcore to use ptrace(PT_COREDUMP) instead of manually
reading process memory and constructing the core.

Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29955
2021-05-03 19:18:26 +03:00
Konstantin Belousov
c192228b73 gcore: split code to open core file into helper
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D29955
2021-05-03 19:18:26 +03:00
Xin LI
f6b6d216ca usr.bin/netstat: use roundup2 when rounding up to power of 2.
MFC after:	 2 weeks
2021-05-02 09:30:22 -07:00
Xin LI
9769f6f808 usr.bin/patch: remove unneeded header.
MFC after:	2 weeks
2021-05-02 09:27:32 -07:00
Andrew Turner
2abd4f8581 Add a way to map arm64 non-posted device memory
On arm64 we currently use a non-posted write for device memory, however
we should move to use posted writes. This is expected to work on most
hardware, however we will need to support a non-posted option for some
broken hardware.

Reviewed by:	imp, manu, bcr (manpage)
Differential Revision:	https://reviews.freebsd.org/D29722
2021-05-01 06:01:20 +00:00
Thomas Munro
3aaaa2efde poll(2): Add POLLRDHUP.
Teach poll(2) to support Linux-style POLLRDHUP events for sockets, if
requested.  Triggered when the remote peer shuts down writing or closes
its end.

Reviewed by:	kib
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D29757
2021-04-28 23:00:31 +12:00
Michael Reifenberger
6648383803 systat: Handle SIGWINCH to properly window resizing and adjust
-swap disk stat based on new size.

Display corrupts after resizing a window.
Process SIGWINCH to redraw all window.

Submitted by:   Yoshihiro Ota ota@j.email.ne.jp
Differential Revision:  https://reviews.freebsd.org/D29337
2021-04-21 20:31:58 +02:00
Michael Reifenberger
dcc2fb3707 systat: Avoid incorrect reallocation in pigs.c
Stop free() even if kvm_getprocs as we can come back but set nprocs = 0.
Check nprocs in showpigs() to ensure not try displaying with kvm_getprocs failed.
Current code can have pt with non-null after kvm_getprocs() failure.

Replace to realloc for simpler operations.

Submitted by:	Yoshihiro Ota ota@j.email.ne.jp
Reviewed by:	mckusick@
Differential Revision:	https://reviews.freebsd.org/D29303
2021-04-21 20:09:21 +02:00
Alex Richardson
c6e66cbfbb usr.bin/lex: regenerate bootstrap files after d37f81e35b
Reviewed by:	jkim
2021-04-21 10:56:29 +01:00
Alex Richardson
3bca8d2b32 Revert "contrib/flex: Drop local __dead2 patch"
I missed the review comment to commit the changes separately, will
reland in multiple smaller commits.

Requested By:   jkim
This reverts commit bbd421cdf6.
2021-04-21 10:48:47 +01:00
Alex Richardson
bbd421cdf6 contrib/flex: Drop local __dead2 patch
Upstream flex has added a yynoreturn, so this diff is no longer needed.
Partially reverts r181269. Also regenerate the pre-generated files that
are used for bootstrapping.

Reviewed By:	jkim

Differential Revision: https://reviews.freebsd.org/D29679
2021-04-20 01:46:42 +01:00
Jung-uk Kim
686cf5468c flex: Regen bootstrap files
This also partially reverts r326025 (8a16b7a18f).  I do not see any
point of adding SPDX tag in generated file.

MFC after:	3 days
Submitted by:	Dan McGregor <dan.mcgregor@usask.ca> (initial version)
Differential Revision:	https://reviews.freebsd.org/D28596
2021-04-19 14:20:51 -04:00
Xin LI
2235c7feac less: upgrade to v581.
MFC after:	2 weeks
2021-04-18 19:46:19 -07:00
Michael Tuexen
9e644c2300 tcp: add support for TCP over UDP
Adding support for TCP over UDP allows communication with
TCP stacks which can be implemented in userspace without
requiring special priviledges or specific support by the OS.
This is joint work with rrs.

Reviewed by:		rrs
Sponsored by:		Netflix, Inc.
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D29469
2021-04-18 16:16:42 +02:00
Mateusz Piotrowski
16e0391f8e Fix zgrep --version
"zgrep --version" is expected to print the version information in the
same way as "zgrep -V". However, the case handling the --version flag
is never reached, so "zgrep --version" prints:
    zgrep: missing pattern
instead of:
    grep (BSD grep, GNU compatible) 2.6.0-FreeBSD

Reviewed by:	yuripv
Approved by:	yuripv (src)
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D29813
2021-04-18 10:20:11 +02:00
Mateusz Piotrowski
be6b8b7a3a grep: Fix an incorrect description of the -C flag
It seems that the number of lines is no longer an optional parameter to
the -C flag. Document it accordingly both in the manual page and the
usage message.

Reviewed by:	yuripv
Approved by:	yuripv
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D28509
2021-04-17 22:35:15 +02:00
Andrew Turner
15221c552b Use if ... else when printing memory attributes
In vmstat there is a switch statement that converts these attributes to
a string. As some values can be duplicate we have to hide these from
userspace.

Replace this switch statement with an if ... else macro that lets us
repeat values without a compiler error.

Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D29703
2021-04-11 10:58:46 +00:00
Gordon Bergling
97fa288a66 m4(1): Add a SEE ALSO section and reference an AT&T manual
Obtained from:	OpenBSD
MFC after:	1 week
2021-04-08 21:16:54 +02:00
Gordon Bergling
9048d9a933 sed(1): Add a reference for a 4.4BSD manual document
Obtained from:	OpenBSD
MFC after:	1 week
2021-04-08 21:07:31 +02:00
Stefan Eßer
b55a927bc8 [bc] Update to version 4.0.0
This version fixes an issue (missing pop of top-of-stack value in the
"P" command of the dc program).

This issue did not affect the bc program, since it does not use dc as
an back-end to actually perform the calculations as was the case with
the traditional bc and dc programs.

The major number has been bumped due to Windows support that has been
added to this version. It does not correspond to a major change that
might affect FreeBSD.

MFC after:   3 days
2021-04-06 11:57:07 +02:00
Alexander V. Chernikov
4084b1ab04 Fix netstat -rs reporting.
rttrash (unused but not yet delete entries) were eliminated
 during routing rework. Remove reading these symbols from the kernel.

PR:		254681
Reported by:	rashey@superbox.pl
MFC after:	immediately
2021-03-31 20:59:10 +00:00
Daniel Ebdrup Jensen
646bae45e1 fortune/freebsd-tips: Fix markup and wording
'ps' is not a word - rather, it is a utility with its own manual page.
As every other utility referenced in the file has it, append the
relevant manual section that ps(1) can be found in.

While here, also wordsmith a sentence to avoid awkward phrasing, and fix
a typo.

Pointy hat to:	me
Reported by:	danfe, brueffer, maxim
2021-03-31 13:10:30 +02:00