Commit Graph

14893 Commits

Author SHA1 Message Date
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