Commit graph

15011 commits

Author SHA1 Message Date
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
Stefan Eßer
c82c2fb1ae 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.

(cherry picked from commit 35b8fd0b69)
2022-03-04 20:41:02 +01:00
Jamie Gritton
1e40fc6fa9 MFC posixshm: Add a -j option to posixshmcontrol ls, to specify a jail
PR:		257556
Reported by:	grembo@

(cherry picked from commit be7cf3f4b8)
2022-03-02 15:10:33 -08:00
Eric van Gyzen
9bee45e915 gzip: fix error handling in unxz
The result of fstat() was not checked.  Furthermore, there was a
redundant check of st.st_size.  Fix both.

Reported by:    Coverity
MFC after:	1 week
Sponsored by:	Dell EMC Isilon

(cherry picked from commit 58135fbd8b)
2022-03-02 15:56:31 -06:00
Eric van Gyzen
5be8c23a34 elfdump: handle small files more gracefully
elfdump -E on an empty file would complain "Invalid argument" because
it tried to mmap zero bytes.  With the -E flag, elfdump should
simply exit non-zero.  For tiny files, the code would reference off
the end of the mapped region.

Ensure the file is large enough to contain an ELF header before mapping it.

MFC after:	1 week
Sponsored by:	Dell EMC Isilon

(cherry picked from commit 86e5e10daf)
2022-03-02 15:56:31 -06:00
Eric van Gyzen
22561b00ab Integrate contrib/file/tests with kyua/atf
This could be done better by making each test a separate ATF test case.
This exercise is left for the reader.

Reviewed by:	delphij (earlier version)
MFC after:	1 week
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D34303

(cherry picked from commit 1581ec9a45)
2022-03-02 15:56:31 -06:00
Eugene Grosbein
39d81d46aa fetch(1): merge several improvements for handling of soft failures
Let "fetch -a" resume truncated transfer automatically to perform
another attempt if it obtained some new data in previous one
making progress.

Do not consider HTTP 5XX errors as soft failures.
Also, authorization errors should not be considered as soft failures.

(cherry picked from commit e3bad5f7aa)
(cherry picked from commit a4efbe0d6d)
(cherry picked from commit bf599c03f0)
(cherry picked from commit 08a2504a20)
(cherry picked from commit 85f15576b4)
2022-02-26 14:19:19 +07:00
Glen Barber
9134a39850 13.1: update stable/13 to -PRERELEASE to start the release cycle
Approved by:	re (implicit)
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-02-23 23:21:49 -05:00
Martin Matuska
bfa5e5858f libarchive: import changes from upstream
Libarchive 3.6.0

New features:
PR #1614: tar: new option "--no-read-sparse"
PR #1503: RAR reader: filter support
PR #1585: RAR5 reader: self-extracting archive support

New features (not used in FreeBSD base):
PR #1567: tar: threads support for zstd (#1567)
PR #1518: ZIP reader: zstd decompression support

Security Fixes:
PR #1491, #1492, #1493, CVE-2021-36976:
   fix invalid memory access and out of bounds read in RAR5 reader
PR #1566, #1618, CVE-2021-31566:
   extended fix for following symlinks when processing the fixup list

Other notable bugfixes and improvements:
PR #1620: tar: respect "--ignore-zeros" in c, r and u modes
PR #1625: reduced size of application binaries

Relnotes:	yes

(cherry picked from commit 833a452e9f)
2022-02-23 08:56:34 +01:00
Michael Tuexen
8147d64bf1 sockstat: fix usage string
Sponsored by:	Netflix, Inc.

(cherry picked from commit 6ad26abca5)
2022-02-23 01:11:25 +01:00
Michael Tuexen
dee236b2c3 sockstat: add -i to display inp_gencnt
The inp_gencnt will be used to identify a TCP endpoint by an upcoming
command line tool to set TCP socket options.

Reviewed by:		rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D34137

(cherry picked from commit 5f64777a4f)
2022-02-23 01:10:32 +01:00
Ed Maste
5d03965e41 elfctl: whitespace cleanup
Reported by:	jrm (in review D34283)

(cherry picked from commit 828e50092a)
2022-02-22 14:54:41 -05:00
Ed Maste
417be38b9f vtfontcvt: update FreeBSD Foundation copyrights
Remove "All Rights Reserved"

(cherry picked from commit 4e1e3ff571)
2022-02-22 14:53:41 -05:00