Commit Graph

15484 Commits

Author SHA1 Message Date
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
John Baldwin
b2cb74c22c 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
2022-03-23 13:33:06 -07:00
John Baldwin
add00c381e 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
2022-03-23 13:33:06 -07:00
Piotr Pawel Stefaniak
8b1f5965d9 procstat: remove set but not used variable
In an earlier version of D26310, strcmp was strncmp.
2022-03-18 10:03:56 +01:00
Piotr Pawel Stefaniak
fde687c239 backlight: Remove set but not used variable 2022-03-18 10:03:55 +01:00
Fernando Apesteguía
4bbc8ee29e logger.1: Clarify -i flag
The PID of the logger process is always recorded along with the move from RFC
3164 to RFC 5424.

Indicate the -i flag is a no-op now in logger(1).

Related to a similary change in syslog.3

Reported by:	danfe@
Approved by:	manpages (0mp)
Fixes:	94eb6c42ab
Differential Revision:	https://reviews.freebsd.org/D34578
2022-03-16 11:41:55 +01:00
Hans Petter Selasky
d5ad1713cc Chase mixer(8) command-line interface changes
Some more nits regarding mute feature.

Differential revision:	https://reviews.freebsd.org/D34545
Sponsored by:		NVIDIA Networking
2022-03-14 09:38:04 +01:00
Mateusz Piotrowski
e83a53abeb Chase mixer(8) command-line interface changes
FreeBSD 14.0 is going to ship with a new implementation of the mixer(8)
command. Unfortunately, in order to support new features like mute, the
command-line interface of the new implementation is not backwards
compatible.

Update all the remaining documentation and scripts in the src tree
to use the new syntax.

While here, document in usbhidaction.1 that the mute functionality is
now supported.

Reviewed by:	christos, debdrup, hselasky
Approved by:	hselasky (src)
Fixes:	903873ce15 Implement and use new mixer(3) library for FreeBSD.
Differential Revision:	https://reviews.freebsd.org/D34545
2022-03-13 17:43:49 +01:00
Steve Wills
db11c57a6c usr.bin/who.c: Fix boot time checking
The boot time entry doesn't have a tty specified, so don't check it.
While here, make ttystat handle that case.

Approved by:	kevans (src)
Differential Revision:	https://reviews.freebsd.org/D34524
2022-03-12 11:49:49 -05:00
Mariusz Zaborski
cb54c500d0 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
2022-03-12 11:38:12 +01:00
John Baldwin
4965ac059d 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
2022-03-10 15:40:44 -08:00
Simon J. Gerraty
31fde97357 script: use %n at the end of default tstamp_fmt
Since we are only outputting time-stamps when they differ
ending it with a newline, interferes with the output less.
2022-03-10 09:42:55 -08:00
Tom Jones
93b7af1d85 diff: Re-add void argument to usage
Previous commit (8cf449db88)
unintentionally dropped the 'void' argument to usage, reinstate it.

Sponsored by:	Klara Inc.
2022-03-10 16:24:02 +00:00
Tom Jones
8cf449db88 diff: add support for --help and --version
Add support for --help and --version to be compatible with gnu diff.

gnu diff --help writes to stdout, do the same to be compatible

Reviewed by:	bapt, pstef, debrup, Pau Amma
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D34508
2022-03-10 16:17:37 +00:00
Simon J. Gerraty
7b45ad3f89 script -T skip timstamps for same second
The result is much more readable if we only output the time-stamp
when it is at least 1s since last one.
2022-03-09 22:19:53 -08:00
Simon J. Gerraty
6c4afed566 script add -T fmt to print time-stamps
script -r is useful for recording time-stamps of when output
happened.  With -T, rather than playback the script in real-time
we simply print the time-stamps to show when the output happened.

This is very useful for example, for analyzing boot time activity.

If the fmt provided contains no % characters the default
%n@ %s [%Y-%m-%d %T]
is used, which lends itself to analysis by tools as well as humans.

Sponsored by:	Juniper Networks, Inc.

Reviewed by:	allanjude
Differential Revision:	https://reviews.freebsd.org/D34511
2022-03-09 13:33:03 -08:00
Tom Jones
7e64519a47 diff: set cflag when passed to diff
In b5541f456d when flags were converted to
be boolean, the setting of cflag as an integer was removed, but no
boolean set was added.

This effects the output format of dates, but the context type was set to
D_CONTEXT so other functionality worked.

Reviewed by:	bapt
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D34481
2022-03-09 09:32:14 +00:00
Alfonso S. Siciliano
e031614d59
bsddialog: new utility for TUI dialogs and widgets
Approved by:		bapt (mentor)
Differential Revision:	https://reviews.freebsd.org/D34101
2022-03-06 22:50:20 +01:00
Dimitry Andric
f7d6e97e4b 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
2022-03-04 20:46:56 +01:00
Kyle Evans
0e73b834f3 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.

Sponsored by:	Klara, Inc.
2022-03-03 21:51:40 -06:00
Mateusz Piotrowski
8b73b57c1b manpages: Fix use of At macro
The versions for the At macro from 1 to 7 must be prefixed with "v".

MFC after:	3 days
2022-03-04 00:03:44 +01:00
Mateusz Guzik
f3f3e3c44d 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
2022-03-03 17:21:58 +00:00
Li-Wen Hsu
adce4585ca
Revert "Temporarily skip usr.bin.diff.diff_test.functionname in CI"
This reverts commit 85eeb6ea62.

The issue has been fixed by 4be7d087c2.

PR:		262086
2022-03-02 05:37:25 +08:00
Mateusz Guzik
6882d53b7f 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
2022-03-01 20:07:44 +00:00
Tom Jones
4be7d087c2 diff: Use start of change when searching for function
Use the start of change when searching for a function rather than the
start of the context. In short functions if this could result in search
for the function name starting from before the function definition.

PR:		262086
Reviewed by:	bapt, mckusick, mhorne
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D34328
2022-03-01 13:27:21 +00:00
Jessica Clarke
89f5bc467c dtc: Sync with upstream version e9a77451cdd8
1c231509cf88 ("Validate integers fit in cells") is the only change
missing from our copy.

Reviewed by:	manu, imp
Differential Revision:	https://reviews.freebsd.org/D34368
2022-02-28 22:37:47 +00:00
Jessica Clarke
b58ea3e1f7 Fix hand-rolled METALOG entries for installconfig during distributeworld
During distributeworld we call distribute on subdirectories, which in
turn calls installconfig. However, this recursive installconfig call
appends the distribution name (in these cases, "base") to DESTDIR. For
install(1) this works fine as its -D argument comes from the top-level
Makefile.inc1, which passes the original DESTDIR, thereby resulting in
the METALOG entry having the distribution name as a prefix representing
its true installed path relative to the root, but for the hand-rolled
entries they do not use install(1) and thus do not have access to what
the original DESTDIR was, resulting in the METALOG missing this prefix.

Thus, pass down the name of the distribution via a new variable DISTBASE
(chosen as Makefile.inc1 already uses that to convey this exact same
information to etc's distrib-dirs during distributeworld) and prepend
this to the handful of manually-generated METALOG entries. For the
installworld case this variable will be empty and so this behaves as
before.

Note that we need to be careful to avoid double slashes in the METALOG;
distributeworld uses find | awk to split the single METALOG up into
multiple dist.meta files, and this relies on the paths in the METALOG
having the exact prefix ./dist (or ./dist/usr/lib/debug).

Reviewed by:	brooks, emaste
Differential Revision:	https://reviews.freebsd.org/D33997
2022-02-28 22:36:39 +00:00
Warner Losh
22054f8891 Report I/O stats from the CAM_IOSCHED_DYNAMIC extension
Report, on a periodic basis, the I/O latencies the CAM I/O scheduler
computes. These times are only for the hardware portion of the I/O as
measured from the time the operation is scheduled with the SIM using
xpt_action() until the SIM reports it has completed with xpt_dine(). Any
time the I/O operation spends in a software queue is no included.

The P50 (median), P90, P99 and P99.9 statistics about the latency of
each of the read, write and trim operations that completed during the
polling interval are reported. If there are fewer than 2, 10, 100 or
1000 operations during the polling interval, no statistic is reported
and a single dash '-' is displayed.

The read, write and trim commands (either on the command line or at run
time) toggle display of these operations. The color command toggles
color (it defaults to on, like gstat). When color is enabled, unknown
statistics are reported in blue, high latency for a statistics is
reported in red, medium in magenta and low in green (as with gstat). The
med= and hi= commands can set these latency thresholds.

Limitations: The entire sysctl space for all the devices is walked for
each polling period. This should be optimized to remember the OIDs and
only do such polling with the xpt generation changes. There is also no
way to filter devices displayed. This command only works on physical
devies that are connected to SCSI, ATA or NVME sims as those are the
only ones that are instrumented in the CAM I/O scheduler (the
CAM_IOSCHED_DYNAMIC option must be in the kernel, and the dynamic
scheduler can't be disabled).

MFC After:		1 month
Relnotes:		yes
Sponsored by:		Netflix
Reviewed by:		pauamma_gundo.com, chs
Differential Revision:	https://reviews.freebsd.org/D34259
2022-02-28 10:44:47 -07:00
Jamie Gritton
be7cf3f4b8 posixshm: Add a -j option to posixshmcontrol ls, to specify a jail
PR:		257556
Reported by:	grembo@
2022-02-26 17:45:28 -08:00
Eric van Gyzen
58135fbd8b 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
2022-02-25 09:30:29 -06:00
Richard Scheffenegger
bd6bb49397 iscsi: per-session timeouts and rapid teardown of session on reconnect
Add per-Session configurable ping (SCSI NOP) and login timeouts.

Remove the torn down, old iSCSI session quickly, when performing a reconnect.

Reviewed By: trasz
Sponsored by:        NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D34198
2022-02-25 10:35:47 +01:00
Warner Losh
6979e8cb6e dtc: more mandoc -T lint fixes
Obtained from:		dtc repo 04c805a8b08e4a1d4ff1f1e62ef475fbfe1a5fbe
Sponsored by:		Netflix
2022-02-24 13:54:13 -07:00
Jose Luis Duran
62d16ad37d dtc.1: Mention the existence of -i flag
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/570
2022-02-23 09:25:30 -07:00
Jose Luis Duran
7ae5d1f00f dtc.1: Appease mandoc -T lint
Prefer .Fx to bare FreeBSD

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/579
2022-02-23 09:25:19 -07:00
Li-Wen Hsu
85eeb6ea62
Temporarily skip usr.bin.diff.diff_test.functionname in CI
PR:		262086
Sponsored by:	The FreeBSD Foundation
2022-02-21 16:31:43 +08:00
Stefan Eßer
32066c96fa 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.

Reported by:	antoine
MFC after:	3 days
2022-02-20 15:24:43 +01:00
наб
7e05fa3b44 uname: -v: strip final whitespace compatibly with uname(3)
This restores POSIX.1 conformance

PR: 260938
2022-02-18 16:30:10 +00:00
Tom Jones
3931c072c6 diff: fix failed compare when ignoring file case
With --ignore-file-name-case we need to compare files regardless of
case. We need to propigate both names down to diffit so we can look up
the correct file when the names differ based on case, otherwise we try
to look up the file using the case from the a tree which might not be
discoverable if its case is different in the b tree.

Reviewed by:	bapt
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D34201
2022-02-18 15:51:38 +00:00
Tom Jones
cffebd1e8f Remove surplus check for which diff is being tested
Must have left this when I was testing the test invocation for
8f79bd9b85

Pointy hat:	thj
Sponsored by:	Klara Inc.
2022-02-18 15:47:46 +00:00
Tom Jones
f4be3645a1 diff: add --no-dereference flag
When diffing files and directories, don't follow symbolic links, instead
compare where the links point to.

Reviewed by:	bapt
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D34203
2022-02-18 15:17:13 +00:00
Tom Jones
8f79bd9b85 diff: Detect Objective-C methods
When searching back for function definitions, consider lines starting
with '+' and '-', this allows us to pick up Objective-C methods as well
as C style function definitions.

Reviewed by:	bapt
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D34202
2022-02-18 15:09:57 +00:00
Ed Maste
4e1e3ff571 vtfontcvt: update FreeBSD Foundation copyrights
Remove "All Rights Reserved"
2022-02-17 20:05:14 -05:00
Eric van Gyzen
86e5e10daf 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
2022-02-17 10:09:53 -06:00
Eric van Gyzen
1581ec9a45 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
2022-02-16 13:02:45 -06:00
Ed Maste
828e50092a elfctl: whitespace cleanup
Reported by:	jrm (in review D34283)
2022-02-15 08:46:14 -05:00
Ed Maste
82b611ed18 elfctl: fix operations with multiple features on multiple files
Previously an invocation like

  elfctl -e +feature1,feature2 file1 file2

would set both feature flags in file 1 but only feature1 in file2 (due
to the string being modified by strsep()).

Reported by:	jrm
Tested by:	jrm
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34283
2022-02-15 08:42:17 -05:00
Ed Maste
b8185579f4 elfctl: fix -e invalid operation error handling
Validate the operation prior to parsing the feature string, so that e.g.
-e 0x1 reports invalid operation '0' rather than invalid feature 'x11'.
Also make it an error rather than a warning, so that it is not repeated
if multiple files are specified.

(Previously an invalid operation resulted in a segfault.)

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2022-02-14 22:35:03 -05:00
Ed Maste
f0cf9b602d elfctl: error if -e is specified multiple times
Reported by:	jrm
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2022-02-14 22:08:47 -05:00
Wolfram Schneider
047eec4966 improve c style
- BSD KNF: return is a native statement and we use
  a space before the parenthesis
- remove superfluous empty lines

Reported by:    jrtc27
2022-02-14 19:30:09 +00:00
Wolfram Schneider
a9a43945d3 grammar
Reported by:	jrtc27
2022-02-14 18:16:43 +00:00