dragonfly.git
3 years agokernel - Remove MAP_VPAGETABLE
Matthew Dillon [Thu, 7 Jan 2021 19:54:11 +0000 (11:54 -0800)]
kernel - Remove MAP_VPAGETABLE

* This will break vkernel support for now, but after a lot of mulling
  there's just no other way forward.  MAP_VPAGETABLE was basically a
  software page-table feature for mmap()s that allowed the vkernel
  to implement page tables without needing hardware virtualization support.

* The basic problem is that the VM system is moving to an extent-based
  mechanism for tracking VM pages entered into PMAPs and is no longer
  indexing individual terminal PTEs with pv_entry's.

  This means that the VM system is no longer able to get an exact list of
  PTEs in PMAPs that a particular vm_page is using.  It just has a
  flag 'this page is in at least one pmap' or 'this page is not in any
  pmaps'.  To track down the PTEs, the VM system must run through the
  extents via the vm_map_backing structures hanging off the related
  VM object.

  This mechanism does not work with MAP_VPAGETABLE.  Short of scanning
  the entire real pmap, the kernel has no way to reverse-index a page
  that might be indirected through MAP_VPAGETABLE.

* We will need actual hardware mmu virtualization to get the vkernel
  working again.

3 years agoSync ACPICA with Intel's version 20210105.
Sascha Wildner [Tue, 5 Jan 2021 20:57:48 +0000 (21:57 +0100)]
Sync ACPICA with Intel's version 20210105.

iasl: Remove support for obsolete tables

Also, update copyrights.

For detailed list, please see sys/contrib/dev/acpica/changes.txt.

3 years agotimeout.1: Use .Fx
Sascha Wildner [Mon, 4 Jan 2021 22:39:59 +0000 (23:39 +0100)]
timeout.1: Use .Fx

3 years agosockaddr_snprintf.3: Use .Er for errno values.
Sascha Wildner [Mon, 4 Jan 2021 05:13:38 +0000 (06:13 +0100)]
sockaddr_snprintf.3: Use .Er for errno values.

3 years agotimeout(1): Add -v/--verbose option to show diagnosis info
Aaron LI [Sun, 3 Jan 2021 07:03:03 +0000 (15:03 +0800)]
timeout(1): Add -v/--verbose option to show diagnosis info

The -v/--verbose option enables this utility to show diagnosis info to
stderr about any signal sent on timeout.

This implementation refers to GNU coreutils's timeout(1).

3 years agotimeout(1): Reduce some duplicate code
Aaron LI [Sun, 3 Jan 2021 05:52:10 +0000 (13:52 +0800)]
timeout(1): Reduce some duplicate code

Merge the 'sig_alrm' and 'sig_term' conditionals, and thus reduce some
duplicate code.

3 years agotimeout(1): Some minor tweaks and improvements
Aaron LI [Sun, 3 Jan 2021 04:26:39 +0000 (12:26 +0800)]
timeout(1): Some minor tweaks and improvements

* Define exit status and macros and use them
* Improve the second kill logic by setting 'do_second_kill = false'
  after configuring the second kill
* Minor style tweaks
* Reorder options in the man page, as well as the usage help
* Reorder the exit status in the man page
* Enhance the HISTORY section in the man page (obtained from NetBSD)

3 years agotimeout(1): Port to DragonFly
Aaron LI [Sun, 3 Jan 2021 04:11:56 +0000 (12:11 +0800)]
timeout(1): Port to DragonFly

Our procctl(2) is different from FreeBSD's procctl(2), so need to adjust
its usage.

Also hook into our build system and update the man page.

3 years agoImport timeout(1) from FreeBSD
Aaron LI [Sun, 3 Jan 2021 02:46:46 +0000 (10:46 +0800)]
Import timeout(1) from FreeBSD

The timeout(1) utility runs a command with a time limit.  It has also
been imported into NetBSD.  This utility first appeared in GNU
coreutils.

This is a verbatim copy of FreeBSD's version.  Necessary modifications
and updates will follow.

3 years agoFix some -Wjump_misses_init warnings (found by clang).
Sascha Wildner [Sat, 2 Jan 2021 21:26:51 +0000 (22:26 +0100)]
Fix some -Wjump_misses_init warnings (found by clang).

3 years agonetstat(1): Clean up struct nlist array.
Sascha Wildner [Sat, 2 Jan 2021 20:50:01 +0000 (21:50 +0100)]
netstat(1): Clean up struct nlist array.

3 years agogetaddrinfo(1): Actually hook into the build and remove unneeded headers.
Sascha Wildner [Sat, 2 Jan 2021 17:22:26 +0000 (18:22 +0100)]
getaddrinfo(1): Actually hook into the build and remove unneeded headers.

The <sys/cdefs.h> should be removed along with the __FBSDID and we
include either <sys/types.h> or <sys/param.h> but not both.

3 years agoImport getaddrinfo(1) from FreeBSD
Aaron LI [Sat, 2 Jan 2021 11:21:30 +0000 (19:21 +0800)]
Import getaddrinfo(1) from FreeBSD

The getaddrinfo(1) utility resolves host and service names to socket
addresses with getaddrinfo(3) and prints them in a user-friendly format.

Obtained from FreeBSD, which obtained it from NetBSD.

The examples in the man page has been adjusted to use
'www.dragonflybsd.org' instead of NetBSD ones :D

Thank swildner for bringing in sockaddr_snprintf(3) to libutil from
NetBSD, which is required by this utility.

3 years agolibutil: Add sockaddr_snprintf() (taken from NetBSD).
Sascha Wildner [Sat, 2 Jan 2021 07:27:05 +0000 (08:27 +0100)]
libutil: Add sockaddr_snprintf() (taken from NetBSD).

The man page has been adjusted a bit since we don't support Apple Talk
protocol.

3 years agosetbuf.3: Mention stdbuf(1) and update HISTORY & BUGS sections
Aaron LI [Sat, 2 Jan 2021 02:56:31 +0000 (10:56 +0800)]
setbuf.3: Mention stdbuf(1) and update HISTORY & BUGS sections

Obtained-from: FreeBSD
Reported-by: swildner
3 years agoImport stdbuf(1) together with libstdbuf(3) from FreeBSD
Aaron LI [Fri, 1 Jan 2021 14:08:34 +0000 (22:08 +0800)]
Import stdbuf(1) together with libstdbuf(3) from FreeBSD

The stdbuf(1) is a utility to change the initial buffering of stdin,
stdout and stderr streams for a given command.  It achieves this
functionality by preloading the libstdbuf(3) library and configuring the
needed environment variables.  Under the hood, libstdbuf(3) library
calls setvbuf(3) to do the actual work.

Changes from FreeBSD:
* Removed 32bit i386 code from stdbuf(1)
* Fix typos and update HISTORY section in libstdbuf.3 man page
* Update the example to actually work on DragonFly

3 years agomandoc.db.5: Adjust a bit to DragonFly.
Sascha Wildner [Fri, 1 Jan 2021 14:48:50 +0000 (15:48 +0100)]
mandoc.db.5: Adjust a bit to DragonFly.

3 years agonewvers.sh: Simplify a bit more.
Sascha Wildner [Fri, 1 Jan 2021 13:28:16 +0000 (14:28 +0100)]
newvers.sh: Simplify a bit more.

3 years agoRemove /usr/share/examples/etc/bsd-style-copyright.
Sascha Wildner [Fri, 1 Jan 2021 13:09:28 +0000 (14:09 +0100)]
Remove /usr/share/examples/etc/bsd-style-copyright.

/usr/share/examples/etc is supposed to hold the contents of an
unchanged /etc directory only. Also, our template is in
/COPYRIGHT so there is no point to keep a different one. Examples
of n-clause BSD licenses are widely available online, when needed.

Clean up newvers.sh, which was using the file for vers.c generation.
There is no need to put a license on generated files, let alone such
simple ones.

3 years ago<unistd.h>: chroot_kernel() is DragonFly specific only.
Sascha Wildner [Fri, 1 Jan 2021 11:01:21 +0000 (12:01 +0100)]
<unistd.h>: chroot_kernel() is DragonFly specific only.

Its prototype was put into the wrong #if/#endif section in 72f12c5b169.

3 years agolibc/gen/devname.c: No need to include <paths.h>
Aaron LI [Fri, 1 Jan 2021 07:31:53 +0000 (15:31 +0800)]
libc/gen/devname.c: No need to include <paths.h>

3 years agoRemove obsolete dev_mkdb(8)
Aaron LI [Fri, 1 Jan 2021 07:14:03 +0000 (15:14 +0800)]
Remove obsolete dev_mkdb(8)

The devname(3) has long been updated to determine the device name via
the 'kern.devname' sysctl provided by devfs(5).  The dev.db created by
dev_mkdb(8) is thus unused and obsolete.  So remove dev_mkdb(8) as well
and update relevant parts.

3 years agodevname.3: Add a little example
Aaron LI [Fri, 1 Jan 2021 07:04:37 +0000 (15:04 +0800)]
devname.3: Add a little example

Obtained from FreeBSD but with some updates.

3 years agodevname(3): Remove obsolete code that queries dev.db
Aaron LI [Fri, 1 Jan 2021 06:28:58 +0000 (14:28 +0800)]
devname(3): Remove obsolete code that queries dev.db

In the old days of static /dev, devname(3) would get the name by
querying the /var/run/dev.db created by dev_mkdb(8).  Now that we have
dynamic /dev provided by devfs(5), the device name is provided by the
'kern.devname' sysctl, thus obsoleting the db query code.

I've tested to verify that the db query code isn't being used now.  So
it's safe to remove this obsolete code.  Cleanups to dev_mkdb(8) and
related code would follow.

Meanwhile, update the man page to reflect the current code.

Discussed-with: swildner

3 years agoBump copyrights. Good riddance 2020
Sascha Wildner [Thu, 31 Dec 2020 21:07:29 +0000 (22:07 +0100)]
Bump copyrights. Good riddance 2020

3 years agoRemove <sys/types.h> from <ftw.h>.
Sascha Wildner [Thu, 31 Dec 2020 18:12:46 +0000 (19:12 +0100)]
Remove <sys/types.h> from <ftw.h>.

3 years agoClean up the POSIX namespace of <iconv.h>, <dirent.h>, and <sys/stat.h>.
Sascha Wildner [Thu, 31 Dec 2020 17:50:35 +0000 (18:50 +0100)]
Clean up the POSIX namespace of <iconv.h>, <dirent.h>, and <sys/stat.h>.

Some small residue in <sys/stat.h> remains for older specs, due to the
kind of bumpy history of that header between issues 6 and 7. Namely,
struct timespec should not be defined in these cases. But this is good
enough for now.

Thanks to zrj for testing with a full dports bulk.

3 years agoKeep /etc/regdomain.xml in sync with our tree.
Sascha Wildner [Thu, 31 Dec 2020 17:32:44 +0000 (18:32 +0100)]
Keep /etc/regdomain.xml in sync with our tree.

It's not a file that might have system specific changes.

3 years agonetproto/802_11: Sync some channel definitions from FreeBSD
Aaron LI [Thu, 31 Dec 2020 06:56:25 +0000 (14:56 +0800)]
netproto/802_11: Sync some channel definitions from FreeBSD

Some of these channel definitions are required by the last commit as
they're being used in 'regdomain.c'.

Also update 'wlan/ieee80211.c' a bit so that it builds fine.

3 years agoifconfig(8): Update regdomain.[ch] to support new regdomain.xml
Aaron LI [Thu, 31 Dec 2020 05:40:11 +0000 (13:40 +0800)]
ifconfig(8): Update regdomain.[ch] to support new regdomain.xml

The '/etc/regdomain.xml' has been updated in
dbe4ac417a2b77e29fd0326277263c3bbccf7ebe.  However, ifconfig(8) has not
been updated to support the new netbands (e.g., 11ac) and thus
ifconfig(8) emits some warnings like:

```
ifconfig: unknown netband mode "11ac" at line 114
ifconfig: ignore "band" of unknown netband at line 115
ifconfig: ignore "freqband" of unknown netband at line 116
ifconfig: ignore "maxpower" of unknown netband at line 117
ifconfig: unexpected XML token "maxpower" data "17" at line 117
ifconfig: ignore "flags" of unknown netband at line 118
ifconfig: flags without freqband or netband at line 118 ignored
```

Update 'regdomain.[ch]' from FreeBSD to support the new regdomain.xml,
together with minor fixes.

Obtained-from: FreeBSD

3 years agoifconfig(8): Fix regdomain.xml parsing issue
Aaron LI [Thu, 31 Dec 2020 15:13:50 +0000 (23:13 +0800)]
ifconfig(8): Fix regdomain.xml parsing issue

The original regdomain.[ch] code can't handle unknown netbands in
regdomain.xml, mainly because it didn't distinguish the following two
cases:

* <netband><band><freqband ref="xxx">...
* <freqband id="xxx">...

Therefore, it tried to strdup(id) but with 'id = NULL' and thus caused
segfault errors with the new regdomain.xml, like:

```
ifconfig: unknown mode "11ac" at line 114
ifconfig: band without enclosing netband at line 115
[1]    326065 segmentation fault (core dumped)  ifconfig
```

This commit fixes the above segfault error by ignoring unknown netbands.
Although ifconfig(8) emits some warnings about unknown/unexpected
elements, it works as expected :D

Reported-by: Gonzalo Nemmi (noob237 on IRC)
3 years agoAdd <endian.h>, which for now only includes <sys/endian.h>.
Sascha Wildner [Wed, 30 Dec 2020 17:47:46 +0000 (18:47 +0100)]
Add <endian.h>, which for now only includes <sys/endian.h>.

An <endian.h> header was recently approved by The Austin Group:
https://www.austingroupbugs.net/view.php?id=162

Add one now, mainly for dports. It will be further POSIXized later.

3 years agoetc/Makefile: Install 'group' and 'master.passwd' to examples/etc
Aaron LI [Wed, 30 Dec 2020 14:33:50 +0000 (22:33 +0800)]
etc/Makefile: Install 'group' and 'passwd' to examples/etc

Add back installation of 'group' to '/usr/share/examples/etc'.  In
addition, also install 'master.passwd' there.

The point is that '/usr/share/examples/etc' should have all config files
that the initial '/etc' have.

Suggested-by: swildner
3 years agoSync zoneinfo database with tzdata2020f from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Wed, 30 Dec 2020 12:07:02 +0000 (13:07 +0100)]
Sync zoneinfo database with tzdata2020f from ftp://ftp.iana.org/tz/releases

Nothing to see, just a fix in the upstream build infrastructure.

For a detailed list of changes, see share/zoneinfo/NEWS.

3 years agolibc/gen/gen_private.h: Include <sys/types.h> for off_t.
Sascha Wildner [Wed, 30 Dec 2020 10:55:23 +0000 (11:55 +0100)]
libc/gen/gen_private.h: Include <sys/types.h> for off_t.

Do not rely on the including file to bring it in.

3 years agokernel: Staticize a few variables.
Sascha Wildner [Wed, 30 Dec 2020 09:06:19 +0000 (10:06 +0100)]
kernel: Staticize a few variables.

3 years agolibc/fmtcheck: Sync with FreeBSD (only comments).
Sascha Wildner [Tue, 29 Dec 2020 19:40:57 +0000 (20:40 +0100)]
libc/fmtcheck: Sync with FreeBSD (only comments).

3 years ago<machine/smp.h>: Remove some prototypes of non-existent functions.
Sascha Wildner [Tue, 29 Dec 2020 18:58:44 +0000 (19:58 +0100)]
<machine/smp.h>: Remove some prototypes of non-existent functions.

Reported-by: zrj
3 years agoetc/Makefile: Improve update of _dhcp user and dhcpcd files
Aaron LI [Tue, 29 Dec 2020 14:06:59 +0000 (22:06 +0800)]
etc/Makefile: Improve update of _dhcp user and dhcpcd files

* Update the 'master.passwd' file to set the new home for the '_dhcp'
  user, and then the 'pw-update.sh' script will update it to system.
* Simplify the dhcpcd files move logic a bit.

3 years agotools/pw-update.sh: No need to invoke pwd_mkdb(8)
Aaron LI [Tue, 29 Dec 2020 13:51:13 +0000 (21:51 +0800)]
tools/pw-update.sh: No need to invoke pwd_mkdb(8)

The pw(8) utility already handles the database update, so no need to
manually invoke the pwd_mkdb(8).

3 years agotools/pw-update.sh: Improve to update user/group
Aaron LI [Tue, 29 Dec 2020 13:48:53 +0000 (21:48 +0800)]
tools/pw-update.sh: Improve to update user/group

Before this change, this script would only add new users and/or groups,
but wouldn't modify existing users/groups.  This change add this
ability.

3 years agoRemove last remains of FSMID support from userland.
Sascha Wildner [Mon, 28 Dec 2020 22:28:43 +0000 (23:28 +0100)]
Remove last remains of FSMID support from userland.

The kernel side was added in 2005 (7d15906a7a159575b1983f7c1fadde4b)
and removed again in 2009 (d98152a8b8a4b368ca0e08b84302f2f2).

Approved-by: dillon
3 years agodhcpcd: update README.DRAGONFLY
Roy Marples [Mon, 28 Dec 2020 14:10:28 +0000 (14:10 +0000)]
dhcpcd: update README.DRAGONFLY

3 years agoMerge branch 'vendor/DHCPCD'
Roy Marples [Mon, 28 Dec 2020 14:08:41 +0000 (14:08 +0000)]
Merge branch 'vendor/DHCPCD'

3 years agoUpdate to dhcpcd-9.4.0 with the following changes:
Roy Marples [Mon, 28 Dec 2020 14:06:21 +0000 (14:06 +0000)]
Update to dhcpcd-9.4.0 with the following changes:

 * DHCP: For anonymous, just use a generic ClientID
 * link: Split hardware address randomisation out of anonymous option
 * link: Only report hardware changes for active interfaces
 * link: Report errors obtaining recv buffer size on overflow
 * hooks: Add NOCARRIER_ROAMING reason
 * hooks: interface_order now reflects priorities again

3 years agoSync zoneinfo database with tzdata2020e from ftp://ftp.iana.org/tz/releases
Sascha Wildner [Mon, 28 Dec 2020 00:28:17 +0000 (01:28 +0100)]
Sync zoneinfo database with tzdata2020e from ftp://ftp.iana.org/tz/releases

* Volgograd switched to Moscow time on 2020-12-27 at 02:00.

* Correct many pre-1986 transitions.

For a detailed list of changes, see share/zoneinfo/NEWS.

3 years agoopenresolv: update README.DRAGONFLY
Roy Marples [Sun, 27 Dec 2020 18:49:30 +0000 (18:49 +0000)]
openresolv: update README.DRAGONFLY

3 years agoopenresolv: build avahi-daemon and mdnsd subscribers
Roy Marples [Sun, 27 Dec 2020 18:47:52 +0000 (18:47 +0000)]
openresolv: build avahi-daemon and mdnsd subscribers

3 years agoMerge branch 'vendor/OPENRESOLV'
Roy Marples [Sun, 27 Dec 2020 18:45:53 +0000 (18:45 +0000)]
Merge branch 'vendor/OPENRESOLV'

3 years agoopenresolv: Update to version 3.12.0 with the following changes:
Roy Marples [Sun, 27 Dec 2020 18:43:42 +0000 (18:43 +0000)]
openresolv: Update to version 3.12.0 with the following changes:

 * Default support for WireGuard interfaces
 * Add allow_interfaces and deny_interfaces configuration knobs

 * notify avahi-daemon of resolv.conf being changed
 * notify mdsnd of resolv.conf being changed

 * Allow configurations to be marked as Deprecated and Acivtated
 * Harden resolvconf lock detection

3 years agodevname.3: Update man page to align wht the code
Aaron LI [Sun, 27 Dec 2020 12:46:48 +0000 (20:46 +0800)]
devname.3: Update man page to align wht the code

3 years agoAdd nsmb.conf.5 man page
Aaron LI [Sun, 27 Dec 2020 10:07:51 +0000 (18:07 +0800)]
Add nsmb.conf.5 man page

Obtained-from: FreeBSD

3 years agoetc/Makefile: Minor style tweaks
Aaron LI [Sun, 27 Dec 2020 10:02:02 +0000 (18:02 +0800)]
etc/Makefile: Minor style tweaks

3 years agoetc/Makefile: No need to try to install 'group' file
Aaron LI [Sun, 27 Dec 2020 09:59:23 +0000 (17:59 +0800)]
etc/Makefile: No need to try to install 'group' file

Similar to the 'master.passwd', no need to try to install the 'group'
file, because its update has already been handled by the 'pw-update.sh'
script.

3 years agoetc/Makefile: Use 'pw-update.sh' to add users and groups
Aaron LI [Sun, 27 Dec 2020 09:35:13 +0000 (17:35 +0800)]
etc/Makefile: Use 'pw-update.sh' to add users and groups

After this change, if we want to add a new user/group, just add it to
the 'master.passwd' and/or 'group' files.  No need to add ad-hoc pw(8)
commands in this Makefile.

3 years agotools: Add pw-update.sh to add new users and groups
Aaron LI [Sun, 27 Dec 2020 09:21:01 +0000 (17:21 +0800)]
tools: Add pw-update.sh to add new users and groups

This script is derived my 'dfly-update' tool [1], and will be used in
'make upgrade' to help add new users and groups.

[1] https://github.com/liweitianux/dfly-update

3 years agotools: Update commit-msg script a bit
Aaron LI [Sun, 27 Dec 2020 03:40:11 +0000 (11:40 +0800)]
tools: Update commit-msg script a bit

3 years agokernel - Fix callout structural corruption bug
Matthew Dillon [Sat, 26 Dec 2020 19:25:21 +0000 (11:25 -0800)]
kernel - Fix callout structural corruption bug

* _callout_cancel_quick() was not properly testing whether
  the callout being canceled matched sc->next, resulting
  it occassional kernel panics under certain circumstances.

* Could be triggered during dsynth runs.

* Fixed by adding the proper test.

Reported-by: zrj
3 years agosys/vfs/hammer2: Add initial multi-volumes support for HAMMER2
Tomohiro Kusumi [Fri, 25 Dec 2020 16:36:00 +0000 (01:36 +0900)]
sys/vfs/hammer2: Add initial multi-volumes support for HAMMER2

This commit adds initial multi-volumes support for HAMMER2. Maximum
supported volumes is 64. The feature and implementation is similar to
multi-volumes support in HAMMER1.

1. ondisk changes
=================
This commit bumps volume header version from 1 to 2, and adds four new
volume header fields using reserved fields in version 1. Other ondisk
structures are unchanged.
* "volu_id" - volume id from 0 to 63, where 0 represents root volume.
* "nvolumes" - number of volumes. All volumes have same the same value.
* "total_size" - sum of "volu_size" in volumes. All volumes have the
  same value.
* "volu_loff[HAMMER2_MAX_VOLUMES]" - A 512 bytes table which contains
  start offset of max 64 volumes within "total_size". All volumes have
  the same value.

Version 1 volume header has 0 for above fields, so HAMMER2 internally
treats "nvolumes" as 1, and "total_size" as "volu_size" to be able to
handle version 1 and 2 transparently.

All volumes have 4 headers, but only root volume ones are relevant.
Non-root volume headers have their own unique "volu_id" and "volu_size",
but other fields are unimportant and never used. Non-root volume headers
have sroot blockset[i] whose type is HAMMER2_BREF_TYPE_INVALID. Non-root
volume headers don't have boot/aux area, so freemap area start from
offset 0. Non-root volume headers are readonly and never updated after
creation. This means non-root volumes are just extra storage to extend
fs size and internally make up a single virtual volume whose size is
"total_size".

It currently doesn't automatically upgrade an existing version 1 fs to
version 2. Only newly created fs becomes version 2 for now.

2. volumes layout
=================
Basically similar to HAMMER1. A first block device argument provided for
newfs_hammer2(8) becomes the root volume, and if specified remaining
devices extend "total_size" as non-root volumes. All volumes except for
the last one have 1GiB (freemap level1) aligned "volu_size".

This means each volume's start offset within "total_size" is also 1GiB
(freemap level1) aligned. The start offsets of volumes are stored in
volu_loff[HAMMER2_MAX_VOLUMES]. Each volu_loff[n] (0 <= n < nvolumes)
represents start offset of volume n within "total_size". Unused volumes
have -1 for volu_loff[n].
e.g. If a fs consists of 1 volume, volu_loff[0] has 0 and rests have -1.
e.g. If a fs consists of 3 volumes, x GiB root volume, y GiB volume,
  and z GiB volume, volu_loff[0] has 0, volu_loff[1] has x, volu_loff[2]
  has x+y, and rests have -1.

Low level I/O function in HAMMER2 uses this linear offsets table to
determine a device vnode to use and relative offset within the device
vnode, for a given blockref's "data_off". This is different from HAMMER1
where logical offset had embedded volume id bits (i.e. there were holes
in logical address space). HAMMER2 needs this table to support multi-
volumes without changing current logical offset mechanism.

Unless all volumes are specified and mountable, mount_hammer2(8) fails
like it failed in HAMMER1. This also applies to other userspace commands
which require volumes specification, except for fstyp(8).

3. userspace commands
=====================
Basically same as or similar to HAMMER1.
* newfs_hammer2(8) takes a list of block device paths as argv[].
* mount_hammer2(8) takes block device paths or names in "a:b:c:..."
  format.
* hammer2(8) takes block device paths or names in "a:b:c:..." format for
  directives which require volumes specification. This commit also adds
  "volume-list" directive and an ioctl command HAMMER2IOC_VOLUME_LIST,
  which are similar to the one in HAMMER1.
* fsck_hammer2(8) takes device paths or names in "a:b:c:..." format.
* fstyp(8) takes device paths in "path1:path2:path3:..." format.

4. limitations
==============
* hammer2(8) "info" directive ignores multi-volumes block devices.
* hammer2(8) "growfs" directive doesn't support multi-volumes fs.
* fstyp(8) is unable to find PFS label via -l option if the PFS inode or
  its parent indirect blocks are located beyond root volume.
* hammer2(8) doesn't support "volume-add" and "volume-del" directives
  which existed in HAMMER1, and there is currently no plan to support.

3 years agonet/ip_mroute: Fix 'struct igmpmsg' for x86_64
Uglymotha [Thu, 24 Dec 2020 16:28:58 +0000 (17:28 +0100)]
net/ip_mroute: Fix 'struct igmpmsg' for x86_64

The `struct igmpmsg` currently uses `u_long` to define the unused fields
instead of `uint32_t`.  This breaks the mroute API on 64 bit systems,
because `u_long` is 64bit there.  The following code in `ip_mroute.c`
happily corrupts kernel upcall messages on 64bit systems as the fields
are incorrectly shifted 8bytes to the right, overwriting the destination
ip address in the packet.

```
/*
 * Send message to routing daemon to install
 * a route into the kernel table
 */
im = mtod(mm, struct igmpmsg *);
im->im_msgtype = IGMPMSG_NOCACHE;
im->im_mbz = 0;
im->im_vif = vifi;
```

Fix this issue by replacing `u_long` with `uint32_t` in `struct igmpmsg`.
This change has also been made in FreeBSD at:
https://github.com/freebsd/freebsd/commit/3dd767ffd091fb1e586741a1aedfcd67884312a4

This fix is submitted by Uglymotha at GitHub:
https://github.com/DragonFlyBSD/DragonFlyBSD/pull/11

3 years ago<netinet6/in6.h>: Revert one change that didn't improve anything.
Sascha Wildner [Fri, 25 Dec 2020 10:03:11 +0000 (11:03 +0100)]
<netinet6/in6.h>: Revert one change that didn't improve anything.

Definitions with a leading underscore are not relevant for POSIX
and the code is more readable this way.

3 years ago<netinet/in.h>: Clean up the POSIX namespace.
Sascha Wildner [Fri, 25 Dec 2020 09:18:41 +0000 (10:18 +0100)]
<netinet/in.h>: Clean up the POSIX namespace.

Thanks to zrj for testing it with a full dports bulk build.

3 years ago<netinet/in6.h>/<sys/mount.h>: Use __BSD_VISIBLE where intended.
Sascha Wildner [Mon, 21 Dec 2020 06:51:08 +0000 (07:51 +0100)]
<netinet/in6.h>/<sys/mount.h>: Use __BSD_VISIBLE where intended.

Only <sys/cdefs.h> should check the _POSIX_C_SOURCE and _XOPEN_SOURCE
definitions. The rest should always use *_VISIBLE.

3 years ago<netinet/in.h>: Fix comment indent.
Sascha Wildner [Sun, 20 Dec 2020 18:59:03 +0000 (19:59 +0100)]
<netinet/in.h>: Fix comment indent.

3 years agosbin/newfs_hammer2: Minor cleanup
Tomohiro Kusumi [Sun, 20 Dec 2020 12:59:40 +0000 (21:59 +0900)]
sbin/newfs_hammer2: Minor cleanup

to make multi-volumes diff (which uses *vol for other purpose) clearer.
In HAMMER2 the volume header variable is basically always *voldata.

3 years agosbin/fsck_hammer2: Don't print "exceeds volume size" in find_best_zone()
Tomohiro Kusumi [Sun, 20 Dec 2020 07:03:52 +0000 (16:03 +0900)]
sbin/fsck_hammer2: Don't print "exceeds volume size" in find_best_zone()

No need to print while seeking for a best zone.

3 years agodrm/i915: Enable I915_PARAM_MMAP_VERSION
François Tigeot [Sat, 19 Dec 2020 09:48:01 +0000 (10:48 +0100)]
drm/i915: Enable I915_PARAM_MMAP_VERSION

3 years agodrm/i915: Update PCI IDs from Linux 5.8
François Tigeot [Sat, 19 Dec 2020 09:47:32 +0000 (10:47 +0100)]
drm/i915: Update PCI IDs from Linux 5.8

This brings in support for new Coffee Lake, Amber Lake, Whiskey Lake
and Comet Lake GPUs.

3 years agodrm: Update to Linux 4.15.18
François Tigeot [Sat, 19 Dec 2020 09:42:40 +0000 (10:42 +0100)]
drm: Update to Linux 4.15.18

* Create /dev/dri/renderD* devices
  Generally handle /dev entries creation as close to Linux as possible.

* Add drm master support
  Sync authentification code with Linux 4.15.18

* handle vm_mm->mmap_sem in ttm page fault operations

* Update dma-fence code from OpenBSD

* This commit contains sleep/wakeup and other changes
  from Matthew Dillon <dillon@apollo.backplane.com>

3 years agoSync ACPICA with Intel's version 20201217.
Sascha Wildner [Fri, 18 Dec 2020 23:43:19 +0000 (00:43 +0100)]
Sync ACPICA with Intel's version 20201217.

* Fix exception code class checks.

* Better GCC 10 support.

* Some -Wimplicit-fallthrough fixes.

* Miscellaneous improvements in the tools.

For detailed list, please see sys/contrib/dev/acpica/changes.txt.

3 years agocpdup - Add support for lchmod(), lutimes(), and lchflags() (2)
Matthew Dillon [Fri, 18 Dec 2020 19:12:43 +0000 (11:12 -0800)]
cpdup - Add support for lchmod(), lutimes(), and lchflags() (2)

* Fix bug in xlink, lchflags() was being called with the wrong
  path after a link failure and so could not unlock schg files
  to link to them.

3 years agosys/vfs/hammer: modify directory ctime when adding entry
Daniel Fojt [Thu, 17 Dec 2020 17:15:26 +0000 (18:15 +0100)]
sys/vfs/hammer: modify directory ctime when adding entry

In addition to mtime, update also ctime of a directory when adding
new entry there.

Related to issue: https://bugs.dragonflybsd.org/issues/3251
Reviewed by: Matthew Dillon

3 years agosys/vfs/hammer2: modify inode's ctime after link()ing it
Daniel Fojt [Thu, 17 Dec 2020 17:10:39 +0000 (18:10 +0100)]
sys/vfs/hammer2: modify inode's ctime after link()ing it

After successfully hardlinking inode, update also its ctime.
In addition to mtime, update also ctime of destination directory.

Issue: https://bugs.dragonflybsd.org/issues/3251
Reviewed by: Matthew Dillon

3 years agousr.sbin/fstyp: Minor HAMMER1 fixes
Tomohiro Kusumi [Wed, 16 Dec 2020 17:33:48 +0000 (02:33 +0900)]
usr.sbin/fstyp: Minor HAMMER1 fixes

3 years agousr.sbin/fstyp: Minor HAMMER2 fixes
Tomohiro Kusumi [Wed, 16 Dec 2020 17:10:32 +0000 (02:10 +0900)]
usr.sbin/fstyp: Minor HAMMER2 fixes

3 years agobuild - Fix building new sources on older systems
Matthew Dillon [Wed, 16 Dec 2020 00:50:41 +0000 (16:50 -0800)]
build - Fix building new sources on older systems

* Fix compile errors when doing a new buildwolrd on an old
  base system.

3 years agoRevert "sys.mk: Add the 's' modifier to our ARFLAGS."
zrj [Wed, 16 Dec 2020 06:09:08 +0000 (08:09 +0200)]
Revert "sys.mk: Add the 's' modifier to our ARFLAGS."

This reverts commit 6bae3359fa1ec5d88e148046045c4d9eabcaef21.

To be investigated, few issues in static cc1plus.

3 years agopthreads: Add pthread_is_threaded_np.3 manpage.
zrj [Tue, 15 Dec 2020 07:00:45 +0000 (07:00 +0000)]
pthreads: Add pthread_is_threaded_np.3 manpage.

3 years agopthreads: Add pthread_yield_np().
zrj [Tue, 15 Dec 2020 06:34:30 +0000 (06:34 +0000)]
pthreads: Add pthread_yield_np().

 Same as non standard pthread_yield() but with correct '_np' suffix.

3 years agopthreads: Use sticky version in pthread_is_threaded_np().
zrj [Tue, 15 Dec 2020 06:30:15 +0000 (06:30 +0000)]
pthreads: Use sticky version in pthread_is_threaded_np().

 It was observed that several applications have undefined behaviour if
 they become implicitly threaded at runtime (e.g. locale libraries).
 This allows to check status to avoid issues in applications calling
 sigprocmask() and fork() without immediate exec().

3 years agoworld: Add <sys/single_threaded.h>
zrj [Tue, 15 Dec 2020 06:27:09 +0000 (06:27 +0000)]
world: Add <sys/single_threaded.h>

 The __libc_single_threaded is publicly exported version of libc private
 __isthreaded symbol that does not reset on fork in threaded programs.

3 years agoUpdate the pciconf(8) database.
Sascha Wildner [Tue, 15 Dec 2020 13:13:19 +0000 (14:13 +0100)]
Update the pciconf(8) database.

December 13, 2020 snapshot from https://pci-ids.ucw.cz

3 years agodsynth: Collect and present meta-node statistics.
Antonio Huete Jimenez [Mon, 14 Dec 2020 00:29:15 +0000 (01:29 +0100)]
dsynth: Collect and present meta-node statistics.

  - Do not display meta-node ports in 'built' since they are
    not really built (although they are marked as successful).
  - Create a new category called 'meta' where meta-nodes will
    be represented.
  - Curses mode does not show meta-nodes, the display is already
    too tight.

Feature-request-by: @zrj
3 years agodsynth: Delete obsolete packages upon 'prepare-system'
Antonio Huete Jimenez [Sun, 13 Dec 2020 10:16:03 +0000 (11:16 +0100)]
dsynth: Delete obsolete packages upon 'prepare-system'

  - Remove old versions of packages when doing 'prepare-system'
    thus avoiding duplicate dependencies due to old versions still
    being present along with newer ones.

3 years agosys.mk: Add the 's' modifier to our ARFLAGS.
Sascha Wildner [Sun, 13 Dec 2020 07:50:32 +0000 (08:50 +0100)]
sys.mk: Add the 's' modifier to our ARFLAGS.

This allows us to remove most explicit executions of ranlib(1) and
lorder(1)/tsort(1) during buildworld, although not all.

Remaining are some 'ar -M' cases for static and profiling libstdc++
that still need ranlib(1). lorder(1)/tsort(1) are still used in the
linking of shared libraries.

3 years agotop, vmstat, who, rwhod - Use CLOCK_UPTIME to calculate uptime
Matthew Dillon [Sun, 13 Dec 2020 02:26:28 +0000 (18:26 -0800)]
top, vmstat, who, rwhod - Use CLOCK_UPTIME to calculate uptime

* Use CLOCK_UPTIME to calculate the system uptime instead of
  subtracting current real time from boot real time, which could
  get muffed up by setting the time.

3 years agouptime - Use CLOCK_UPTIME to calculate uptime
Matthew Dillon [Sun, 13 Dec 2020 00:33:32 +0000 (16:33 -0800)]
uptime - Use CLOCK_UPTIME to calculate uptime

* Use CLOCK_UPTIME instead of subtracting the current realtime
  from boottime.

* Fixes broken uptimes after time is set.

Reported-by: tuxillo, others
3 years agoRemove local ar(1) operation code definitions and use ARFLAGS.
Sascha Wildner [Sat, 12 Dec 2020 20:41:27 +0000 (21:41 +0100)]
Remove local ar(1) operation code definitions and use ARFLAGS.

Remove 'l' from ARFLAGS (serves no purpose) and add 'c' to silence
archive creation warnings.

Note that we do not need to care about 'D' because our binutils were
configured with '--enable-deterministic-archives'.

To be done later: Adding 's' and stop running lorder/ranlib explicitly.

3 years agopthreads: Add pthread_is_threaded_np() function.
zrj [Sat, 12 Dec 2020 14:16:38 +0000 (14:16 +0000)]
pthreads: Add pthread_is_threaded_np() function.

3 years agopthreads: Enhance pthread_sigprocmask() stub.
zrj [Sat, 12 Dec 2020 14:13:50 +0000 (14:13 +0000)]
pthreads: Enhance pthread_sigprocmask() stub.

 Some ports expect this function to work even before pthread_create().

3 years agopthreads: Add pthread_getattr_np().
zrj [Sat, 12 Dec 2020 14:12:00 +0000 (14:12 +0000)]
pthreads: Add pthread_getattr_np().

Adapted-from: NetBSD

3 years ago<pthread.h>: Provide pthread_*_np() prototypes too.
zrj [Tue, 8 Dec 2020 11:45:40 +0000 (11:45 +0000)]
<pthread.h>: Provide pthread_*_np() prototypes too.

 Based on review in DPorts what some of software packages expect.

3 years agolibstand: Exclude pthread types for loaders.
zrj [Tue, 8 Dec 2020 11:45:20 +0000 (11:45 +0000)]
libstand: Exclude pthread types for loaders.

 This effectively removes pthread types from loaders.

3 years ago<aio.h>: Only provide pthread types mandated by POSIX here.
zrj [Tue, 8 Dec 2020 11:44:32 +0000 (11:44 +0000)]
<aio.h>: Only provide pthread types mandated by POSIX here.

3 years ago<signal.h>: Further reduce pthread namespace pollution.
zrj [Tue, 8 Dec 2020 11:43:54 +0000 (11:43 +0000)]
<signal.h>: Further reduce pthread namespace pollution.

 Only provide types mandated by POSIX here.

3 years agopthreads: Reimplement pthread types using non polluting types.
zrj [Tue, 8 Dec 2020 11:11:06 +0000 (11:11 +0000)]
pthreads: Reimplement pthread types using non polluting types.

 Use __ implementation specific namespace and adjust libthread_xu.
 * The pthread_addr_t type was specific only to libc_r, remove it.
 * The pthread_startroutine_t typedef was never used since initial fork.
 * The mutex member in struct pthread_once was for libc_r only, rename
   it to __sparelibc_r void pointer to keep ABI compatibility.
 * Mangle struct names using __type_s scheme to avoid collisions with
   user defined types in 3rd-party software packages.
 * Adjust partly publicly visible struct pthread_once members too.

3 years agopthreads: Use pthread_t type in libthread_xu.
zrj [Tue, 8 Dec 2020 11:09:37 +0000 (11:09 +0000)]
pthreads: Use pthread_t type in libthread_xu.

 Separated from upcoming work to allow easier differentiation between
 non-pointers, single and double pointers.  Inclusion of thr_private.h
 already provides all needed information to dereference these types.

 No functional change

3 years agopthreads: Reduce pthread type namespace pollution.
zrj [Tue, 8 Dec 2020 10:36:12 +0000 (10:36 +0000)]
pthreads: Reduce pthread type namespace pollution.

 This fully removes pthread types in kernel (except vkernel).
 The vkernel bits first require <signal.h> exposure adjustments.
 * Exclude type for sigev_notify_attributes for kernel, used only by the
   lib/librt/aio.c.  We could use void type unconditionally like NetBSD,
 * Do not provide pthread_attr_t in <sys/aio.h> for kernel.

3 years agopthreads: Remove <sys/signal.h> from <pthread.h>.
zrj [Tue, 8 Dec 2020 10:35:18 +0000 (10:35 +0000)]
pthreads: Remove <sys/signal.h> from <pthread.h>.

 Seems to be legacy remnant for no longer required pthread_kill() and
 pthread_sigmask().  Use lighter types header in <pthread_np.h>, because
 size_t must be provided by <time.h> and <pthread.h> must include it.

3 years agopthreads: Remove DragonFly tags referencing libc_r.
zrj [Tue, 8 Dec 2020 10:34:41 +0000 (10:34 +0000)]
pthreads: Remove DragonFly tags referencing libc_r.