Commit Graph

15450 Commits

Author SHA1 Message Date
Emmanuel Vadot
9c1720e59a pkgbase: Create a FreeBSD-smbutils package
And put smb related programs and lib in it.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D38228
2023-02-08 08:48:28 +01:00
Stefan Eßer
4fca8e0f65 contrib/bc: uodate to version 6.2.4
This update contains only documentation changes (new main repository
URL and changed mail address of the program author) and changes to
the build system that do not affect the FreeBSD base system build.

MFC after:	3 days
2023-02-06 22:33:56 +01:00
Mateusz Guzik
d9d5f2c042 cpuset: add --count
Can be used to count the number of hardware threads in the cpu set.

For example:
$ cpuset -g -p $$
pid 2440 mask: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
35, 36, 37, 38, 39
pid 2440 domain policy: first-touch mask: 0, 1
$ cpuset -g --count -p $$
40

The intent is to replace calls to sysctl hw.ncpu and kern.smp.cpus which
can be found in the tree, which are not adequate given existence of
cpusets.

Right now only -g -p combination is supported to reduce complexity.
As anything else errors out, this can be expanded later as needed.

Differential Revision:	https://reviews.freebsd.org/D36351
2023-02-04 17:50:41 +00:00
Dimitry Andric
a9e0629719 gh-bc: don't force CFLAGS to -O0 -g
Otherwise, CFLAGS passed in via bsd.sys.mk or the user's environment are
not respected, and this leads to link errors on riscv64sf.
2023-02-02 19:20:18 +01:00
Mateusz Piotrowski
e7ab133648 timeout: Move from /usr/bin to /bin
timeout(1) is used by /etc/rc.d/zfskeys. Unfortunately, having
timeout(1) installed in /usr/bin causes problems when /usr is an
encrypted ZFS partition.

Implementing timeout(1) in sh(1) is not trivial. A more elegant solution
is to move timeout(1) to /bin so that it is available to early services
in the boot process.

PR:		265221
Reviewed by:	allanjude, des, imp
Approved by:	allanjude, des, imp
Reported by:	Ivan <r4@sovserv.ru>
Fixes:	33ff39796f Add zfskeys rc.d script for auto-loading encryption keys
MFC after:	1 week
Relnotes:	yes
Sponsored by:	Modirum MDPay
Sponsored by:	Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D38344
2023-02-02 18:34:35 +01:00
Dag-Erling Smørgrav
134841a7f3 cmp: Increase buffer size for non-mmap case.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	rpokala
Differential Revision:	https://reviews.freebsd.org/D38281
2023-01-31 01:29:05 +01:00
Dag-Erling Smørgrav
6673a5476d cmp: Print a summary on SIGINFO.
MFC after:	1 week
Sponsored by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D38280
2023-01-31 01:29:05 +01:00
Gleb Smirnoff
bcad3f96ae gh-bc: fix build with WITHOUT_NLS_CATALOGS=YES 2023-01-30 13:26:49 -08:00
Phil Shafer
ef7d10fde4 Add missing check for xo_parse_args return code. 2023-01-30 15:43:01 -05:00
Phil Shafer
e1e2080fc1 Import Juniper libxo-1.6.0
PR:		262332
2023-01-30 13:37:33 -05:00
Cameron Katri
c8abb673a5 man(1): Support zstd compressed manpages using zstdcat
Reviewed by:	emaste, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D32296
2023-01-30 13:12:36 -05:00
Jamie Landeg-Jones
37399d5bcf usr.bin/stat: Fix error message formatting.
PR:		bin/261657
MFC after:	3 days
2023-01-29 14:37:25 -08:00
Alexander V. Chernikov
15dbf5a241 netstat: export weight for single-path routes.
* Parse and export newly-added NL_RTA_WEIGHT attribute, providing path
 weight for a non-multipath route. This fixes a number of tests in
 sys/net/routing which rely on this data.
* Remove handling of NL_RTA_KNH_ID in multipath routes, as it is
 not provided.
* Improve kernel/user nexthop index export. As a result,
 for multipath routes:
  * nhg-kidx attribute represents kernel nhg index (always provided)
  * nhg-uidx attribute represents user-provided nhg index (if set)
 for non-multipath routes:
  * nhop-kidx attribute represents kernel nhop index (always provided)
  * nhop-udx attribute represents user-provided nexthop index (if set)
2023-01-29 16:27:31 +00:00
Stefan Eßer
fdd4c35832 usr.bin/gh-bc: update Makefiles for version 6.2.2
The sources of this program are in contrib/bc, but built using the
Makefiles touched in this commit, which had to be adapted to comply
with changed made to the build system of this software, which is
not used when building in the base system.
2023-01-28 23:48:34 +01:00
Xin LI
8f02c0d156 Disable sandboxing when building with WITHOUT_CAPSICUM.
PR:		bin/269185
MFC after:	3 days
2023-01-28 10:53:47 -08:00
Alexander Naumochkin
050e4bca94 stat(1): Do not pass S_IFBLK to devname unconditionally
PR:	269190
Reviewed by:	kib
MFC after:	1 week
2023-01-28 20:04:43 +02:00
Simon J. Gerraty
4fde40d9b5 Merge/update to bmake-20230126 2023-01-27 16:33:01 -08:00
Alexander V. Chernikov
79111aa26f netstat: fix format string on 32-bit archs 2023-01-27 17:45:49 +00:00
Allan Jude
5ff13fbc19 MFV: zstd 1.5.2
Merge commit 'b3392d84da5bf2162baf937c77e0557f3fd8a52b' into zstd_1.5.2

full changelog: https://github.com/facebook/zstd/compare/v1.4.8...v1.5.2

Updated sys/kern/subr_compressor.c to new API

MFC after:	3 days
Relnotes:	yes
Sponsored by:	Klara, Inc.
2023-01-27 17:22:31 +00:00
Alexander V. Chernikov
68636dcb6f netstat: make netstat -rn use netlink instead of rtsock
This change switches route listing in netstat to netlink, with fallback to rtsock.
The outputs are mostly identical, with an exception of not showing kernel
 nexthop indexes for multipath routes.

Differential Revision: https://reviews.freebsd.org/D36529
2023-01-27 15:36:10 +00:00
Ed Maste
ac4c695ad6 Retire WITHOUT_CXX option
Several important base system components are written in C++, and the
WITHOUT_CXX option produced a system that was not fully functional.
Just accept this, and remove the option to build without C++ support.

This reverts commit adc3c128c6.

Reviewed by:	brooks, kevans, jhb (earlier)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33108
2023-01-26 21:13:16 -05:00
Dag-Erling Smørgrav
6fc1bbbf62 w: Unlike err(3), xo_err(3) won't accept a null format string.
MFC after:	1 week
X-MFC-with:	d90ff31ae5
Sponsored by:	Klara, Inc.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D38192
2023-01-25 18:03:00 +01:00
Dag-Erling Smørgrav
d90ff31ae5 w: Complete libxo transition.
MFC after:	1 week
Sponsred by:	Klara, Inc.
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D38172
2023-01-25 07:22:46 +01:00
Dag-Erling Smørgrav
14ebab25e1 find: Logic nit in man page.
Arguments follow primaries, not the other way around.

MFC after:	1 week
Sponsored by:	Klara, Inc.

Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D38173
2023-01-24 09:53:35 +01:00
Elliott Mitchell
e5c30ac930 vmstat: fix overflow of interrupt name buffer
sysctl() provides a count of number of bytes in the buffer.  That is the
actual buffer length.  Whereas looking for an interrupt entry with an
empty name could terminate too early, or overflow the end of the buffer.
The overflow will occur if the table of interrupt names is full.

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D36628
2023-01-20 04:51:13 +02:00
Elliott Mitchell
d4d7971849 vmstat: remove shadow variables
These appear to simply be the style of arguments are left untouched and
only local variables are modified.  While some may prefer that style
this simply serves to complicate things as they're perfectly writeable.

Reviewed by:	kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D36628
2023-01-20 04:51:12 +02:00
Alan Somers
92e978439f cal: don't print terminal control characters unless stdout is a TTY
A similar change was made in svn r223931, but it was incomplete, working
only when the utility was invoked as "ncal".  Fix the same issue when
invoking as "cal".

PR:		268936
Reported by:	Ray Bellis <ray@bellis.me.uk>
MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	imp
Differential Revision: https://reviews.freebsd.org/D38045
2023-01-13 14:30:00 -07:00
Gleb Smirnoff
dd2b23006c fuser: fix loop over kinfo_proc array
The previous code would skip as many entries at the end of the
array as there were zombies in the list.  While here fix type
of cnt.

Submitted by:	Ali Abdallah <ali.abdallah suse.com>
PR:		232702
MFC After:	2 weeks
2023-01-09 08:40:20 -08:00
Kyle Evans
e898a3af97 grep: properly switch EOL indicator with -z
-z is supposed to use only the NUL byte as EOL, but we were
inadvertently using both newline and NUL due to REG_NEWLINE in cflags.

The odds of anyone relying on this bsdgrep-specific bug are quite low,
so let's just fix it.  At least one port in the wild has been reported
to expect the intended behavior.

Reported by:	Hill Ma <maahiuzeon@gmail.com>
Triaged by:	the self-proclaimed peanut gallery on Discord
2023-01-03 23:37:54 -06:00
Yoshihiro Takahashi
a1f28ec729 unzip: Document optional member list
Submitted by:	Pat Maddox (man page)
PR:		267426
MFC after:	2 weeks
2023-01-02 13:17:27 +09:00
David E. O'Brien
43dc1409c1 Restricting xargs to '-n1' is much slower and isn't needed for file(1)
Also note that libc.so.6 is an older version of libc (thus why you'd
want to find files linked against it).
2022-12-28 15:54:29 -08:00
Wolfram Schneider
433c5a8ae4 do not expect mandoc(1) to terminate in finite time
PR:		266868
2022-12-27 17:04:04 +00:00
Mike Karels
c7a0637417 bspatch.1: fix missing argument
Fix typo

MFC after:	3 days
Reviewed by:	gbe
Differential Revision:	https://reviews.freebsd.org/D37727
2022-12-22 11:13:32 -06:00
Jose Luis Duran
cf7fe60e63 grep.1: Add an ENVIRONMENT section
Document the environment variables used by grep(1).

Reviewed by:	pauamma, kevans
MFC after:	5 days
Differential Revision:	https://reviews.freebsd.org/D37726
2022-12-18 08:22:24 +01:00
Gleb Smirnoff
eaabc93764 tcp: retire TCPDEBUG
This subsystem is superseded by modern debugging facilities,
e.g. DTrace probes and TCP black box logging.

We intentionally leave SO_DEBUG in place, as many utilities may
set it on a socket.  Also the tcp::debug DTrace probes look at
this flag on a socket.

Reviewed by:		gnn, tuexen
Discussed with:		rscheff, rrs, jtl
Differential revision:	https://reviews.freebsd.org/D37694
2022-12-14 09:54:06 -08:00
Kyle Evans
54d65fdd56 diff: restyle loop a bit
This is a bit more readable, and this loop is probably unlikely to gain
any `continue` or `break`s.

Suggested by:	pstef
Differential Revision:	https://reviews.freebsd.org/D37676
2022-12-13 19:31:21 -06:00
Kyle Evans
8bf187f35b diff: fix side-by-side output with tabbed input
The previous logic conflated some things... in this block:
- j: input characters rendered so far
- nc: number of characters in the line
- col: columns rendered so far
- hw: column width ((h)ard (w)idth?)

Comparing j to hw or col to nc are naturally wrong, as col and hw are
limits on their respective counters and nc is already brought down to hw
if the input line should be truncated to start with.

Right now, we end up easily truncating lines with tabs in them as we
count each tab for $tabwidth lines in the input line, but we really
should only be accounting for them in the column count.  The problem is
most easily demonstrated by the two input files added for the tests,
the two tabbed lines lose at least a word or two even though there's
plenty of space left in the row for each side.

Reviewed by:	bapt, pstef
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D37676
2022-12-13 19:31:21 -06:00
Ed Maste
86edb11e74 Always install llvm-objdump as objdump
Instead of providing no /usr/bin/objdump when LLVM_BINUTILS is false.

PR:		267854 [exp-run]
Reviewed by:	dim
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37445
2022-12-12 10:36:02 -05:00
Konstantin Belousov
1bbc510134 posixshmcontrol(1): for regular shmfd, report used pages number
Reviewed by:	markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D37097
2022-12-09 14:17:12 +02:00
Gleb Smirnoff
e68b379244 tcp: embed inpcb into tcpcb
For the TCP protocol inpcb storage specify allocation size that would
provide space to most of the data a TCP connection needs, embedding
into struct tcpcb several structures, that previously were allocated
separately.

The most import one is the inpcb itself.  With embedding we can provide
strong guarantee that with a valid TCP inpcb the tcpcb is always valid
and vice versa.  Also we reduce number of allocs/frees per connection.
The embedded inpcb is placed in the beginning of the struct tcpcb,
since in_pcballoc() requires that.  However, later we may want to move
it around for cache line efficiency, and this can be done with a little
effort.  The new intotcpcb() macro is ready for such move.

The congestion algorithm data, the TCP timers and osd(9) data are
also embedded into tcpcb, and temprorary struct tcpcb_mem goes away.
There was no extra allocation here, but we went through extra pointer
every time we accessed this data.

One interesting side effect is that now TCP data is allocated from
SMR-protected zone.  Potentially this allows the TCP stacks or other
TCP related modules to utilize that for their own synchronization.

Large part of the change was done with sed script:

s/tp->ccv->/tp->t_ccv./g
s/tp->ccv/\&tp->t_ccv/g
s/tp->cc_algo/tp->t_cc/g
s/tp->t_timers->tt_/tp->tt_/g
s/CCV\(ccv, osd\)/\&CCV(ccv, t_osd)/g

Dependency side effect is that code that needs to know struct tcpcb
should also know struct inpcb, that added several <netinet/in_pcb.h>.

Differential revision:	https://reviews.freebsd.org/D37127
2022-12-07 09:00:48 -08:00
John Baldwin
4fa1e855be rpcgen: Unindent a line not guarded by if (mtflag).
mtflag is used to add pthread mutex locking around operations to make
them thread-safe.  Setting the state to _SERVED is not conditional on
locking.

Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D37541
2022-12-04 16:32:03 -08:00
John Baldwin
f0b58b1901 rpcgen: Don't free() a pointer after realloc().
A successful realloc() already frees the old pointer.

Reported by:	GCC -Wuse-after-free
Reviewed by:	brooks, imp, emaste
Differential Revision:	https://reviews.freebsd.org/D37540
2022-12-04 16:31:35 -08:00
John Baldwin
42fb28cef4 Explicitly set CXXSTD to c++11 for old C++ code using std::auto_ptr<>.
GCC 12 defaults to C++17 which removes (not just deprecates)
std::auto_ptr<>.  Trying to use CXXSTD of c++03 doesn't work with
libc++ headers, but c++11 does.

Reviewed by:	brooks, imp, emaste
Differential Revision:	https://reviews.freebsd.org/D37531
2022-12-04 16:25:21 -08:00
Gleb Smirnoff
657729a89d Retire trpt(8).
trpt(8) was utility to pull TCP debugging data from the kernel
originating back from 4.2BSD.  It is not used nowadays by TCP
developers.  We have more powerful debugging facilities, e.g.
the Dtrace probing, the TCP black box logging and siftr.

Discussed with: rscheff, tuexen, rrs, jtl and others
2022-12-02 14:10:55 -08:00
Daniel Dowse
e442917ee4 killall(1): allow sending signals to processes with control terminal on pts(4)
PR:	268093
Reviewed by:	kib
MFC after:	1 week
2022-12-01 04:42:35 +02:00
John Baldwin
f6fdf9214a systat: Fix a bunch of use after frees in fetch_ifstat().
I think this was probably just a typo.  initifstat() continues around
a similar loop if the mib data fails to fetch, and fetch_ifstat() was
already using a FOREACH_SAFE loop here so expected to keep going.
Calling clearifstat() from the fetch routine also seems wrong, and the
sort_interface_list() call triggered by the existing needsort = 1 will
itself set needclear to trigger a future clearifstat().

Reported by:	GCC 12 -Wuse-after-free
Differential Revision:	https://reviews.freebsd.org/D36823
2022-11-22 11:11:42 -08:00
Ed Maste
20a66ab4bf Retire CLANG_IS_CC option
A small reduction in build infrastructure complexity; when we had both
Clang and GCC in the tree it was useful to have both built, and choose
one or the other to install as /usr/bin/cc.  Now only Clang is in the
tree, and there is no point in building and installing base Clang but
not providing it as cc (and c++, cpp).

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D37075
2022-11-21 14:56:13 -05:00
Dag-Erling Smørgrav
b9fabe997f tftp: cleanup
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37433
2022-11-18 17:01:30 +01:00
Dag-Erling Smørgrav
b15e052e74 tftpd: Plug memory leaks in option handling code.
Sponsored by:	Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D37423
2022-11-18 16:39:44 +01:00
Dag-Erling Smørgrav
bacb00ab40 tftpd: whitespace cleanup 2022-11-17 16:42:30 +00:00