Commit Graph

14964 Commits

Author SHA1 Message Date
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
Daniel Ebdrup Jensen
c2a39987e6 fortune/freebsd-tips: Add a few fortunes
These are fortunes I've used locally, probably for decades, so there's
no reason why they shouldn't be available to everyone.
2021-03-30 19:35:50 +02:00
Daniel Ebdrup Jensen
5478176319 fortune/freebsd-tips: Remove errant spaces
I noticed these errant spaces while removing a bogus fortune, and
decided I might as well fix them.

While here, reflow a line to it within 80 columns
2021-03-30 19:05:05 +02:00
Daniel Ebdrup Jensen
968ad154ce fortune/freebsd-tips: Remove bogus fortune
The RCS IDs have been retired as of the move to git, so on 14-CURRENT
and 13.0-STABLE this fortune returns the following.

This fortune brought to you by:
$FreeBSD$

While faintly amusing the first time, this might just cause confusion
for folks, and in addition it's not the most useful of tips, so doesn't
add much.

Therefore it seems prudent to get rid of it.

MFC:		Not to 11-STABLE or 12-STABLE.
2021-03-30 18:59:55 +02:00
Alex Richardson
7daca4e204 truss: improved support for decoding compat32 arguments
Currently running `truss -a -e` does not decode any
argument values for freebsd32_* syscalls (open/readlink/etc.)

This change checks whether a syscall starts with freebsd{32,64}_ and if
so strips that prefix when looking up the syscall information. To ensure
that the truss logs include the real syscall name we create a copy of
the syscall information struct with the updated.

The other problem is that when reading string array values, truss
naively iterates over an array of char* and fetches the pointer value.
This will result in arguments not being loaded if the pointer is not
aligned to sizeof(void*), which can happens in the compat32 case. If it
happens to be aligned, we would end up printing every other value.
To fix this problem, this changes adds a pointer_size member to the
procabi struct and uses that to correctly read indirect arguments
as 64/32 bit addresses in the the compat32 case (and also compat64 on
CheriBSD).

The motivating use-case for this change is using truss for 64-bit
programs on a CHERI system, but most of the diff also applies to 32-bit
compat on a 64-bit system, so I'm upstreaming this instead of keeping it
as a local CheriBSD patch.

Output of `truss -aef ldd32 /usr/bin/ldd32` before:
39113: freebsd32_mmap(0x0,0x1000,0x3,0x1002,0xffffffff,0x0,0x0) = 543440896 (0x20644000)
39113: freebsd32_ioctl(0x1,0x402c7413,0xffffd2a0) = 0 (0x0)
/usr/bin/ldd32:
39113: write(1,"/usr/bin/ldd32:\n",16)		 = 16 (0x10)
39113: fork()					 = 39114 (0x98ca)
39114: <new process>
39114: freebsd32_execve(0xffffd97e,0xffffd680,0x20634000) EJUSTRETURN
39114: freebsd32_mmap(0x0,0x20000,0x3,0x1002,0xffffffff,0x0,0x0) = 541237248 (0x2042a000)
39114: freebsd32_mprotect(0x20427000,0x1000,0x1) = 0 (0x0)
39114: issetugid()				 = 0 (0x0)
39114: openat(AT_FDCWD,"/etc/libmap32.conf",O_RDONLY|O_CLOEXEC,00) ERR#2 'No such file or directory'
39114: openat(AT_FDCWD,"/var/run/ld-elf32.so.hints",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
39114: read(3,"Ehnt\^A\0\0\0\M^@\0\0\0#\0\0\0\0"...,128) = 128 (0x80)
39114: freebsd32_fstat(0x3,0xffffbd98)		 = 0 (0x0)
39114: freebsd32_pread(0x3,0x2042f000,0x23,0x80,0x0) = 35 (0x23)
39114: close(3)					 = 0 (0x0)
39114: openat(AT_FDCWD,"/usr/lib32/libc.so.7",O_RDONLY|O_CLOEXEC|O_VERIFY,00) = 3 (0x3)
39114: freebsd32_fstat(0x3,0xffffc7d0)		 = 0 (0x0)
39114: freebsd32_mmap(0x0,0x1000,0x1,0x40002,0x3,0x0,0x0) = 541368320 (0x2044a000)

After:
  783: freebsd32_mmap(0x0,4096,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON|MAP_ALIGNED(12),-1,0x0) = 543543296 (0x2065d000)
  783: freebsd32_ioctl(1,TIOCGETA,0xffffd7b0)    = 0 (0x0)
/usr/bin/ldd32:
  783: write(1,"/usr/bin/ldd32:\n",16)           = 16 (0x10)
  784: <new process>
  783: fork()                                    = 784 (0x310)
  784: freebsd32_execve("/usr/bin/ldd32",[ "(null)" ],[ "LD_32_TRACE_LOADED_OBJECTS_PROGNAME=/usr/bin/ldd32", "LD_TRACE_LOADED_OBJECTS_PROGNAME=/usr/bin/ldd32", "LD_32_TRACE_LOADED_OBJECTS=yes", "LD_TRACE_LOADED_OBJECTS=yes", "USER=root", "LOGNAME=root", "HOME=/root", "SHELL=/bin/csh", "BLOCKSIZE=K", "MAIL=/var/mail/root", "MM_CHARSET=UTF-8", "LANG=C.UTF-8", "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/root/bin", "TERM=vt100", "HOSTTYPE=FreeBSD", "VENDOR=amd", "OSTYPE=FreeBSD", "MACHTYPE=x86_64", "SHLVL=1", "PWD=/root", "GROUP=wheel", "HOST=freebsd-amd64", "EDITOR=vi", "PAGER=less" ]) EJUSTRETURN
  784: freebsd32_mmap(0x0,135168,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 541212672 (0x20424000)
  784: freebsd32_mprotect(0x20421000,4096,PROT_READ) = 0 (0x0)
  784: issetugid()                               = 0 (0x0)
  784: sigfastblock(0x1,0x204234fc)              = 0 (0x0)
  784: open("/etc/libmap32.conf",O_RDONLY|O_CLOEXEC,00) ERR#2 'No such file or directory'
  784: open("/var/run/ld-elf32.so.hints",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
  784: read(3,"Ehnt\^A\0\0\0\M^@\0\0\0\v\0\0\0"...,128) = 128 (0x80)
  784: freebsd32_fstat(3,{ mode=-r--r--r-- ,inode=18680,size=32768,blksize=0 }) = 0 (0x0)
  784: freebsd32_pread(3,"/usr/lib32\0",11,0x80) = 11 (0xb)

Reviewed By:	jhb
Differential Revision: https://reviews.freebsd.org/D27625
2021-03-25 11:14:13 +00:00
Dmitry Chagin
9e5aeba51b Fix warning about signed comparison and drop WARNS for ktrdump(8).
Reviewed By:		jhb, imp
MFC after:		1 week
Differential Revision:	https://reviews.freebsd.org/D29381
2021-03-24 10:51:25 +03:00
Gordon Bergling
a9275d996c ls(1): Refine the HISTORY within the manual page.
A simple find command appeared in Version 1 AT&T UNIX and was removed in
Version 3 AT&T UNIX. It was rewritten for Version 5 AT&T UNIX and later
be enhanced for the Programmer's Workbench (PWB). These changes were
later incorporated in AT&T UNIX v7.

Reviewed by:	imp
MFC after:	1 week
2021-03-13 19:28:26 +01:00
Gordon Bergling
5666643a95 Fix some common typos in comments
- occured -> occurred
- normaly -> normally
- controling -> controlling
- fileds -> fields
- insterted -> inserted
- outputing -> outputting

MFC after:	1 week
2021-03-13 18:26:15 +01:00
Brad Davis
b8e12d2d5c Improve the wording for showing the brightness level
Reviewed by:	allanjude
2021-03-12 09:45:14 -07:00
Mark Murray
cc011d8719 Remove the never-installed setchannel(1) utility. It only work(s|ed)
with the never-committed cxm(4) driver and the now-removed bktr(4)
driver.
2021-03-07 00:06:42 +00:00
Bryan Drewery
eb8bf6bb42 Fix 'make bmake' top-level bootstrapping.
Fixes:	ee10666327
2021-03-06 09:45:08 -08:00
Alex Richardson
6019514b0b truss: split counting of syscalls and syscall calling convention
This change is a refactoring cleanup to improve support for compat32
syscalls (and compat64 on CHERI systems). Each process ABI now has it's
own struct sycall instead of using one global list. The list of all
syscalls is replaced with a list of seen syscalls. Looking up the syscall
argument passing convention now interates over the fixed-size array instead
of using a link-list that's populated on startup so we no longer need the
init_syscall() function.
The actual functional changes are in D27625.

Reviewed By:	jhb
Differential Revision: https://reviews.freebsd.org/D27636
2021-03-04 18:30:02 +00:00
Fernando Apesteguía
fc1e79740e compress(1): warn about link handling
compress(1) handles links badly and does not provide link-handling options.
Document this behavior.

PR:     84271
Submitted by: garys@opusnet.com
Approved by: gbe@ (mentor)
Differential Revision:	https://reviews.freebsd.org/D28552
2021-03-04 14:52:12 +01:00
Kyle Evans
0c1a5eaae8 env: style(9) fix, add a space
Reported by:	pstef
Fixes:	55deb0a5f0 ("service(8): use an environment more [...]")
2021-03-03 14:21:56 -06:00
Andrew Gierth
55deb0a5f0 service(8): use an environment more consistent with init(8)
init(8) sets the "daemon" login class without specifying a pw
entry (so no substitutions are done on the variables). service(8)'s
use of env -L had the effect of specifying root's pw entry, with two
effects: getpwnam and getpwuid are being called, which may not be
entirely safe depending on what nsswitch is up to and what stage of
boot we are at, and substitutions would have been done.

Fix by teaching env(8) to allow -L -/classname to set the class
environment with no pw entry at all specified, and use it in
service(8).

PR:		253959
2021-03-03 12:25:11 -06:00
Emmanuel Vadot
1df30489a8 backlight(8): Add note that with option it print the current brightness.
MFC after:    3 days
PR: 	      253737
2021-03-03 09:00:42 +01:00
David Schlachter
3b005d51bd backlight: Fix incr/decr with percent value of 0
This now does nothing instead of incr/decr by 10%

MFC After:    3 days
PR: 	      253736
2021-03-03 08:57:35 +01:00
Alan Somers
60a632f047 fortune: add a tip about gstat
MFC after:	3 weeks
2021-02-26 08:06:07 -07:00
Emmanuel Vadot
8f3c71c85e mkimg: Add support for offset if the source is an image
This allow us to create image with the following format:
mkimg -v -o sdcard -s gpt -p efi:=esp_aarch64.img:1M -p freebsd-ufs::1G

Which will add a efi partition at a 1M offset on the image with its content
coming from the esp_aarch64.img file.

MFC after:	3 days
2021-02-25 18:11:50 +01:00
Emmanuel Vadot
3b6268bb9e mkimg: We always want the last block of the last inserted partition
Even with an absolute offset we want to know the last block the partition
otherwise we endup with an image the size of the metadata.
This allow to create image with the ESP placed at a specific position which
is useful on arm/arm64 where u-boot have always a hard time to read the ESP
if it's not aligned on 512k.
mkimg -v -o sdcard -s gpt -p efi::54M:1M -p freebsd-ufs::1G
now works.

MFC after:	3 days
2021-02-25 16:34:28 +01:00
Baptiste Daroussin
61f66a1f44 ncurses: Add support for terminfo database
Along with the termcap database, ncurses will now lookup for the
terminfo database, note that the terminfo database is being looked
up first and then it fallsback on the termcap one.

While here drop our custom reader for the termcap database, over the
time it is needed maintenance to be able to catchup with changes on ncurses
side.

Install the ncurses tools which are needed to deal with the terminfo
database: tic, infocmp, toe

Replace our termcap only aware tools with the ncurses counterpart:
tput, tabs, tset, clear and reset

In particular they can your the extra capabilities described in the
terminfo database, which does not exist in termcap

Note that to add a new terminfo information to the database from ports
the ports will just need to add their extra information into:
/usr/local/share/site-terminfo/<firstletteroftheterm>/<term>

Tested by:	jbeich, manu
2021-02-25 14:25:11 +01:00
Nathan Whitehorn
f7aebfbe5c Add GPT PREP-boot type to mkimg(1) from geom_gpt.
This partition type can be used to boot some PowerKVM VMs. We don't
support it well because of some limitations in SLOF, but it's worth at
least have feature parity in geom and mkimg.
2021-02-24 10:31:44 -05:00
Daniel Ebdrup Jensen
75e6f664c4 find(1): Mark -not as an extensions to POSIX
While here, change mdoc macro from Ic to Fl.

PR:		253499
Reported by:	Michael Siegel <bugcounterism at malbolge.net>
2021-02-23 17:15:35 +01:00
Rajesh Kumar M A
9f6cf1426f Source repo changes to add new committer Rajesh Kumar M A
Approved by: vmaffione, gallatin

Differential Revision: https://reviews.freebsd.org/D28586
2021-02-16 08:52:09 +00:00