Commit graph

15023 commits

Author SHA1 Message Date
Mike Karels
913ebccc8e netstat -i: do not truncate interface names
The field for interface names for netstat -i was 5 characters by
default, which is no longer sufficient with names like "vlan1234"
and "vtnet0".  netstat -iW computed the necessary field width, but
also enlarged the address field by a lot (especially with IPv6 enabled).
Make netstat -i compute the field width for interface names with or
without -W.  Note that the existing default output does not fit in
80 columns in any case.  Update the man page accordingly, documenting
the remaining effect of -W with -i.  Also add -W to the list of
General Options, as there are numerous pointers to this.

Reported by:	Chris Ross
Reviewed by:	melifaro, rgrimes, cy
Differential Revision: https://reviews.freebsd.org/D35703

(cherry picked from commit 231092bb6f)
2022-07-13 08:20:03 -05:00
Warner Losh
82a8b8f0cf lastcomm/sa: Remove sparc64 tests, they aren't needed.
Fix delete-old, since 22375931 MFC, annoy to delete them manually
every make delete-old.

These tests will run only on a sparc64 system, and so never run anymore.

Sponsored by:		Netflix

(cherry picked from commit d6dffbae96)
2022-07-13 14:17:40 +03:00
Dmitry Chagin
5bdeed846d kdump: Decode Linux *at() syscalls
MFC after:		2 weeks

(cherry picked from commit 4d496ab44a)
2022-07-06 14:02:15 +03:00
Dmitry Chagin
b330e63846 kdump: For future use made decode_filemode() public
MFC after:		2 weeks

(cherry picked from commit ed2f123a21)
2022-07-06 14:02:15 +03:00
Dmitry Chagin
29ef2caa02 kdump: Decode Linux clock_nanosleep syscall
MFC after:		2 weeks

(cherry picked from commit 39de84b619)
2022-07-06 14:02:14 +03:00
Dmitry Chagin
4ec7625e66 kdump: Decode Linux sigprocmask how argument
MFC after:		2 weeks

(cherry picked from commit f587a2a765)
2022-07-06 14:02:14 +03:00
Dmitry Chagin
894f26c8f6 kdump: Decode getitimer, setitimer which argument
Reviewed by:		jhb (previous version, without truss)
Differential revision:	https://reviews.freebsd.org/D35231
MFC after:		2 weeks

(cherry picked from commit b9b86b6742)
2022-07-06 14:02:14 +03:00
Dmitry Chagin
2068608ebd kdump: Decode Linux l_sigset_t.
Reviewed by:		markj
Differential revision:	https://reviews.freebsd.org/D35153
MFC after:		2 weeks

(cherry picked from commit 3606a213bf)
2022-07-06 14:02:13 +03:00
Dmitry Chagin
95e89d1019 kdump: Add preliminary support for decoding Linux syscalls
Reviewed by:		jhb
Differential revision:	https://reviews.freebsd.org/D35216
MFC after:		2 weeks

(cherry picked from commit 8a0f6d8cfd)
2022-07-06 14:02:13 +03:00
Dmitry Chagin
b31a7b84b3 kdump: For future use extract common code to a separate files
Reviewed by:		jhb
Differential revision:	https://reviews.freebsd.org/D35356
MFC after:		2 weeks

(cherry picked from commit 8b8e2e8f41)
2022-07-06 14:02:13 +03:00
Mark Johnston
3d81c26f92 truss: Make control message header parsing more robust
print_cmsg() was assuming that the control message chain is well-formed,
but that isn't necessarily the case for sendmsg(2).  In particular, if
cmsg_len is zero, print_cmsg() will loop forever.  Check for truncated
headers and try to recover if possible.

Reviewed by:	tuexen
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 4b0c6fa0dc)
2022-06-29 10:12:33 -04:00
Dmitry Chagin
6e2a3ed6a7 kdump: Decode cpuset_t.
Reviewed by:		jhb
Differential revision:	https://reviews.freebsd.org/D34982
MFC after:		2 weeks

(cherry picked from commit 586ed32106)
2022-06-17 22:35:15 +03:00
Thomas Munro
5fac6f1687 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

(cherry picked from commit 3aaaa2efde)
2022-06-17 22:22:13 +03:00
Gordon Bergling
402f0bf60d sed(1): Fix a typo in a source code comment
- s/Initialy/Initially/

Obtained from:	NetBSD

(cherry picked from commit bb0e21032b)
2022-06-10 14:26:39 +02:00
Andrew Turner
c74a6c3038 Use getpagesize in gcore to find the page size
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35194

(cherry picked from commit f9ca52bab5)
2022-06-07 15:20:18 +01:00
Dimitry Andric
390adc38fc Merge llvm-project main llvmorg-14-init-17616-g024a1fab5c35
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-17616-g024a1fab5c35.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit 04eeddc0aa)
2022-06-04 13:59:19 +02:00
Dimitry Andric
1f6fd64fe9 Merge llvm-project main llvmorg-14-init-10223-g401b76fdf2b3
This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and
openmp to llvmorg-14-init-10223-g401b76fdf2b3.

PR:		261742
MFC after:	2 weeks

(cherry picked from commit 5e801ac66d)
2022-06-04 13:58:59 +02:00
Christian Weisgerber
657219c49d truss: add ppoll(2) argument decoding
PR:		264029
Approved by:	emaste
MFC after:	3 days

(cherry picked from commit 9bf4983f54)
2022-05-20 14:51:40 +02:00
John Baldwin
382ffc8786 x86: Add a NT_X86_SEGBASES register set.
This register set contains the values of the fsbase and gsbase
registers.  Note that these registers can already be controlled
individually via ptrace(2) via MD operations, so the main reason for
adding this is to include these register values in core dumps.  In
particular, this will enable looking up the value of TLS variables
from core dumps in gdb.

The value of NT_X86_SEGBASES was chosen to match the value of
NT_386_TLS on Linux.  The notes serve similar purposes, but FreeBSD
will never dump a note equivalent to NT_386_TLS (which dumps a single
segment descriptor rather than a pair of addresses) and picking a
currently-unused value in the NT_X86_* range could result in a future
conflict.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D34650

(cherry picked from commit 931983ee08)
2022-05-13 09:45:19 -07:00
John Baldwin
e0b7d19d44 arm,arm64: Add a NT_ARM_TLS read-only register set.
This register set exposes the per-thread TLS register.  It matches the
layout used by Linux on arm64.  Linux does not implement this note for
32-bit arm.

Reviewed by:	andrew, markj
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34595

(cherry picked from commit b2cb74c22c)
2022-05-12 17:39:00 -07:00
John Baldwin
d801e93ec2 Use a regset for NT_ARM_VFP.
This includes adding support for NT_ARM_VFP for 32-bit binaries
running under aarch64 kernels both for ptrace(), and coredumps via the
kernel and gcore.

Reviewed by:	andrew, markj
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34448

(cherry picked from commit add00c381e)
2022-05-12 17:02:44 -07:00
John Baldwin
6c2ea7f890 gcore: Use PT_GETREGSET to fetch NT_PRSTATUS and NT_FPREGSET.
Add a elf_putregnote() helper to build the ELF note for a register
set.  Once nice result of this approach is that this reuses the
kernel's support for generating 32-bit register sets for 32-bit
processes avoiding the need to duplicate that logic in elf32core.c.

Reviewed by:	markj
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D34447

(cherry picked from commit 4965ac059d)
2022-05-12 15:13:00 -07:00
Alan Somers
f7896015fc ctlstat: add prometheus output
When invoked by inetd, ctlstat -P will now produce output suitable for
ingestion into Prometheus.

It's a drop-in replacement for https://github.com/Gandi/ctld_exporter,
except that it doesn't report the number of initiators per target, and
it does report time and dma_time.

Sponsored by:	Axcient
Relnotes:	yes
Reviewed by: 	bapt, bcr
Differential Revision: https://reviews.freebsd.org/D29901

(cherry picked from commit 1a7f22d9c2)
2022-05-12 14:43:01 -06:00
John Baldwin
10e4ad0b1b 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

(cherry picked from commit 4c9cb057bd)
2022-05-10 15:51:49 -07:00
Piotr Pawel Stefaniak
963fdecd1a uudecode: correct error message
PR:		153276
Reported by:	David Brennan

(cherry picked from commit 9f3203c003)

uudecode: add missing test files to Makefile

(cherry picked from commit 1b3af110bc)

uudecode: use SRCDIR in the regression test

(cherry picked from commit f5138631fb)

uudecode: move the new uudecode test from uuencode/ to uudecode/

I don't know how that happened.

(cherry picked from commit ae6aa2d43d)
2022-04-30 10:01:22 +02:00
Piotr Pawel Stefaniak
2eef2f0f8f uu{encode,decode}: improve style
(cherry picked from commit d5d3f5dab2)
2022-04-30 09:59:08 +02:00
Gordon Bergling
1a276dbad1 sed(1): Fix a typo in the manual page
- s/occurances/occurrences/

(cherry picked from commit 583bb9c530)
2022-04-23 08:54:44 +02:00
Kyle Evans
6182c78818 diff: tests: loosen up requirements for report_identical
This test cannot run without an unprivileged_user being specified
anyways, so just run as the unprivileged user.  Revoking read permisions
works just as well if you're guaranteed non-root.

Reviewed by:	pstef
Sponsored by:	Klara, Inc.

(cherry picked from commit efba49ee5a)
2022-04-21 17:38:00 -05:00
Konstantin Belousov
f9daaf452a Document procstat(1) advlock command
(cherry picked from commit bd8701dede)
2022-04-16 05:18:19 +03:00
Konstantin Belousov
539dc6ea3b Implement procstat(1) advlocks command
(cherry picked from commit a5229a255e)
2022-04-16 05:18:18 +03:00
Konstantin Belousov
d52eaf8415 procstat(1): add ability to specify subcommands not requiring pid lists
(cherry picked from commit e79866ddf1)
2022-04-16 05:18:18 +03:00
Mateusz Piotrowski
47d68b38d7 backlight.8: Fix description of -f
If an unqualified name is provided, /dev/backlight/ is automatically
prepended instead of /dev/backlight.

MFC after:	3 days

(cherry picked from commit 2f60a7f902)
2022-04-11 12:15:56 +02:00
Gordon Bergling
5b539abf08 top(1): Fix a typo in a source code comment
- s/accomodate/accommodate/

(cherry picked from commit 2fc0894023)
2022-04-09 08:16:07 +02:00
Alexander V. Chernikov
bea3efc01c netstat: fix nhop prepend printing.
If present, print nexthop L2 prepend data in hex.

MFC after:	1 week

(cherry picked from commit 731bfa9f18)
2022-03-28 08:47:23 +00:00
Piotr Pawel Stefaniak
c38d2d1811 procstat: remove set but not used variable
In an earlier version of D26310, strcmp was strncmp.

(cherry picked from commit 8b1f5965d9)
2022-03-22 18:36:16 +01:00
Piotr Pawel Stefaniak
15635c0ed3 backlight: Remove set but not used variable
(cherry picked from commit fde687c239)
2022-03-22 18:36:04 +01:00
Mariusz Zaborski
e7023af434 touch: don't leak descriptor if fstat(2) fails
If fstat(2) fails the close(2) won't be called, which will leak the
file descriptor.

The idea was borrowed from OpenBSD, where similar patch
was applied for futimens(2).

MFC after:	1 week

(cherry picked from commit cb54c500d0)
2022-03-19 14:16:29 +01:00
Dimitry Andric
5e5c14493c Fix indentation in usr.bin/diff/pr.c
In commit 6fa5bf0832 the pr(1) related code in diff was moved around,
but some part of the indentation was messed up, and one line was
duplicated. Remove the duplicated line, and fix up the indentation.

Reviewed by:	bapt
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D34398

(cherry picked from commit f7d6e97e4b)
2022-03-12 19:18:32 +01:00
Kyle Evans
35de1e66c5 tests: readlink: fix atf_test_case call [NFC]
This was meant to read `basic`, rather than a duplicate of `f_flag`.  It
is largely irrelevant, though, as atf_test_case mostly just makes
sure that the proper functions are defined.

(cherry picked from commit 0e73b834f3)
2022-03-09 15:22:05 -06:00
Jose Luis Duran
1ee2be5e0d dtc.1: Mention the existence of -i flag
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/570

(cherry picked from commit 62d16ad37d)
2022-03-09 13:52:23 -07:00
Jose Luis Duran
bc7d8fe90a dtc.1: Appease mandoc -T lint
Prefer .Fx to bare FreeBSD

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/579

(cherry picked from commit 7ae5d1f00f)
2022-03-09 13:52:22 -07:00
Mateusz Guzik
8891979494 fd: add close_range(..., CLOSE_RANGE_CLOEXEC)
For compatibility with Linux.

MFC after:	3 days
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D34424

(cherry picked from commit f3f3e3c44d)
2022-03-07 12:15:47 +00:00
Mateusz Guzik
b64a3b409a zstd: build with C11
This enables thread-aware timers which in turn fixes benchmark result
reports.

Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D34238

(cherry picked from commit 6882d53b7f)
2022-03-05 19:58:08 +00:00
наб
ed87197672 uname: -v: strip final whitespace compatibly with uname(3)
This restores POSIX.1 conformance

PR: 260938
(cherry picked from commit 7e05fa3b44)
2022-03-05 19:56:11 +00:00
Peter Jeremy
34f1d516aa
systat: Display seconds in vmstat mode
Providing a timestamp with seconds granularity helps make it obvious
that the display is updating.

Reviewed by:    mckusick
Differential Revision:  https://reviews.freebsd.org/D29181

(cherry picked from commit c9d1fa7003)
2022-03-05 13:53:34 +11:00
Warner Losh
9816cb1872 Skip -flto for all MIPS ports
There likely should be a macro for the ports that support lto, but I'm
making sure that all the mips things build before decommissioning it and
this is the only thing that's broken...

Sponsored by:		Netflix

(cherry picked from commit d677d4be0c)
2022-03-04 21:16:44 +01:00
Stefan Eßer
e53bb68f4c whereis: fix fetching of user.cs_path sysctl variable
The current implementation of sysctlbyname() does not support the user
sub-tree. This function exits with a return value of 0, but sets the
passed string buffer to an empty string.

As a result, the whereis program did not use the value of the sysctl
variable "user.cs_path", but only the value of the environment
variable "PATH".

This update makes whereis use the sysctl function with a fixed OID,
which already supports the user sub-tree.

(cherry picked from commit c454c57163)
2022-03-04 20:54:00 +01:00
Stefan Eßer
97b94f4332 fetch: make -S argument accept values > 2GB
Use strtoll() to parse the argument of the -S option.

FreeBSD has supported 64 bit file offsets for more than 25 years on
all architectures and off_t is a 64 bit integer type for that reason.

While strtol() returns a 64 bit value on 64 LP64 architectures, it
is limit to 32 bit on e.g. i386. The strtoll() function returns a 64
but result on all supported architectures and therefore supports the
possible file lengths and file offsets on 32 bit archtectures.

(cherry picked from commit 32066c96fa)
2022-03-04 20:49:38 +01:00
Stefan Eßer
98d3422e5e 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.

(cherry picked from commit 20f8331aca)
2022-03-04 20:43:01 +01:00
Stefan Eßer
6f9036a651 netstat: Fix typo
Correct spelling of "received packers" to "received packets".

(cherry picked from commit c5b8d7b7c1)
2022-03-04 20:41:55 +01:00