Commit Graph

21203 Commits

Author SHA1 Message Date
Ka Ho Ng
1eaa36523c fspacectl(2): Clarifies the return values
rmacklem@ spotted two things in the system call:
- Upon returning from a successful operation, vop_stddeallocate can
  update rmsr.r_offset to a value greater than file size. This behavior,
  although being harmless, can be confusing.
- The EINVAL return value for rqsr.r_offset + rqsr.r_len > OFF_MAX is
  undocumented.

This commit has the following changes:
- vop_stddeallocate and shm_deallocate to bound the the affected area
  further by the file size.
- The EINVAL case for rqsr.r_offset + rqsr.r_len > OFF_MAX is
  documented.
- The fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9)'s return
  len is explicitly documented the be the value 0, and the return offset
  is restricted to be the smallest of off + len and current file size
  suggested by kib@. This semantic allows callers to interact better
  with potential file size growth after the call.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	imp, kib
Differential Revision:	https://reviews.freebsd.org/D31604
2021-08-24 17:08:28 +08:00
Bjoern A. Zeeb
298ee47e19 localedef: unbreak WITHOUT_LOCALES
After 0fa5403d49 ("pkgbase: move locales into their own package") we
need usr.bin/localedef as a bootstrap tool independent on where
WITHOUT_LOCALE was specified as we ALWAYS process C.UTF-8.

At the same time LOCALES= in the local Makefile is empty but
C.UTF-8 with WITHOUT_LOCALES. C.UTF-8 is excluded from FILES, and thus
after the replacement FILES= is set to only .LC_CTYPE which results in
a build failure not knowing how to build that. Tweak the substitution to
replace only non-empty words so that FILES remains harmlessly empty.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D31589
2021-08-19 12:38:17 -05:00
Kristof Provost
a051ca72e2 Introduce m_get3()
Introduce m_get3() which is similar to m_get2(), but can allocate up to
MJUM16BYTES bytes (m_get2() can only allocate up to MJUMPAGESIZE).

This simplifies the bpf improvement in f13da24715.

Suggested by:	glebius
Differential Revision:	https://reviews.freebsd.org/D31455
2021-08-18 08:48:27 +02:00
Piotr Pawel Stefaniak
f49931c142 style.9: remove an outdated comment about indent(1)
indent(1) has had -ncs and -nbs for some time now.
2021-08-17 19:06:24 +02:00
Alex Richardson
d9f25575a2 Mark LLDB/CLANG_BOOTSTRAP/LLD_BOOTSTRAP as broken on non-FreeBSD for now
I enabled these options again in 31ba4ce889,
but unfortunately only my specific build configuration worked whereas the
build with default options is still broken.
2021-08-17 17:44:52 +01:00
Ed Maste
dff1ba09f7 sysctl.9: put negative sense sysctl note in own paragraph
The sysctl man page cautions against negative-sense boolean sysctls
(foobar_disable), but it gets lost at the end of a large paragraph.
Move it to a separate paragraph in an attempt to make it more clear.

This man page could use a more holistic review and edit pass.  This
change is simple and straightforward and I hope provides a small but
immediate benefit.
2021-08-17 12:10:44 -04:00
Ed Maste
d8aeab4b45 Add gone_in(9) man page
Reviewed by:	imp
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30703
2021-08-16 17:23:59 -04:00
Vladimir Kondratyev
14a4d6d013 bitstring(3): Add bitstring traversal macros.
The macro bit_foreach() traverses all set bits in the bitstring in the
forward direction, assigning each location in turn to variable.

The macro bit_foreach_at() traverses all set bits in the bitstring in
the forward direction at or after the zero-based bit index, assigning
each location in turn to variable.

The bit_foreach_unset() and bit_foreach_unset_at() macros which
traverses unset bits are implemented for completeness.

Reviewed by:	asomers, dougm
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31469
2021-08-16 23:24:05 +03:00
Kyle Evans
239aebee61 domain: give domains a chance to probe for availability
This gives any given domain a chance to indicate that it's not actually
supported on the current system. If dom_probe isn't supplied, we assume
the domain is universally applicable as most of them are. Keeping
fully-initialized and registered domains around that physically can't
work on a large majority of FreeBSD deployments is sub-optimal and leads
to errors that aren't consistent with the reality of why the socket
can't be created (e.g. ESOCKTNOSUPPORT) because such scenario has to be
caught upon pru_attach, at which point kicking back the more-appropriate
EAFNOSUPPORT would seem weird.

The initial consumer of this will be hvsock, which is only available on
HyperV guests.

Reviewed by:	cem (earlier version), bcr (manpages)
Differential Revision:	https://reviews.freebsd.org/D25062
2021-08-16 00:59:56 -05:00
Mark Johnston
7e14be0b07 pci: Add an ioctl to perform I/O to BARs
This is useful for bhyve, which otherwise has to use /dev/io to handle
accesses to I/O port BARs when PCI passthrough is in use.

Reviewed by:	imp, kib
Discussed with:	jhb
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31307
2021-08-14 10:59:03 -04:00
Gordon Bergling
a1581cd735 Fix a common typo in source code comments
- s/aligment/alignment/

MFC after:	5 days
2021-08-14 14:17:48 +02:00
Jessica Clarke
cef65082ae bsd.compiler.mk: Fix cross-building from non-FreeBSD
On non-FreeBSD, the various MACHINE variables for the host when
bootstrapping can be missing or not match FreeBSD's naming, causing
bsd.endian.mk to be unable to infer the endianness. Work around this by
assuming it's unsupported.

Note that we can't check BOOTSTRAPPING here as Makefile.inc1 includes
bsd.compiler.mk before that is set, and so we are unable to catch errors
during buildworld itself when cross-building and bsd.endian.mk failed,
but such errors should also show up when building on FreeBSD.

Fixes:	47363e99d3 ("Enable compressed debug on little-endian targets")
2021-08-12 23:45:09 +01:00
Ka Ho Ng
a638dc4ebc vfs: Add ioflag to VOP_DEALLOCATE(9)
The addition of ioflag allows callers passing
IO_SYNC/IO_DATASYNC/IO_DIRECT down to the file system implementation.
The vop_stddeallocate fallback implementation is updated to pass the
ioflag to the file system implementation. vn_deallocate(9) internally is
also changed to pass ioflag to the VOP_DEALLOCATE call.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kib, markj
Differential Revision:	https://reviews.freebsd.org/D31500
2021-08-12 23:03:49 +08:00
Ka Ho Ng
4a9b832a2a vfs: Rename ioflg to ioflag in vn_deallocate
This includes a style fix around ioflag checking as well.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kib, bcr
Differential Revision:	https://reviews.freebsd.org/D31505
2021-08-11 17:45:47 +08:00
Daniel Engberg
4f3a0cfbde Add myself (diizzy) as ports committer
Section 7.1 in Committer's Guide

Reviewed by:	tcberner
Approved by:	tcberner
Differential Revision:	<https://reviews.freebsd.org/D31479>
2021-08-11 09:58:17 +02:00
Mark Johnston
ce2609947c kmsan: Add a manual page
Sponsored by:	The FreeBSD Foundation
2021-08-10 21:27:53 -04:00
Mark Johnston
805c3af898 build.7: Describe the default value for LOCAL_MODULES
Suggested by:	jhb
MFC after:	1 week
2021-08-10 21:18:34 -04:00
Mark Johnston
e7a13643b1 build.7: Document LOCAL_MODULES and LOCAL_MODULES_DIR
Reviewed by:	0mp, imp
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31461
2021-08-10 11:43:02 -04:00
Piotr Kubaj
8f642f797a share/man/man7/arch.7: bump date 2021-08-10 17:04:51 +02:00
Piotr Kubaj
ecb3f90dd1 share/man/man7/arch.7: powerpc64 support appeared in 9.0-RELEASE
Differential revision:	https://reviews.freebsd.org/D31013
Approved by:	eadler, 0mp
2021-08-10 16:33:29 +02:00
Alan Somers
518e697f2a [skip ci] unix(4): LOCAL_PEERCRED works on SOCK_SEQPACKET, too.
MFC after:	2 weeks
Reviewed By:	dchagin
Differential Revision: https://reviews.freebsd.org/D31456
2021-08-10 07:31:09 -06:00
Konstantin Belousov
4a5a67fe67 ip(4): Mention IP_IPSEC_POLICY ip-level socket option
Text is literally taken from NetBSD ip(4).

Sponsored by:	NVIDIA Networking
MFC after:	3 days
2021-08-10 03:46:49 +03:00
Mark Johnston
e0cc566035 kasan.9: Note the header required for kasan_mark()
Sponsored by:	The FreeBSD Foundation
2021-08-09 13:27:52 -04:00
Ed Maste
47363e99d3 Enable compressed debug on little-endian targets
Compressed debug was enabled by default in commit c910570e75, but
broke the build on big-endian targets, and so was disabled in
89ed2ecb14.

Older versions of LLD fail with big-endian compressed debug sections.
This was fixed in LLD upstream (commit c6ebc651b6fa) and merged to
FreeBSD main (commit d69d07569e) by dim.

External toolchains (e.g. the llvm12 package) will not yet have the fix.
These may be used to link against base system .a archives, so compressed
debug sections would cause trouble even though the base system is fixed.

Enable compressed debug sections again, for little-endian targets only.
As discussed on freebsd-hackers[1] I expect to undo this in the future
(using compressed debug everywhere), once fixed versions of lld are
widely available.

Note that to be pedantically correct we should check both the compiler
and the linker for compressed debug support, but given the external
toolchain constraint the extra complexity does not seem worthwhile.

[1] https://lists.freebsd.org/archives/freebsd-hackers/2021-August/000188.html

PR:		257638
Reported by:	jrtc27 [impact of .a archives]
Discussed with:	imp
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31454

Revert "Disable compressed debug by default"

This reverts commit 89ed2ecb14.
2021-08-08 13:31:28 -04:00
Ed Maste
b0dafb1b6f src.conf.5: Regen after fe52b7f60e, PROFILE default off 2021-08-07 20:51:44 -04:00
Ed Maste
fe52b7f60e Disable PROFILE option by default
Hardware based profiling (e.g. hwpmc) is much better and produces more
useful results.  Today the profiling lib archives (_p.a) serve no real
purpose other than increasing the library build time.

Both upstream and base system (in commit b762974cf4) Clang have been
modified to remove the special case for linking against these libraries.

Clang's -pg support and mcount() remain, so building with -pg can still
be used on code that the user builds; we just no longer provide prebuilt
libraries compiled with -pg.

Discussed on freebsd-hackers[1] / freebsd-current [2] in 2020 and
freebsd-arch [3] in 2021.  A deprecation notice was added in
commit 175841285e.

[1] https://lists.freebsd.org/pipermail/freebsd-hackers/2020-January/055551.html
[2] https://lists.freebsd.org/pipermail/freebsd-current/2020-January/075105.html
[3] https://lists.freebsd.org/archives/freebsd-arch/2021-June/000016.html

PR:		256873 [exp-run]
Reviewed by:	imp, jhb, kib
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30833
2021-08-07 20:24:36 -04:00
Jessica Clarke
5668a155cb gpio.4: Mention new sifive_gpio driver
Suggested by:	mhorne
MFC after:	1 week
2021-08-07 19:31:34 +01:00
Fernando Apesteguía
e6379a2c95 man: Install more man pages unconditionally
Add more manual pages which were not spotted previously in 0a0f748641

Ideally to be MFH'ed with:

8539518055 - Remove manpages from OLD_FILES
8b487b8292 - Fix bsd.subdir.mk-related issues after 0a0f748641
f6043a6721 - ObsoleteFiles.inc: Remove manpages from OLD_FILES
0a0f748641 - man: Build manpages for all architectures

There is at least one pending issue when building with -DNO_ROOT.

Reported by:    ceri@
MFH:    4 weeks
Discussed with: wosch
Differential Revision: https://reviews.freebsd.org/D31018
2021-08-06 18:34:07 +02:00
Greg V
362fef2f4a bsd.cpu.mk: add support for x86-64-v[234] levels as CPUTYPE
These are supported in LLVM 12 and GCC 11:

https://github.com/llvm/llvm-project/commit/012dd42e027e
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=324bec558e95584e8c1997575ae9d75978af59f1

Differential Revision:	https://reviews.freebsd.org/D29150
2021-08-06 09:33:37 -04:00
Emmanuel Vadot
86c71e97d1 pkgbase: locales: Also tag the files dir
Otherwise bsd.dirs.mk will create the directory with the default
package (utilities) and we end up with a bunch of empty dirs managed
by this package while it shouldn't be the case.
2021-08-06 14:37:45 +02:00
Kyle Evans
b3e87f1334 ctypedef: fix installation of C.UTF-8
The appropriate directory and name were assigned to the FILESDIR
grouping, but not the ALWAYS grouping where C.UTF-8 is actually
assigned. Add the appropriate bits for ALWAYSDIR, and remove an
obsolete *PACKAGE= assignment since C.UTF-8 is explicitly not included
in FILES.

Prior to this change, C.UTF-8 was being installed as
/usr/share/C.UTF-8.LC_CTYPE.

Reviewed by:	manu
Fixes:	0fa5403d49 ("pkgbase: move locales into their own package")
Differential Revision:	https://reviews.freebsd.org/D31429
2021-08-05 22:31:40 -05:00
Kyle Evans
645b46d379 pkgbase: fix locale packages
Most places spelled it -locales, but numericdef spelled it as -locale
in just this one place. Pluralize it.

Reviewed by:	emaste, manu
Fixes:	0fa5403d49 ("pkgbase: move locales into their own package")
Differential Revision:	https://reviews.freebsd.org/D31428
2021-08-05 22:31:40 -05:00
Ka Ho Ng
0dc332bff2 Add fspacectl(2), vn_deallocate(9) and VOP_DEALLOCATE(9).
fspacectl(2) is a system call to provide space management support to
userspace applications. VOP_DEALLOCATE(9) is a VOP call to perform the
deallocation. vn_deallocate(9) is a public KPI for kmods' use.

The purpose of proposing a new system call, a KPI and a VOP call is to
allow bhyve or other hypervisor monitors to emulate the behavior of SCSI
UNMAP/NVMe DEALLOCATE on a plain file.

fspacectl(2) comprises of cmd and flags parameters to specify the
space management operation to be performed. Currently cmd has to be
SPACECTL_DEALLOC, and flags has to be 0.

fo_fspacectl is added to fileops.
VOP_DEALLOCATE(9) is added as a new VOP call. A trivial implementation
of VOP_DEALLOCATE(9) is provided.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D28347
2021-08-05 23:20:42 +08:00
Ka Ho Ng
de2e152959 Add vnode_pager_purge_range(9) KPI
This KPI is created in addition to the existing vnode_pager_setsize(9)
KPI. The KPI is intended for file systems that are able to turn a range
of file into sparse range, also known as hole-punching.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D27194
2021-08-05 22:52:26 +08:00
Ed Maste
89ed2ecb14 Disable compressed debug by default
In c910570e75 I enabled compressed debug sections, but it broke mips
and powerpc.  Disable it for now.

Reported by:	jenkins, manu
Sponsored by:	The FreeBSD Foundation
2021-08-05 08:36:00 -04:00
Ed Maste
c910570e75 Use compressed debug in standalone userland debug files by default
The compiler supports CFLAGS=-gz=zlib to compress .debug sections in
object files, libraries, and binaries.  Enable it to reduce disk usage
for standalone debug files (and /usr/obj).

Reviewed by:	dim, kevans
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29002
2021-08-04 16:08:40 -04:00
Ed Maste
62174eaf46 Install ipmi man page also on arm64
Fixes:		40d0971bbe ("arm64: enable build of the ipmi module")
Sponsored by:	The FreeBSD Foundation
2021-08-04 15:04:24 -04:00
Mitchell Horne
1b8db4b4e3 arm: enable stack-smashing protection
With current generation clang/llvm it can pass all of our tests in
libc/ssp.

While here, remove the extra MACHINE_CPUARCH check for mips. SSP is
included in BROKEN_OPTIONS for this architecture in src.opts.mk, which
is enough to ensure normal builds won't set SSP_CFLAGS.

Reviewed by:	kevans, imp, emaste
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D31400
2021-08-04 15:23:22 -03:00
Goran Mekić
21d8546588 sound: Add an example of basic sound application
This is an example demonstrating the usage of the OSS-compatible APIs
provided by the sound(4) subsystem. It reads frames from a dsp node and
writes them to the same dsp node.

MFC after:	2 weeks
Reviewed by:	hselasky, bcr
Differential revision:	https://reviews.freebsd.org/D30149
2021-08-04 18:11:54 +08:00
Baptiste Daroussin
0fa5403d49 pkgbase: move locales into their own package
The only exception here being C.UTF-8 as this is the default
locales so it needs to always be installed

Reviewed by:	pkgbase (emaste)
Differential Revision:	https://reviews.freebsd.org/D31397
2021-08-03 18:35:26 +02:00
Baptiste Daroussin
30e1773fde locales: fix abuse of bsd.dirs.mk
the way SAMEDIRS was defined was an abuse of bsd.dirs.mk resulting in
all the directory to be created in one single command, but DESTDIR is
only prepend once on the first element of the list

Switch to the properway to use bsd.dirs.mk
2021-08-03 18:02:15 +02:00
Baptiste Daroussin
8232bb3859 locales: fix typo preventing installation of collation for ru_RU.CP866 2021-08-03 14:37:26 +02:00
Baptiste Daroussin
184d64af13 locales: stop hardcoding the directories in the mtree
The framework knows how to create directories and tag them properly
for a the creation of a mtree, not need to hardcode all the locales
entries in bsd.usr.mk

This simplifies addition of new locales but also allow people building
with WITHOUT_LOCALES to end up with a directory full of empty files
2021-08-03 14:25:00 +02:00
Baptiste Daroussin
d3fd2cbbb7 nl_NL.ISO8859-1: reinstall the missing LC_MESSAGES 2021-08-03 12:13:52 +02:00
Marcin Wojtas
451bcf1b36 Introduce driver for Freescale Felix switch
It is found on boards equipped with LS1028A SoC.
802.1q VLAN grouping is supported.
An external MDIO device is used for communicating with PHYs.
The driver is built as a module by default, it is not included
in GENERIC kernel config.

Submitted by: Lukasz Hajec <lha@semihalf.com>
              Kornel Duleba <mindal@semihalf.com>
Obtained from: Semihalf
Sponsored by: Alstom Group
Differential Revision: https://reviews.freebsd.org/D30923
2021-08-03 12:07:49 +02:00
Alex Richardson
428a32edba Use .sinclude for bsd.sanitizer.mk
We don't install this file since MK_ASAN/MK_UBSAN is only supported for
src builds. However, some ports also use bsd.lib.mk/bsd.prog.mk so we
should not fail the build if it can't be included.

Reported by:	jkim
Fixes:		7bc797e3f3 ("Add build system support for ASAN+UBSAN instrumentation")
2021-08-03 10:38:20 +01:00
Adam Fenn
6162cf885c malloc(9): Document/complete aligned variants
Comments on a pending kvmclock driver suggested adding a
malloc_aligned() to complement malloc_domainset_aligned(); add it now,
and document both.

Reviewed by:	imp, kib, allanjude (manpages)
Differential Revision:	https://reviews.freebsd.org/D31004
2021-08-02 15:36:14 -05:00
Alex Richardson
17d6371e4c Fix GCC and -DWITH_CLEAN build after 7bc797e3f3
Reported by:	kib
2021-08-02 16:03:05 +01:00
Alex Richardson
31ba4ce889 Allow bootstrapping llvm-tblgen on macOS and Linux
This is needed in order to build various LLVM binutils (e.g. addr2line)
as well as clang/lld/lldb.

Co-authored-by: Jessica Clarke <jrtc27@FreeBSD.org>
Test Plan:	Compiles on ubuntu 18.04 and macOS 11.4
Reviewed By:	dim
Differential Revision: https://reviews.freebsd.org/D31057
2021-08-02 14:36:03 +01:00
Alex Richardson
2de949cf85 Remove mkcsmapper_static and mkesdb_static from build-tools
Build them as part of the bootstrap-tools phase instead.

Reviewed by:	emaste (no objections)
Differential Revision: https://reviews.freebsd.org/D28181
2021-08-02 14:33:25 +01:00