Commit Graph

15533 Commits

Author SHA1 Message Date
Dag-Erling Smørgrav
473e9fcab4 script: Handle a missing 's' stamp gracefully.
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37182
2022-10-27 20:11:36 +00:00
Dag-Erling Smørgrav
6ac087cf8f script: Further usage string nits.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D37177
2022-10-27 19:49:18 +00:00
Dag-Erling Smørgrav
3276866f40 script: Use size_t / ssize_t where needed.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D37177
2022-10-27 19:49:18 +00:00
Math Ieu
172be8642d split: reset errno prior to getline()
Something else may have set errno, breaking the post-getline() logic
that tries to detect the getline() error.  This was initially noted in
a jail on a system that has HPET, in a jail that does not expose
/dev/hpet0 -- we see an earlier error in libc's vdso bits.

Fixes:	5c053aa3c5 ("split: switch to getline() [...]")
2022-10-27 12:17:59 -05:00
Dag-Erling Smørgrav
e7c13cf438 script: Add usage string for playback mode.
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D37138
2022-10-27 14:46:15 +00:00
Dag-Erling Smørgrav
8e096e24d4 script: Correct -F in man page and usage string.
Sponsored by:	Klara, Inc.
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D37138
2022-10-27 14:46:09 +00:00
Emmanuel Vadot
069ebe6fba pkgbase: Put less in FreeBSD-runtime
Useful to have a pager in it.

Differential Revision:	https://reviews.freebsd.org/D36231
2022-10-26 19:46:43 +02:00
Emmanuel Vadot
feec04b355 pkgbase: Create a FreeBSD-games package
And put :
- pom
- caesar
- grdc

Differential Revision:	https://reviews.freebsd.org/D36230
2022-10-26 19:46:40 +02:00
Dag-Erling Smørgrav
deb2f1b616 w: Fix premature rounding.
If the system has been up more longer than a minute, we add 30 seconds to
the uptime so that subsequent calculations will round to the nearest minute
rather than truncate.  However, since the introduction of libxo, we output
the raw value after performing the adjustment.  Rewrite so that we output
the raw value first, then perform the adjustment and recalculate before
outputting the humanized value.

While there, reduce stack usage and avoid needless allocations.

Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37128
2022-10-26 15:56:40 +00:00
Kyle Evans
7aaa50c6b5 split: add word order fix
This was meant to note that both pattern and line matching were
previously restricted, but words are difficult.  +line and rearrange.

Sponsored by:	Klara, Inc.
2022-10-25 16:52:14 -05:00
Kyle Evans
75c3ca1ebf split: add some tests
This should cover all of the basic functionality, as well as the recent
enhancement to use a dynamic buffer size rather than limiting patterns
and lines to MAXBSIZE.

Reviewed by:	bapt
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D36324
2022-10-25 10:05:24 -05:00
Kyle Evans
5c053aa3c5 split: switch to getline() for line/pattern matching
Get rid of split's home-grown logic for growing the buffer; arbitrarily
breaking at LONG_MAX bytes instead of 65536 bytes gives us much more
wiggle room.  Additionally, we'll actually fail out entirely if we can't
fit a line, which makes noticing this class of problem much easier.

Reviewed by:	bapt, emaste, pauamma
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D36323
2022-10-25 10:05:23 -05:00
Dag-Erling Smørgrav
04f6b9cb18 w: cosmetic fixes.
Sponsored by:	Klara, Inc.
2022-10-21 16:37:44 +00:00
Mariusz Zaborski
af32978987 logger: fix builds without casper
We can enter capability mode only when Casper is available in
the system.

Reported by:	mjg@
MFC after:	1 week
2022-10-19 16:02:30 +02:00
Ed Maste
9a86a3cd9b truss: remove now-unused special case for MIPS
Reviewed by:	mhorne, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37022
2022-10-17 14:02:49 -04:00
liu-du
0ca740d9a6 xargs: fix exit code when using -P
currently when xargs runs in parallel mode (e.g. -P2), it somtimes
incorrectly returns zero exit code.  this commit fix it and also adds
tests.

Reviewed by:	mjg
PR:	267110
2022-10-17 10:39:04 +00:00
Olivier Cochard
07b1ea961a renice: Force /bin/sh usage on su calls for the regression tests.
If the root account is configured to use a different shell than sh,
it fails to retreive the pid of the background process.

Approved by:	des
Obtained from:	chs
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D36930
2022-10-13 17:32:47 +02:00
Baptiste Daroussin
226e41467e sort: deindent file_reader_free and cleanup its usage 2022-10-13 10:51:17 +02:00
Baptiste Daroussin
ffd41d39c6 sort: simplify file_reader_clean
Deindent the function, remove useless tests:
 - free already test if argument is NULL
 - closefile already test if the input is stdin or null
2022-10-13 10:42:23 +02:00
Baptiste Daroussin
f9d9a7cc4f sort: deindent closefile 2022-10-13 10:38:12 +02:00
Baptiste Daroussin
48a53cc484 sort: use asprintf(3) instead of malloc + snprintf(3) 2022-10-13 10:34:57 +02:00
Baptiste Daroussin
958b0d4642 sort: deindent openfile 2022-10-13 10:31:34 +02:00
Baptiste Daroussin
f079ef8aa4 sort: simplify the code to handle -z flag 2022-10-13 10:24:11 +02:00
Baptiste Daroussin
4d4fcf619e sort: cleanup now unused structutre and prototypes 2022-10-13 10:24:11 +02:00
Baptiste Daroussin
8b9071360a sort: unify the code to read from FILE *
Previously the code to read from a local file or stdin was sperarated
After the change to remove the home made line reader used for stdin
(replaced by getdelim) it apprears that the rest of the code which is
used to read from any FILE * but stdin can benefit from the exact same
change.
2022-10-13 10:24:11 +02:00
Baptiste Daroussin
e8815fb30b sort: remove unused function 2022-10-13 10:24:11 +02:00
Baptiste Daroussin
f02c783757 sort: use memset to initialize structure when possible 2022-10-13 10:24:11 +02:00
Baptiste Daroussin
3f9e5e59bd sort: use mkstemp(3) instead of reinventing it
MFC After:	1 week
2022-10-12 18:01:57 +02:00
Baptiste Daroussin
b58094c0d9 sort: replace home made line reader by getdelim(3)
The previous code had bug when reading lines with an unexpected
encoding, returning without the full line being captured.
This result in sort complaining with "sort: Illegal byte sequence"

Using getdelim(3) instead of the home made code, fixes the situation.

PR:		241679
Reported by:	Ronald F. Guilmette <rfg-freebsd@tristatelogic.com>
MFC After:	1 week
Reviewed by:	markj, imp
Differential Revision:	https://reviews.freebsd.org/D36948
2022-10-12 17:37:33 +02:00
Baptiste Daroussin
ed990a7a2f sort: remove NLS support
NLS support for sort(1) is:
1/ incomplete: many error string are not using nls
2/ only covers hu_HU.ISO8859-2
2022-10-12 16:24:29 +02:00
Baptiste Daroussin
ecc3c29167 sort: replace malloc+memset with calloc 2022-10-12 16:12:04 +02:00
Baptiste Daroussin
a312f3e742 sort: add wrapper around calloc 2022-10-12 16:12:04 +02:00
Pau Amma
36bb350e37 Update tip for adding a user to wheel:
Use "pw groupmod" instead of hand-editing /etc/group

Reviewed by:	bcr, gjb

Approved by:	gjb (mentor)
2022-10-09 02:15:15 +02:00
Kristof Provost
307625842b w: don't truncate if we're writing libxo json/xml
If we're writing structured output (i.e. json or xml) we shouldn't worry
about terminal width, and instead always output full width information.

This means that, for example, if we're called from crontab with 'w
--libxo json' we'll provide full the command field rather than
pointlessly truncating it.

Suggested by:	Phil Shafer
Event:		Aberdeen Hackathon 2022
Differential Revision:	https://reviews.freebsd.org/D25013
2022-10-07 18:21:27 +02:00
Gleb Smirnoff
51c0184297 systat: remove INP_TIMEWAIT 2022-10-06 19:24:37 -07:00
Simon J. Gerraty
f48114b653 ldd: ignore unverified files
When mac_veriexec is enforcing, we won't run unverified binaries,
don't let ldd examine them either.

Reviewed by:	stevek emaste
MFC after:	1 week
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D36897
2022-10-06 17:51:28 -07:00
Konstantin Belousov
9cabef3d14 ldd: use direct exec mode unconditionally
Trying to exec malformed or unusual binary, for instance, a non-FreeBSD
ABI, or using a non-standard interpreter, might give unexpected outcome.

Reported by:	The UK's National Cyber Security Centre (NCSC)
Reviewed by:	emaste, markj, philip
Discussed with:	jhb
Sponsored by:	The FreeBSD Foundation
admbug:	991
PR:	127276, 175339, 231926
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D36650
2022-10-06 18:50:26 +03:00
John Baldwin
ba86cffb28 rs: Fix some pointer arith UB.
If the next column was blank, then the length of the following entry
was computed as the end of the following entry minus a global variable
"blank" which is not in the same string or allocation.  Instead, save
the start value of 'p' explicitly instead of abusing '*ep'.  Possibly
we should just increment p before saving it in sp in the 'blank' case,
but at worst that would just mean maxlen might be one char too large
which should be harmless.

Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D36832
2022-10-05 16:48:05 -07:00
John Baldwin
e5f2d5b35e rs: Fix a use after free.
Using a pointer passed to realloc() after realloc() even for pointer
arithmetic is UB.  It also breaks in practice on CHERI systems as
the updated value of 'sp' in this case would have had the bounds from
the old allocation.

This would be much cleaner if elem were a std::vector<char *>.

Reviewed by:	brooks, emaste
Reported by:	GCC -Wuse-after-free
Differential Revision:	https://reviews.freebsd.org/D36831
2022-10-05 16:47:40 -07:00
John Baldwin
bb31e1bbf2 rs: Fix various harmless warnings.
- Add /* FALLTHROUGH */ comments for intentional fall throughs in
  getargs().

- Remove id strings to quiet -Wunused-const-variable warnings from
  GCC.

- While here, remove __FBSDID.

Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D36830
2022-10-05 16:47:21 -07:00
Daniel Engberg
070e8d36d9 grep: Add quotes in manpage when using wildcards with --include
Examples uses --include=*.h which doesn't work as intended

Approved by:	kevans
Differential Revision:	https://reviews.freebsd.org/D36883
2022-10-05 19:05:52 +02:00
John Baldwin
3736b2dd32 diff: Fix a use after free as well as a memory leak in change().
When -B or -I are used, change() evaluates the lines in a hunk to
determine if it is a hunk that should be ignored.  It does this by
reading each candidate line into a mallocated buffer via preadline()
and then calling ignoreline().  Previously the buffer was freed as a
side effect of ignoreline_pattern() called from ignoreline().
However, if only -B was specified, then ignoreline_pattern() was not
called and the lines were leaked.  If both options were specified,
then ignoreline_pattern() was called before checking for a blank line
so that the second check was a use after free.

To fix, pull the free() out of ignoreline_pattern() and instead do it
up in change() so that is paired with preadline().

While here, simplify ignoreline() by checking for the -B and -I cases
individually without a separate clause for when both are set.  Also,
do the cheaper check (-B) first, and remove a false comment (this
function is only called if at least one of -I or -B are specified).

Reviewed by:	emaste
Reported by:	GCC 12 -Wuse-after-free
Differential Revision:	https://reviews.freebsd.org/D36822
2022-10-03 16:10:43 -07:00
John Baldwin
db695788fc fortune: Unindent a debug printf in get_fort().
The debug printf is intended to execute after the loop has ended to
log the selected file.

Reviewed by:	imp, emaste
Reported by:	GCC
Differential Revision:	https://reviews.freebsd.org/D36815
2022-10-03 16:10:42 -07:00
John Baldwin
c2e561a38f tail: Fix misleading indentation in ARG() macro.
Reviewed by:	imp, emaste
Reported by:	GCC
Differential Revision:	https://reviews.freebsd.org/D36810
2022-10-03 16:10:42 -07:00
Dag-Erling Smørgrav
0aa2700123 Put OPIE to rest.
Differential Revision: https://reviews.freebsd.org/D36592
2022-10-02 03:37:29 +02:00
Mariusz Zaborski
6da5e5d649 seq: fix style nits
MFC after:	2 weeks
2022-10-01 12:05:07 +02:00
Mariusz Zaborski
94c4f663ba seq: fix potential NULL ptr reference
asprintf(3) allocates memory, and there isn't any guarantee of success.

MFC after:	2 weeks
Obtained from:  OpenBSD
2022-10-01 12:05:03 +02:00
Elliott Mitchell
42dc8696df vmstat: remove processor counting from getcpuinfo()
As `ncpus` was otherwise unused, keeping track was pointless.  Gets rid
of a warning from an unused variable.

Reviewed by:	kib
MFC after:	1 week
Differential Revision: https://reviews.freebsd.org/D36628
2022-09-30 06:10:27 +03:00
Olivier Cochard
c8b6939dfa renice: Prevent running regression tests in parallel
renice_abs_user and renice_rel_user tests modify global state, so they
are not compatible with parallel execution.

Reviewed by:	asomers
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D36720
2022-09-30 00:28:19 +02:00
Brooks Davis
b4cfdbfed2 manpages: Remove telnetd references
Mostly remove from the SEE ALSO section, adding a mention of the port
where not removed. Elsewhere, remove as appropriate and change from .Xr
to .Nm where a mention of telnetd continues to make sense (or removing
it would require significant reworking of the surrounding text).

Reviewed by:	imp, delphij, emaste
Differential Revision:	https://reviews.freebsd.org/D36785
2022-09-29 17:56:41 +01:00
John Baldwin
536f7d84cd newkey: Fix mismatch in array bounds in for adjust().
Reviewed by:	emaste
Reported by:	GCC -Warray-parameter
Differential Revision:	https://reviews.freebsd.org/D36762
2022-09-28 14:06:16 -07:00
John Baldwin
157436dcbf mail: Fix mismatch in array bounds for isign().
Reviewed by:	imp, emaste
Reported by:	GCC -Warray-parameter
Differential Revision:	https://reviews.freebsd.org/D36761
2022-09-28 14:05:42 -07:00
Randall Stewart
08af8aac2a Tcp progress timeout
Rack has had the ability to timeout connections that just sit idle automatically. This
feature of course is off by default and requires the user set it on (though the socket option
has been missing in tcp_usrreq.c). Lets get the progress timeout fully supported in
the base stack as well as rack.

Reviewed by: tuexen
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D36716
2022-09-27 13:38:20 -04:00
Ed Maste
61957f3a6f clang: remove as(1) cross-reference from man page
PR:		265232
Reviewed by:	dim
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differntial Revision:	https://reviews.freebsd.org/D36634
2022-09-25 15:21:25 -04:00
Alfonso S. Siciliano
84823cc708
contrib/bsddialog: Import version 0.4
Improvements and changes to integrate bsddialog(1) with scripts in BASE.
Overview:

 * New options. --and-widget, --keep-tite, --calendar.
 * Change output format. Menus and --print-maxsize.
 * Redefine sizing. Fixed rows, cols and menurows became at the most.
 * Add DIAGNOSTICS. Error messages for bad arguments and options.
 * Add keys. Space for --menu, fast keys for --msgbox and --yesno.
 * Text. Change default text modification, add --cr-wrap.

See /usr/src/contrib/bsddialog/CHANGELOG '2022-09-24 Version 0.4'
for more detailed information.

Merge commit '9f24fda5a8e7ab8243e71473c7e2dc98b4877e64'
2022-09-25 15:09:16 +02:00
Brooks Davis
bb23932803 ktrace: make ktr_tid a long not intptr_t (NFC)
Long ago, ktr_tid was ktr_buffer which pointed to the buffer following
the header and was used internally in the kernel.  Use was removed in
efbbbf570d and it was repurposed as ktr_kid in c6854c347f.  For
ABI reasons, it stayed an intptr_t rather than becoming an lwpid_t at
the time.  Since it doesn't hold a pointer any more (unless you have
a ktrace.out from 2005), change the type to long which is alwasy the
same size on all supported architectures.  Add a suggestion to change
the type to lwpid_t (__int32_t) on a future ABI break.

Remove most remaining references to ktr_buffer, retaing a comment in
kdump.c explaining why negative values are treated as 0.  While here,
accept that pid_t and lwpid_t are of type int and simplify casts in
printf.

This changed was motivated by CheriBSD where intptr_t is 16-bytes
in the pure-capability ABI.

Reviewed by:	kib, markj
Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D36599
2022-09-17 09:21:59 +01:00
Konstantin Belousov
1d280f2142 procstat(1): print AT_USRSTACKBASE and AT_USRSTACKLIM
Reviewed by:	brooks, imp (previous version)
Discussed with:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D36540
2022-09-16 23:23:38 +03:00
Gordon Bergling
8f98a937ed uname.1: Clarify the -r option
It is some times hard to understand the difference between
kernel version and userland version. So clarify the -r option
of uname(1) in terms of a printed kernel version.

While here, add some cross references:

- cross reference freebsd-version(1) in uname(1)
- cross reference freebsd-version(1) and uname(1) in freebsd-update(8)

PR:		265594
Reported by:	rwatson
Reviewed by:	gbe, imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D36516
2022-09-16 13:27:54 +02:00
Kirk McKusick
927f8d8bbb Handle NULL return from localtime(3) in ls(1) and find(1)
The ls(1) (with -l option) and find(1) (with -ls option) utilties
segment fault when operating on files with very large modification
times. A recent disk corruption set a spurious bit in the mtime
field of one of my files to 0x8000000630b0167 (576460753965089127)
which is in year 18,266,940,962. I discovered the problem when
running fsck_ffs(8) which uses ctime(3) to convert it to a readable
format. Ctime cannot fit the year into its four character field, so
returns ??? ??? ?? ??:??:?? ???? (typically Thu Nov 24 18:22:48 2021).

With the filesystem mounted, I used `ls -l' to see how it would
report the modification time and it segment faulted. The find(1)
program also segment faulted (see script below). Both these utilities
call the localtime(3) function to decode the modification time.
Localtime(3) returns a pointer to a struct tm (which breaks things
out into its component pieces: year, month, day, hour, minute,
second). The ls(1) and find(1) utilities then print out the date
based on the appropriate fields in the returned tm structure.

Although not documented in the localtime(3) manual page, localtime(3)
returns a NULL pointer if the passed in time translates to a year
that will not fit in an "int" (which if "int" is 32-bits cannot
hold the year 18,266,940,962). Since ls(1) and find(1) do not check
for a NULL struct tm * return from localtime(3), they segment fault
when they try to dereference it.

When localtime(3) returns NULL, the attached patches produce a date
string of "bad date val". This string is chosen because it has the
same number of characters (12) and white spaces (2) as the usual
date string, for example "Sep 3 22:06" or "May 15 2017".

The most recent ANSI standard for localtime(3) does say that localtime(3)
can return NULL (see https://pubs.opengroup.org/onlinepubs/9699919799/
and enter localtime in the search box). Our localtime(3) man page should
be updated to indicate that NULL is a possible return. More importantly,
there are over 100 uses of localtime(3) in the FreeBSD source tree (see
Differential Revision D36474 for the list). Most do not check for a NULL
return from localtime(3).

Reported by:  Peter Holm
Reviewed by:  kib, Chuck Silvers, Warner Losh
MFC after:    2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36474
2022-09-09 14:30:42 -07:00
Mark Johnston
e599810ded tail: Initialize the stat buffer used when input is stdin
PR:		266284
Reported by:	Jenkins via delphij
Fixes:		7e11889959 ("tail: Fix -f with stdin")
MFC after:	3 days
2022-09-08 16:21:39 -04:00
Xin LI
95270f73ba MFV: less v608
Relnotes:	yes
MFC after:	2 weeks
2022-09-05 22:52:39 -07:00
Alfonso S. Siciliano
ad052eb076
bsddialog(1): Fix Makefile typo
Fix build fault caused by a typo in the Makefile.
2022-09-03 17:46:26 +02:00
Alfonso S. Siciliano
b319d93437
contrib/bsddialog: Import version 0.3
New features overview:
 * Unicode. User interface handles multi-column characters. API can
   handle char* like a multibyte character string. Internally wide
   characters are used for keyboard input, to adapt word wrapping and
   dynamic text auto-sizing for multi-column characters.
 * Forms refactoring. Complete rewrite deleting libformw dependency.
 * Theme. New utility options to save and load custom theme at run-time.
 * TUI navigation. Added keys to navigate input components. Changed
   default focus behavior of input dialogs to be LGPL-dialog-like; a new
   option can set the previous whiptail-like behavior.

See /usr/src/contrib/bsddialog/CHANGELOG '2022-08-29 Version 0.3'
for more detailed information.

Merge commit '2c9fd7655ba54e7239f528e1af9fe09662de9b03'
2022-09-03 16:41:44 +02:00
Gordon Bergling
fa4eca789e tip(1): Fix a typo in a source code comment
- s/overriden/overridden/

MFC after:	3 days
2022-09-03 14:59:03 +02:00
Gleb Smirnoff
1f3d8c09be procstat: fix printing divert(4) sockets 2022-08-30 16:26:21 -07:00
Gleb Smirnoff
2b1c72171e divert(4): provide statistics
Instead of incrementing pretty random counters in the IP statistics,
create divert socket statistics structure.  Export via netstat(1).

Differential revision:	https://reviews.freebsd.org/D36381
2022-08-30 15:09:21 -07:00
Gleb Smirnoff
8624f4347e divert: declare PF_DIVERT domain and stop abusing PF_INET
The divert(4) is not a protocol of IPv4.  It is a socket to
intercept packets from ipfw(4) to userland and re-inject them
back.  It can divert and re-inject IPv4 and IPv6 packets today,
but potentially it is not limited to these two protocols.  The
IPPROTO_DIVERT does not belong to known IP protocols, it
doesn't even fit into u_char.  I guess, the implementation of
divert(4) was done the way it is done basically because it was
easier to do it this way, back when protocols for sockets were
intertwined with IP protocols and domains were statically
compiled in.

Moving divert(4) out of inetsw accomplished two important things:

1) IPDIVERT is getting much closer to be not dependent on INET.
   This will be finalized in following changes.
2) Now divert socket no longer aliases with raw IPv4 socket.
   Domain/proto selection code won't need a hack for SOCK_RAW and
   multiple entries in inetsw implementing different flavors of
   raw socket can merge into one without requirement of raw IPv4
   being the last member of dom_protosw.

Differential revision:	https://reviews.freebsd.org/D36379
2022-08-30 15:09:21 -07:00
Dag-Erling Smørgrav
7ccdad905f renice: add unit tests.
Sponsored by:	Klara, Inc.
2022-08-25 20:06:20 +00:00
Dag-Erling Smørgrav
65ee0a8495 renice: fix argument order.
The target modifiers (-g, -p, -u) may occur in any position except
between -n and its argument; furthermore, we support both the old
absolute form (without -n) and the modern relative form (with -n).

Sponsored by: Klara, Inc.
2022-08-25 19:50:55 +00:00
Baptiste Daroussin
83e8c23178 bintrans: replace the quoted printable encoder/decoder
Replace the quoted printable code with one that respects RFC2045
Add tests about this parsers and encoders, using examples from the
wikipedia page.

Reviewed by:	pstef
Differential Revision: https://reviews.freebsd.org/D36314
2022-08-25 09:29:18 +02:00
Jens Schweikhardt
f7473c7e77 Indicate which port gpg.1 comes from. 2022-08-17 19:23:57 +02:00
Jens Schweikhardt
3c405c7e83 Indicate which port gdb.1 and kgdb.1 come from. 2022-08-17 19:13:22 +02:00
Emmanuel Vadot
0c6b2a9179 pkgbase: Put accounting utilities in the acct package 2022-08-16 21:15:19 +02:00
Jens Schweikhardt
e1ae2a285a Indicate the port where the referenced man pages come from. 2022-08-16 20:57:30 +02:00
Jens Schweikhardt
20f68c5f2d Indicate that xrefs to *roff,tbl,eqn et al are found in ports/textproc/groff. 2022-08-15 22:15:18 +02:00
Jens Schweikhardt
825225e52f For man page references found in ports, indicate the respective port. 2022-08-14 15:02:06 +02:00
Xin LI
278d080bad Remove minigzip from the base system.
The minigzip(1) was initially introduced as a minimal replacement
of GNU gzip(1). We have replaced the GNU gzip(1) with the zlib
based, GPL-free implementation, and minigzip(1) is not being used
anywhere in the base system, so just remove it.

Relnotes:	yes
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D35979
2022-08-13 21:11:50 -07:00
Kyle Evans
ea0f37dec6 iconv: only conditionally use ICONV_SET_DISCARD_ILSEQ
If the -c flag is used, then we can set it with ICONV_SET_DISCARD_ILSEQ;
otherwise, leave it alone.  The user may have specified //IGNORE in the
'to' codeset specification, there's no reason we can't allow that but
we'll currently turn it off.

Reviewed by:	thj
Sponsored by: Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34342
2022-08-11 11:33:28 -05:00
Dag-Erling Smørgrav
441202c00b apply: clean up error handling.
Sponsored by:	Klara, Inc.
2022-08-08 19:06:35 +00:00
Dag-Erling Smørgrav
e24c5c60d7 renice: support -- as per POSIX.
Sponsored by:	Klara, Inc.
MFC after:	1 week
2022-08-05 01:52:02 +02:00
Dag-Erling Smørgrav
f44e257712 xinstall: alphabetize: upper case precedes lower.
Sponsored by:	Klara, Inc.
2022-08-04 02:10:16 +02:00
Dag-Erling Smørgrav
54d8d0fe12 xinstall: use dynamic bufsize as in cat(1) / cp(1).
Sponsored by:	Klara, Inc.
2022-08-03 23:01:13 +02:00
Dag-Erling Smørgrav
c7a8e8d372 xinstall: make md5 and ripemd160 conditional
Sponsored by:	Klara, Inc.
2022-08-03 21:24:07 +02:00
Dag-Erling Smørgrav
36d67475f5 xinstall: fix dounpriv logic, add tests
Sponsored by:	Klara, Inc.
MFC after:	1 week
2022-08-03 21:03:49 +02:00
Tom Jones
190c4c2499 diff3: Use ranges for new and old diffedits in ed scripts
This should make the output logic easier to read. No functional change
intended.

Sponsored by:	Klara, Inc.
2022-08-02 14:38:11 +01:00
Tom Jones
c0e6ccb12a diff3: Use ranges for the old and new diffedits in A scripts
This makes the output logic easier to read. No functional change
intended.

Sponsored by:	Klara, Inc.
2022-08-02 14:37:05 +01:00
Tom Jones
264a559ac8 diff3: Simplify startmark calculation in Ascript
Remove redundant calculation for startmark.

Sponsored by:	Klara, Inc.
2022-08-02 14:36:05 +01:00
Gordon Bergling
93b8510c36 find.1: Correct the markup
- ASCII is an acronym and there is no ascii(8) manual page
- Reference ascii(7) in the SEE ALSO section

Reported by:	karels
X-MFC with:	321dc6ee7e
2022-08-02 08:33:20 +02:00
Tom Jones
2c4276aaa2 diff3: Use variables for old and new in A scripts
This makes the code easier to follow, no functional changes intended

Sponsored by:	Klara, Inc.
2022-08-01 14:54:20 +01:00
Tom Jones
ca53a8445a diff3: Replace literal marker with variable
Sponsored by:	Klara, Inc.
2022-08-01 14:53:53 +01:00
Tom Jones
85d92faf43 diff3: Fix indentation
Sponsored by:	Klara, Inc.
2022-08-01 14:14:25 +01:00
Xin LI
0404b8c88f Deprecate minigzip(1) in preparation of removing it from base system.
Reviewed by:	emaste, pauamma
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D36000
2022-07-31 15:16:22 -07:00
Gordon Bergling
321dc6ee7e find.1: Fix mandoc warnings and mention a useful manpage
- new sentence, new line
- unknown AT&T UNIX version: At v7
- no blank before trailing delimiter
- reference the ASCII(8) manual page

MFC after:	5 days
2022-07-31 16:38:10 +02:00
Stefan Eßer
dc9e68ad01 calendar: clarify comment syntax in man page
The single line comment indicator '//' is only detected at the
beginning of a line or when following white space to allow URLs
in calendar entries.

MFC after:	3 days
2022-07-31 07:37:05 +02:00
Doug Rabson
0c19c4db74 Move sort to runtime
Allows pkg bootstrap without having to install FreeBSD-utilities
2022-07-29 11:27:25 +01:00
Warner Losh
6feb6b4ffc ncal: LT is the country code for Lithuania
PR: 265479
MFC After: 3 days
2022-07-28 11:35:50 -06:00
Simon J. Gerraty
532d4fbfa0 Update to bmake-20220726
Merge commit '31a96ca5f0b6e5f8f7fa8cecf3a5c4354b3b096f'
2022-07-27 09:00:30 -07:00
Simon J. Gerraty
08604a023d Auto-create bmake/unit-tests objdir if appropriate
Given the way bmake/unit-tests is visited, when doing 'test'
MK_AUTO_OBJ=yes will not be effective.
So create the objdir before running the sub-make.

Also ensure MAKEOBJDIR is passed to opt-m-include-dir

Reviewed by: deo
2022-07-26 13:24:34 -07:00
Simon J. Gerraty
58cd36950c Finish update to bmake-20220724 2022-07-26 11:06:27 -07:00
Warner Losh
8a02ea1dbc nl: Correct history
nl actually first was available with System III, not System Vr2. Updated
based on discussion on TUHS mailing list (archive recently moved so this
message isn't get available in the archive).

Suggested by: segalogo (Matt G)
2022-07-24 15:01:52 -06:00
Eugene Grosbein
d6054ee652 find.1: small language fix after previous change
collate -> collation
2022-07-22 18:46:38 +07:00
Eugene Grosbein
26a329f49f find.1: explain why "find -s" may differ from "find | sort"
In short, that's because a directory name may end
with a character that goes before slash (/).

MFC after:	1 week
2022-07-22 18:39:47 +07:00
Ed Maste
119db52f42 vtfontcvt: improve hex font format validation
Previously an EOF would result in sscanf returning -1 leading to a
crash.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-07-19 11:48:09 -04:00
Mateusz Piotrowski
f4b00609ec backlight(8): Update usage() to match the manual page
MFC after:	1 week
2022-07-19 16:56:27 +02:00
Mateusz Piotrowski
64a231b90b backlight.8: Show all possible modes in synopsis
MFC after:	1 week
2022-07-19 16:55:25 +02:00
Mateusz Piotrowski
5c3e424958 backlight.8: Standardize synopsis and improve examples
MFC after:	1 week
2022-07-19 16:49:50 +02:00
Mateusz Piotrowski
ef2d0816dd vtfontcvt(8): Update usage() to match vtfontcvt.8
MFC after:	2 weeks
2022-07-19 16:35:50 +02:00
Mateusz Piotrowski
cad64622ca vtfontcvt.8: Use D1 instead of Ql for readability
MFC after:	2 weeks
2022-07-19 16:35:49 +02:00
Mateusz Piotrowski
e0bd2ab2eb vtfontcvt.8: Sort synopsis
MFC after:	2 weeks
2022-07-19 16:35:49 +02:00
Mateusz Piotrowski
b38e3722f5 vtfontcvt.8: Improve synopsis and -f documentation
MFC after:	2 weeks
2022-07-19 16:35:48 +02:00
Ed Maste
df777aeb98 vtfontcvt: correct usage
Commit e7fd9688ea changed vtfontcvt's command line parsing, but did
not correctly update the usage (it omitted the new -o flag).

Fixes:		e7fd9688ea ("Move font related data structured to...")
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2022-07-18 13:24:29 -04:00
Xin LI
1fbfa7a8dc usr.bin/cksum: localize _total variables. 2022-07-17 17:24:31 -07:00
Dmitry Chagin
ae37e4a0d1 kdump(1): Sort options in alphabetical order.
Reviewed by:		imp (early rev)
Differential Revision:	https://reviews.freebsd.org/D35775
MFC after:		2 weeks
2022-07-16 12:47:54 +03:00
Dmitry Chagin
fc90f3a281 ktrace: Increase precision of timestamps.
Replace struct timeval in header with struct timespec.
To differentiate header formats, add a new KTR_VERSIONED flag
set in the header type field similar to the existing KTRDROP flag.

To make it easier to extend ktrace headers in the future,
extend the existing header with a version field (version 0 is
reserved for older records without KTR_VERSIONED) as well as
new fields holding the thread ID and CPU ID.

Reviewed by:		jhb, pauamma
Differential Revision:	https://reviews.freebsd.org/D35774
MFC after:		2 weeks
2022-07-16 12:46:12 +03:00
John Baldwin
a6c3e5fa39 gcore: Trim stale bits from elf32core.c.
These should have been removed in
d95657a1a7.

Reviewed by:	markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D35748
2022-07-14 13:03:34 -07:00
Xin LI
643ac419fa Improve usability of head(1) and tail(1):
- Consistently support -q (quiet) and -v (verbose)
 - Allow specifying numbers with SI prefixes supported by expand_number(3)
 - Remove 2^31 limit on lines for head(1)

MFC after:		2 weeks
Reviewed by:		lwhsu, pauamma, gbe
Relnotes:		yes
Differential Revision: https://reviews.freebsd.org/D35720
2022-07-12 21:14:25 -07:00
Mateusz Piotrowski
6452fb1e87 protect.1: Document that protect(1) does not work in jails
The reason is that in order to protect a process procctl(2) needs
the PRIV_VM_MADV_PROTECT privilege, which is currently denied in jails
(see kern_jail.c).

MFC after:	1 week
2022-07-12 00:47:58 +02:00
Mateusz Piotrowski
cb56f86025 protect.1: Improve synopsis
While here, make the list's -width argument a bit shorter for
readability.

MFC after:	3 days
2022-07-07 20:09:16 +02:00
Gleb Smirnoff
d961ccd350 sockstat(1): print PID adjusted to the right
This allows for easy copy-and-paste of a unix(4) peer name for lookup.
With current implementation it is guaranteed that a peer listed could be
found in the output.

Differential revision:	https://reviews.freebsd.org/D35727
2022-07-06 22:19:08 -07:00
Gleb Smirnoff
2c436d4890 sockstat(1): print out full connection graph for unix(4) sockets
Kernel provides us with enough information to display all possible
connections between UNIX sockets.

o Store unp_conn, xu_firstref and xu_nextref in the faddr of a UNIX sock.
o Build tree of file descriptors, indexed by the socket pointer.
o In displaysock() print out all possible information:
  1) if socket is bound, print name of this socket
  2) if socket has connected to a peer with a name, print peers name
  3) if socket has connected to a peer without a name, print [pid fd]
  4) if a bound socket has received connections, print list of them
     as [pid fd]
  Previously, only 1) either 2) were printed.

Reviewed by:		tuexen
Differential revision:	https://reviews.freebsd.org/D35726
2022-07-06 22:19:08 -07:00
Gleb Smirnoff
c5bdcd1f10 sockstat(1): widen the FD printing format
Three digit file descriptors are very common these days.  So let the
columns not break with them.

Reviewed by:		tuexen
Differential revision:	https://reviews.freebsd.org/D35725
2022-07-06 22:19:08 -07:00
Gleb Smirnoff
a83d596f43 sockstat(1): use tree(3) rbtree instead of hash
o Use tree to lookup by socket kvaddr. The size of hash is too big for a
  small virtual machine and at the same time too little for a large
  production server.  A tree would better fit here.
o For those pcbs, that don't have a socket associated, use a list.
o Provide a second tree to lookup by pcb kvaddr.  These removes full hash
  traversal when printing every unix(4) socket.

Reviewed by:		tuexen
Differential revision:	https://reviews.freebsd.org/D35724
2022-07-06 22:19:08 -07:00
Gleb Smirnoff
7d016011f4 sockstat(1): we don't need kernel struct unpcb
Fixes:	0e229f343f
2022-07-06 22:19:08 -07:00
Mike Karels
231092bb6f 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
MFC after:	1 week
2022-07-06 07:12:16 -05:00
Tom Jones
1e692b938e xargs: fix description of strnsubst return value
Reported by:	oshogbo
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35574
2022-07-05 16:27:15 +01:00
Tom Jones
f058359ba5 xargs: terminate if line replacement cannot be constructed
If the line with replacement cannot be constructed xargs should
terminate as documented in the man page

We encounter this error, but gnu/xargs doesn't because they have a much
larger limit for created outputs (~10000 lines).

Reviewed by:	oshogbo
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35574
2022-07-05 16:18:05 +01:00
Tom Jones
d458eb8de1 diff3: make the eflag logic easier to follow
Discussed with:	dim
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35324
2022-07-05 12:36:11 +01:00
John Baldwin
d95657a1a7 gcore: Use PT_GETREGSET for NT_THRMISC and NT_PTLWPINFO.
This avoids the need for dealing with converting lwpinfo for alternate
ABIs in gcore itself.

Reviewed by:	markj
MFC after:	2 weeks
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D35667
2022-06-30 10:05:02 -07:00
John Baldwin
d2a3c30a51 gcore: Remove unused typedefs.
These are no longer needed after commit 4965ac059d which used
PT_GETREGSET to fetch NT_PRSTATUS and NT_FPREGSET.

Reviewed by:	markj, emaste
MFC after:	2 weeks
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D35665
2022-06-30 10:04:49 -07:00
Fernando Apesteguía
4a3c598f35 Bump .Dd for recently modified manual pages
During the removal of named(8) references, some pages were modified but their
.Dd where not updated accordingly.

Reported by:	lwhsu@
Fixes:	942e234d86
2022-06-27 18:20:03 +02:00
Fernando Apesteguía
942e234d86 Remove references to named(8)
named(8) hasn't been in base for some time. Remove all references to it in
manual pages.

Approved by:	manpages (Pau Amma)
Differential Revision:	https://reviews.freebsd.org/D35586
2022-06-26 18:53:08 +02:00
Tom Jones
26b5deef22 diff3: Add man page description for version and help
Reviewed by:	Pau Amma
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35325
2022-06-23 13:37:28 +01:00
Alexander V. Chernikov
c8f34118ac netstat: print path weight when showing routes in structured output.
Differential Revision: https://reviews.freebsd.org/D35530
MFC after:	2 weeks
2022-06-22 12:47:06 +00:00
Dmitry Chagin
4d496ab44a kdump: Decode Linux *at() syscalls
MFC after:		2 weeks
2022-06-22 14:29:38 +03:00
Dmitry Chagin
ed2f123a21 kdump: For future use made decode_filemode() public
MFC after:		2 weeks
2022-06-22 14:26:50 +03:00
Dmitry Chagin
39de84b619 kdump: Decode Linux clock_nanosleep syscall
MFC after:		2 weeks
2022-06-22 14:21:42 +03:00
Dmitry Chagin
f587a2a765 kdump: Decode Linux sigprocmask how argument
MFC after:		2 weeks
2022-06-22 14:20:39 +03:00
Dmitry Chagin
b9b86b6742 kdump: Decode getitimer, setitimer which argument
Reviewed by:		jhb (previous version, without truss)
Differential revision:	https://reviews.freebsd.org/D35231
MFC after:		2 weeks
2022-06-22 14:19:31 +03:00
Dmitry Chagin
3606a213bf kdump: Decode Linux l_sigset_t.
Reviewed by:		markj
Differential revision:	https://reviews.freebsd.org/D35153
MFC after:		2 weeks
2022-06-22 14:15:20 +03:00
Dmitry Chagin
8a0f6d8cfd kdump: Add preliminary support for decoding Linux syscalls
Reviewed by:		jhb
Differential revision:	https://reviews.freebsd.org/D35216
MFC after:		2 weeks
2022-06-22 14:03:56 +03:00
Dmitry Chagin
8b8e2e8f41 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
2022-06-22 14:01:36 +03:00
Kyle Evans
4014365e42 mixer: remove volume backwards compat, add % interpretation
The current situation is fairly confusing, where an integer is interpreted
as a percent until you slap a decimal on it and magically it becomes an
absolute value.

Let's have a flag day in 14.0 and remove this shim entirely.  Setting with
percent can still be useful, so allow a trailing '%' to indicate as such.
As a side effect, we tighten down the format allowed in the volume a little
bit by ensuring there's no trailing garbage after the value once it's
separated into left and right components.

Reviewed by:	christos, hselasky, pauamma_gundo.com (manpages)
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D35101
2022-06-17 22:50:58 -05:00
Mark Johnston
4b0c6fa0dc 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
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35476
2022-06-14 12:00:59 -04:00
Stefan Eßer
78bc019d22 usr.bin/bc: update to version 5.3.1
This version adds support for command line editing and history using
the libedit or readline libraries in addition to the line editing
features available in previous versions.

The version in the base system is configured to use libedit.

This allows to choose between emacs and vi line editing commands and
to use command overrides via a ~/.editrc file.

Merge commit 'bd54318046bfee055b140705a5cfd4148e78da07'

PR:		264010

MFC after:	2 weeks
2022-06-11 13:14:37 +02:00
John Baldwin
1c44d2bf86 usr.bin/dtc: Include <limits> for std::numeric_limits<>.
This is needed when building natively as a cross-tool on hosts such as
Linux using more recent versions of libstdc++.

Co-authored-by:	Alexander Richardson <arichardson@FreeBSD.org>
Obtained from:	CheriBSD
2022-06-09 10:20:03 -07:00
John Baldwin
81c857dd7e gcore: Don't hardcode VM write permissions.
This ensures read-only PT_LOAD segments are not marked as writable in
the phdr flags.

Reviewed by:	markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D35398
2022-06-06 16:43:02 -07:00
John Baldwin
ad52a7bb03 gcore: Remove unused elf_note_arm_vfp function.
Fixes:		add00c381e Use a regset for NT_ARM_VFP.
2022-06-06 11:06:49 -07:00
Gordon Bergling
bb0e21032b sed(1): Fix a typo in a source code comment
- s/Initialy/Initially/

Obtained from:	NetBSD
MFC after:	3 days
2022-06-04 20:27:45 +02:00
Arseny Smalyuk
d18b4bec98 netinet6: Fix mbuf leak in NDP
Mbufs leak when manually removing incomplete NDP records with pending packet via ndp -d.
It happens because lltable_drop_entry_queue() rely on `la_numheld`
counter when dropping NDP entries (lles). It turned out NDP code never
increased `la_numheld`, so the actual free never happened.

Fix the issue by introducing unified lltable_append_entry_queue(),
common for both ARP and NDP code, properly addressing packet queue
maintenance.

Reviewed By: melifaro
Differential Revision: https://reviews.freebsd.org/D35365
MFC after:	2 weeks
2022-05-31 21:06:14 +00:00
Kyle Evans
5b7adeb184 zdiff: avoid non-conformant features
`setvar` is a non-conformant feature that looks slightly neater but is
not portable to other /bin/sh implementations.  Making the script
portable is straightforward, so let's do it.

Tests are added to make sure that I didn't break anything major in the
process.

Reviewed by:	bapt (previous version), jilles
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D35275
2022-05-30 19:25:16 -05:00
Alexander V. Chernikov
08e77283b7 sockstat: be more verbose when reporting kernel/userland size mismatch.
MFC after:	2 weeks
2022-05-30 10:54:53 +00:00
Rick Macklem
d92dc803f6 nfsstat: Add an entry to output NFSPROC_APPENDWRITE count
Commit 5218d82c81 added a new NFSv4.1/4.2 procedure called
AppendWrite that uses a Verify to avoid a separate Getattr RPC
for the common case where the client knows the correct file
size for O_APPEND writes.

This patch modifies nfsstat so that it displays a count of
these new RPCs for the "-E -c" option.
2022-05-28 16:27:02 -07:00
Gleb Smirnoff
d59bc188d6 sockbuf: remove unused mbuf counter and cluster counter
With M_EXTPG mbufs these two counters already do not represent the
reality.  As we are moving towards protocol independent socket buffers,
which may not even use mbufs at all, the counters become less and less
relevant.  The only userland seeing them was 'netstat -x'.

PR:			264181 (exp-run)
Reviewed by:		markj
Differential revision:	https://reviews.freebsd.org/D35334
2022-05-27 08:20:17 -07:00
Tom Jones
3ddd6eb688 diff3: Add help and version options
Add help and version flags. Exit values in these paths are set to match
the behaviour of gnu diff3.
2022-05-25 14:53:06 +01:00
Tom Jones
59f6408d8d diff3: Copy line into debug information
Sponsored by:	Klara Inc.
2022-05-25 14:45:51 +01:00
Tom Jones
7d975c7f93 diff3: Don't perform a bitwise OR when comparing diffs
This fixes the build now that it uses -Wbitwise-instead-of-logical

Sponsored by:	Klara Inc.
2022-05-25 14:43:14 +01:00
Bartosz Sobczak
cdcd52d41e
irdma: Add RDMA driver for Intel(R) Ethernet Controller E810
This is an initial commit for RDMA FreeBSD driver for Intel(R) Ethernet
Controller E810, called irdma.  Supporting both RoCEv2 and iWARP
protocols in per-PF manner, RoCEv2 being the default.

Testing has been done using krping tool, perftest, ucmatose, rping,
ud_pingpong, rc_pingpong and others.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Reviewed by:	#manpages (pauamma_gundo.com) [documentation]
MFC after:	1 week
Relnotes:	yes
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D34690
2022-05-23 16:52:49 -07:00
Andrew Turner
f9ca52bab5 Use getpagesize in gcore to find the page size
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35194
2022-05-19 11:32:26 +01:00
Christian Weisgerber
9bf4983f54 truss: add ppoll(2) argument decoding
PR:		264029
Approved by:	emaste
MFC after:	3 days
2022-05-17 20:23:25 +02:00
Dimitry Andric
04eeddc0aa 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
2022-05-14 13:44:34 +02:00
Dimitry Andric
5e801ac66d 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
2022-05-14 13:43:32 +02:00
Dmitry Chagin
586ed32106 kdump: Decode cpuset_t.
Reviewed by:		jhb
Differential revision:	https://reviews.freebsd.org/D34982
MFC after:		2 weeks
2022-05-11 10:40:39 +03:00
Tom Jones
c1c381eb7f diff3: Remove test case that references non existent test files
Sponsored by:	Klara, Inc.
2022-05-02 16:00:44 +01:00
Piotr Pawel Stefaniak
ed016aa435 base64: ignore -i as promised 2022-04-24 08:23:27 +02:00
Piotr Pawel Stefaniak
aad4fd5495 Add a quoted-printable encoder/decoder
As an example:
printf 'We don=27t know what to do with other=20worlds.=0D=0A' \
| bintrans qp -u

Differential Revision:	https://reviews.freebsd.org/D34933

Reviewed by:	debdrup (manpage)
2022-04-24 08:20:27 +02:00
Piotr Pawel Stefaniak
ff2b1ffbb0 bintrans: adjust mmencode.c to style(9) 2022-04-24 08:19:49 +02:00
Piotr Pawel Stefaniak
9d68da4ee8 bintrans: make mmencode.c compilable
Also remove MSDOS code, base64 code and commented out code.
2022-04-24 08:19:48 +02:00
Piotr Pawel Stefaniak
8a65b02dac bintrans: import mmencode.c for quoted-printable en/de-coding
This is a preliminary commit in preparation for exposing
a quoted-printable encoder and decoder through the new command bintrans.
2022-04-24 08:19:48 +02:00
Simon J. Gerraty
2f2a5ecdf8 Merge bmake-20220418
o ignore '.POSIX:' if not in first non-comment line
        of Makefile as specified by POSIX.
        add unit-tests for above.

Merge commit '92bfae0e6bd53a7a0d6fe55e70a916d86cf26e8b'
2022-04-22 13:42:11 -07:00
Alan Somers
1a7f22d9c2 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.

MFC after:	2 weeks
Sponsored by:	Axcient
Relnotes:	yes
Reviewed by: 	bapt, bcr
Differential Revision: https://reviews.freebsd.org/D29901
2022-04-20 15:18:41 -06:00
Gordon Bergling
583bb9c530 sed(1): Fix a typo in the manual page
- s/occurances/occurrences/

MFC after:	3 days
2022-04-20 13:00:42 +02:00
Tom Jones
034dd2d54f diff3: Add support for -m
diff3 in -m mode generates a complete file with changes bracketed with
conflict markers. This adds support for diff3 to generate version
control style three way merge output.

The output format was inferred from looking at the gnu diff3 output on a
selection of test files as a specification of what diff3 -m should
output is not available. It is likely there are cases where the -m
output differs from other tools and I am happy to update diff3 to
address these.

Discussed with:	pstef, kevans
Sponsored by:	Klara, Inc.
2022-04-19 16:20:24 +01:00
Tom Jones
9ab079c5e8 diff3: Add support for -A
Diff3 in -A mode generates an ed script to show how the 3 files and
brackets changes that conflict. The ed script generated should when
applied leave familiar merge conflict markers in a patched file.

Diff3 output is not documented, this feature has been arrived at by
comparing bsd diff3 output to gnu diff3 output until they were made to
agree. There are likely to still be differences between these formats.

The gnu diff3 guide is actually quite good at explaining how diff3
output should appear, but it doesn't cover every form of output from
diff3.

https://www.gnu.org/software/diffutils/manual/diffutils.html#Comparing-Three-Files

Discussed with:	pstef, kevans
Sponsored by:	Klara, Inc.
2022-04-19 15:54:32 +01:00
Tom Jones
df092859b4 diff3: seperate old and new markers from file markers
With -A and -m output the conflict markers are not tied to the file
name. Seperate out these markers.

Sponsored by:	Klara, Inc.
2022-04-19 15:40:07 +01:00
Tom Jones
2184ca3f19 diff3: Clean up printing of ranges for edscript output
Replace the edscript code that tracked and printed lines using byte
offsets with code that can work from line offsets.

This tidies up the reduces duplication in the edscript output code. It
also fixes the usage of the de struct so that it only tracks diffs as
line offsets rather than the usage changing from line offsets to byte
offsets during the lifetime of diff3.

Large files with large numbers of ranges will probably suffer in
performance here, but as we don't use diff3 yet this isn't a regression.
Include a warning for future hackers so they have a place to start
hacking from.

Reviewed by:	pstef
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34941
2022-04-19 14:51:18 +01:00
Kyle Evans
efba49ee5a 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.
Differential Revision:	https://reviews.freebsd.org/D34950
2022-04-18 23:04:13 -05:00
Piotr Pawel Stefaniak
540a99289b Add the base64 command using b64encode and b64decode
Various scripts expect the base64 command to be present. We've had the
code and it's been exposed as b64encode/b64decode, but it wasn't widely
known under these names and the syntax is much different.

Reviewed by:	delphij
Differential Revision:	https://reviews.freebsd.org/D32945
2022-04-18 13:53:59 +02:00
Piotr Pawel Stefaniak
2ad786c63a b64encode: implement -w to wrap lines
This functionality is present in GNU base64 and I find it useful when
I want to generate random, ASCII-clean data of specific width.

Reviewed by:	delphij
Differential Revision:	https://reviews.freebsd.org/D32944
2022-04-18 13:53:58 +02:00
Piotr Pawel Stefaniak
f331cf9b04 bintrans: reinstate a test case that I lost
Reported by:	https://ci.freebsd.org/job/FreeBSD-main-amd64-test/21166
2022-04-18 13:53:58 +02:00
Piotr Pawel Stefaniak
47bcbde91d bintrans: move files to a new directory
And reflect the change in various places.
2022-04-18 10:53:11 +02:00
Piotr Pawel Stefaniak
4cd4841a27 Modularize uuencode and uudecode by wrapping them in bintrans.c
The program will be installed as bintrans, uuencode, uudecode,
b64encode, and b64decode and will be responsible for running the coders
according to their historical behavior.

Additionally, bintrans will be able to take a parameter designating
the coder and accept all its options in this form:
bintrans <coder> [options]
and the behavior should be the same as if
<coder> [options]
was invoked.
This has the advantage that adding coders won't require installing them
as binaries.

Move uudecode files to uuencode since the latter is the one that
provides the manual page.

Reviewed by:	delphij (previous version)
Differential Revision:	https://reviews.freebsd.org/D32943
2022-04-18 10:46:44 +02:00
Tom Jones
7c03df6855 diff3: allow diff3 ed scripts to generate deletions
diff3 with the -e (ed script flag) can generate line deletions, add
support for deletions and add a test case to exercise this behaviour.
This functionality was unearthed through comparison of bsd diff3 and gnu
diff3 output.

Reviewed by:	pstef
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34912
2022-04-15 15:00:59 +01:00
Daniel Ebdrup Jensen
bd1eafcdd0 protect(1): Correct typo and add newline
Fix a typo, and move a sentence onto a new line in accordance with
mdoc(7) syntax.

While here, also remember to bump .Dd accordingly, as it was missed in
the prior commit.

Reported by:	maxim@
2022-04-12 12:38:50 +02:00
Adam Wolk
c8b6be0f7d protect.1: document existence of _oomprotect
Improve discoverability of the functionality by mentioning in the
userland tool manual. Add a SEE ALSO entry to rc.conf(5) where more
details are provided.

Sponsored by:   Fudo Security (a.wolk)
Differential Revision:	https://reviews.freebsd.org/D30334
2022-04-12 00:23:43 +02:00
Konstantin Belousov
bd8701dede Document procstat(1) advlock command
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34834
2022-04-10 00:47:50 +03:00
Konstantin Belousov
a5229a255e Implement procstat(1) advlocks command
to display list of the advisory file locks in the system.

Example output
$ procstat advlock
RW  TYPE   PID SYSID          FSID               RDEV   INO START LEN PATH
RO FCNTL  5836     0  0x878700ff02 0xffffffffffffffff    57     0   0 /tmp/2
RW FLOCK    -1     0  0x878700ff02 0xffffffffffffffff    13     0   0 /tmp/1

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34834
2022-04-10 00:47:50 +03:00
Konstantin Belousov
e79866ddf1 procstat(1): add ability to specify subcommands not requiring pid lists
Add PS_MODE_NO_KINFO_PROC cmd modifier that indicates that neither
process list should be queried from the kernel, nor list of pids or `-a`
switch provided on the command line to filter the output.

This is intended for use by commands that query information not
neccessary attributed to specific process.

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D34834
2022-04-10 00:47:50 +03:00
Lewis Cook
fcaf016796 Correct calendar date entry for myself
Approved by:		hselasky (src)
Differential Revision:	https://reviews.freebsd.org/D34839
2022-04-08 14:02:30 +01:00
Mateusz Piotrowski
2f60a7f902 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
2022-04-08 12:27:13 +02:00
Simon J. Gerraty
1d3f2ddc32 Merge bmake-20220330
Merge commit 'a052cb432096794be5070dc68a2b302eaf5a4783'
2022-04-03 12:58:43 -07:00
Gordon Bergling
2fc0894023 top(1): Fix a typo in a source code comment
- s/accomodate/accommodate/

MFC after:	3 days
2022-04-02 14:53:20 +02:00
Mateusz Piotrowski
e6013eb071 systat.1: Fix lists
Some of the lists were not displaying correctly. Fix that.

Also, address linters errors.

Fixes:	22054f8891 Report I/O stats from the CAM_IOSCHED_DYNAMIC extension
MFC after:	1 week
2022-04-02 00:49:53 +02:00
Jose Luis Duran
2d5df84081 dtc.1: Fix the display of directives ending with semicolons
While here, fix a typo and bump the date.

Obtained from:	https://github.com/davidchisnall/dtc/pull/71
Fixes:	6979e8cb6e
2022-03-30 17:45:50 +02:00
Piotr Pawel Stefaniak
ae6aa2d43d uudecode: move the new uudecode test from uuencode/ to uudecode/
I don't know how that happened.

Fixes:		9f3203c003 "uudecode: correct error message"
2022-03-29 07:29:39 +02:00
Piotr Pawel Stefaniak
f5138631fb uudecode: use SRCDIR in the regression test
Fixes:		9f3203c003 "uudecode: correct error message"
2022-03-28 21:01:28 +02:00
Brooks Davis
b1ad6a9000 syscallarg_t: Add a type for system call arguments
This more clearly differentiates system call arguments from integer
registers and return values. On current architectures it has no effect,
but on architectures where pointers are not integers (CHERI) and may
not even share registers (CHERI-MIPS) it is necessiary to differentiate
between system call arguments (syscallarg_t) and integer register values
(register_t).

Obtained from:	CheriBSD

Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D33780
2022-03-28 19:43:03 +01:00
Piotr Pawel Stefaniak
1b3af110bc uudecode: add missing test files to Makefile
Fixes:		9f3203c003 "uudecode: correct error message"
2022-03-28 11:51:39 +02:00
Piotr Pawel Stefaniak
9f3203c003 uudecode: correct error message
PR:		153276
Reported by:	David Brennan
2022-03-28 09:01:35 +02:00
Piotr Pawel Stefaniak
d5d3f5dab2 uu{encode,decode}: improve style 2022-03-28 09:01:35 +02:00
John Baldwin
931983ee08 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
2022-03-24 11:36:19 -07:00