dragonfly.git
3 years agoifconfig(8): Speed up non-status operations to a single interface
Aaron LI [Fri, 26 Jun 2020 13:38:11 +0000 (21:38 +0800)]
ifconfig(8): Speed up non-status operations to a single interface

When performing a non-status operation on a single interface (e.g., set
address or flags), it is not necessary for ifconfig(8) to build a list
of all addresses in the system, sort them, and then iterate through them
to look for the single interface of interest.

Obtained from FreeBSD (revision 343535; review D18919)

3 years agoifconfig(8): Group addresses of each interface by family
Aaron LI [Fri, 26 Jun 2020 12:56:17 +0000 (20:56 +0800)]
ifconfig(8): Group addresses of each interface by family

Group the list of addresses associated with an interface by the address
family.  A stable sorting algorithm is employed here to preserve the
order of addresses inside a single group of each interface.

Obtained from FreeBSD (revisions 278080 and 278107).

3 years agoifconfig(8): Use getifaddrs(3) from libc
Aaron LI [Fri, 26 Jun 2020 09:59:53 +0000 (17:59 +0800)]
ifconfig(8): Use getifaddrs(3) from libc

Use libc's getifaddrs(3) instead of implementing its own version.

Obtained from FreeBSD (revisions 166956 and 199770); with minor
adjustments.

While there, also adjust some styles.

3 years agoifconfig(8): Use correct interface name when setting flags
Aaron LI [Fri, 26 Jun 2020 07:53:07 +0000 (15:53 +0800)]
ifconfig(8): Use correct interface name when setting flags

Obtained from FreeBSD (revision 187253).

With this change, the comment to setifflags() is now obsolete, so remove
it.  While there, improve styles a bit.

3 years agoifconfig(8): Add '-f' option to print in more formats
Aaron LI [Fri, 26 Jun 2020 06:02:58 +0000 (14:02 +0800)]
ifconfig(8): Add '-f' option to print in more formats

* Add the '-f' option to control the output formats of addresses,
  inet (IPv4) subnet masks, inet6 (IPv6) prefix length, Ethernet (MAC)
  address.  The following output formats are supported:

  - address: numeric (default), host, FQDN
  - inet (IPv4) subnet masks: CIDR, dotted-quad, and traditional hex
    output (default)
  - inet6 (IPv6) prefix length: CIDR, traditional integer format
    (default)
  - ether (MAC address): colon-separated (default), dash-separated

* The 'IFCONFIG_FORMAT' environment variable has the same usage as the
  '-f' option and can be overrided by the latter.

* Some minor cleanups.

Obtained from FreeBSD (revisions 301059 and 301185; review D2856), but
with my own minor modifications.

3 years agoifconfig(8): Print more WPS attributes in verbose "list scan" output
Aaron LI [Tue, 5 May 2020 02:58:20 +0000 (10:58 +0800)]
ifconfig(8): Print more WPS attributes in verbose "list scan" output

* Move WPS-related defines to a dedicated file
  <netproto/802_11/ieee80211_wps.h>
* Add handlers for more WPS attributes

Obtained-from: FreeBSD (revision 343204)

3 years agoifconfig(8): Eliminate trailing whitespace on inet6 and group lines
Aaron LI [Sun, 12 Apr 2020 13:53:32 +0000 (21:53 +0800)]
ifconfig(8): Eliminate trailing whitespace on inet6 and group lines

Obtained from FreeBSD:
https://github.com/freebsd/freebsd/commit/edcbc8f7441a32ec27fb2e57542bf291cb01029e
https://reviews.freebsd.org/D19004

3 years agoifconfig(8): Drop two unused macros from ifieee80211.c
Aaron LI [Sun, 12 Apr 2020 13:36:22 +0000 (21:36 +0800)]
ifconfig(8): Drop two unused macros from ifieee80211.c

Obtained from FreeBSD:
https://github.com/freebsd/freebsd/commit/1ce3befafefa7226bcff3621562943176fe87ff3

3 years agoifconfig(8): Make lagg creation more fault-tolerant
Aaron LI [Sun, 12 Apr 2020 13:29:32 +0000 (21:29 +0800)]
ifconfig(8): Make lagg creation more fault-tolerant

* Warn, don't exit, when SIOCSLAGGPORT returns an error.

  When we exit with an error during lagg creation, a single failed NIC
  (which no longer attaches) can prevent lagg creation and other
  configuration, such as adding an IPv4 address, and thus leave a
  machine unreachable.

* Preserve non-EEXISTS errors for exit status from SIOCSLAGGPORT, in
  case scripts are looking for it. Hopefully this can be extended if
  other parts of ifconfig can allow a "soft" failure.

* Improve the warning message to mention what lagg and what member are
  problematic.

Obtained from FreeBSD:
https://github.com/freebsd/freebsd/commit/dde41c97866152e8c7eb1f52f07e3e5ac43b2652
https://reviews.freebsd.org/D15046

3 years agoifconfig(8): Render non-ASCII SSID names with UTF-8 locales
Aaron LI [Sun, 12 Apr 2020 12:56:39 +0000 (20:56 +0800)]
ifconfig(8): Render non-ASCII SSID names with UTF-8 locales

Currently ifconfig(8) only prints the hex representation of ssid names
with non-ASCII characters.  Many modern terminals are able to properly
render non-ASCII characters.  This change checks if the terminal charmap
is UTF-8, and if so, will render the characters, rather than the hex
value.

This behavior is circumvented by running ifconfig(8) in a non-UTF8
locale; e.g. C or POSIX.

Obtained from FreeBSD:
https://github.com/freebsd/freebsd/commit/137a4801848fde80544a987fb168ff56face2ffd
https://reviews.freebsd.org/D15922

3 years agoUpgrade awk(1). 2/2
Daniel Fojt [Thu, 25 Jun 2020 04:16:24 +0000 (06:16 +0200)]
Upgrade awk(1). 2/2

Adapt Makefile and update README.{DELETED,DRAGONFLY}.

3 years agoUpgrade awk(1). 1/2
Daniel Fojt [Thu, 25 Jun 2020 04:15:47 +0000 (06:15 +0200)]
Upgrade awk(1). 1/2

Merge branch vendor/AWK into master.

3 years agovendor/awk: upgrade from 20121220 to 20200612
Daniel Fojt [Wed, 24 Jun 2020 05:45:41 +0000 (07:45 +0200)]
vendor/awk: upgrade from 20121220 to 20200612

Summary of notable changes:

- fixed buffer overflow in error reporting
- OFS value used to rebuild the record was incorrect
- add POSIX standard %a and %A to supported formats
- decrementing NF did not change $0
- unary plus on a string constant returned the string
- avoid undefined behaviour when using ctype(3) functions in relex()
- make getline handle numeric strings
- added support for POSIX-standard interval expressions in regexps
- use of random(3) as the random number generator
- support POSIX-specified C-style escape sequences "\a" and "\v" in
  command line arguments and regular expressions
- fix various array / memory overruns
- import code from NetBSD awk that implements RS as a regular expression
- add an optimization for string concatenation
- fix a bug whereby a{0,3} could match four a's
- input/output errors on closing files are now fatal instead of mere
  warnings
- if POSIXLY_CORRECT is set in the environment, then sub and gsub use
  POSIX rules for multiple backslashes
- it's no longer necessary to use the -y flag to bison
- backslash continuation inside strings removes the newline
- avoid any spurious errors left over from previous calls

For details, see FIXES, or commit history at
https://github.com/onetrueawk/awk/commits/master

3 years agodrm: Add headers, stubs and constants required by Linux 4.10 code
François Tigeot [Wed, 24 Jun 2020 15:45:07 +0000 (17:45 +0200)]
drm: Add headers, stubs and constants required by Linux 4.10 code

3 years agodrm: Move acpi_is_video_device() to linux/acpi.h
François Tigeot [Wed, 24 Jun 2020 14:58:54 +0000 (16:58 +0200)]
drm: Move acpi_is_video_device() to linux/acpi.h

3 years agobsd-family-tree: Sync with FreeBSD (fix 1BSD release date).
Sascha Wildner [Tue, 23 Jun 2020 19:48:04 +0000 (21:48 +0200)]
bsd-family-tree: Sync with FreeBSD (fix 1BSD release date).

3 years agoddb.4: document hardware watchpoints and dwatch
Krzysztof Piecuch [Sun, 21 Jun 2020 18:48:48 +0000 (18:48 +0000)]
ddb.4: document hardware watchpoints and dwatch

Document dwatch, hwatch, dhwatch commands.
While there, mention possible command aliases.

3 years agotmpfs - Try to avoid a tmpfs node deadlock in rename
Matthew Dillon [Sat, 20 Jun 2020 18:26:05 +0000 (11:26 -0700)]
tmpfs - Try to avoid a tmpfs node deadlock in rename

* Simultaneous renames of A -> DIR/B  and DIR/C -> D can
  deadlock tmpfs due to an incorrect assumption.  The directory
  vnodes are only referenced, not locked, so the namecache locks
  are insufficient.

* Solve by ordering the rename directories deterministically.  This
  is probably not a perfect solution but it should be good enough.
  Use a simple pointer inequality and a direct directory-subdirectory
  test.

3 years agomountd - Turn on SO_REUSEADDR (2)
Matthew Dillon [Sat, 20 Jun 2020 18:24:22 +0000 (11:24 -0700)]
mountd - Turn on SO_REUSEADDR (2)

* After several years it turns out that just turning SO_REUSEADDR
  on can cause a duplicate port to be assigned when an anonymous
  port is requested.  This is really a bug in the kernel which also
  needs to be fixed, but for now only set this option when a specific
  port is selected.

* Enhance bind error reporting.

3 years agotail(1): Implement tac(1) as the reverse version of cat(1)
Aaron LI [Sat, 20 Jun 2020 07:10:41 +0000 (15:10 +0800)]
tail(1): Implement tac(1) as the reverse version of cat(1)

The tac(1) is the reverse version of cat(1) and is implemented with
'tail -rq'.

Update cat.1, rev.1 and tail.1 man pages to mention the new tac(1).

The tac.1 man page is obtained from NetBSD.  The implementation is also
inspired by NetBSD but is different.

3 years agotail(1): Add -v flag to always print a header
Aaron LI [Sat, 20 Jun 2020 03:52:32 +0000 (11:52 +0800)]
tail(1): Add -v flag to always print a header

* Add the '-v' flag to always print a header for each file, even if only
  a single file is specified.  Obtained from NetBSD.
* Add '__dead2' attribute to the non-return function 'usage()'.
* Improve several markups in the man page.

3 years agohead(1): Support '-q' and '-v' flags and improve man page
Aaron LI [Fri, 19 Jun 2020 05:17:29 +0000 (13:17 +0800)]
head(1): Support '-q' and '-v' flags and improve man page

* Support the '-q' flag to never print headers of each filename, and the
  '-v' flag to always print the headers, which are the GNU extensions to
  this tool.
* Improve the man page to include the 'COMPATIBILITY' and 'STANDARDS'
  sections.

Obtained-from: NetBSD

3 years agohead(1): Minor cleanups
Aaron LI [Fri, 19 Jun 2020 05:13:39 +0000 (13:13 +0800)]
head(1): Minor cleanups

* Add '__dead2' attribute to non-return function 'usage()'.
* Move the 'first' out from the initializer part of the 'for' loop and
  change it to a boolean, making the code a bit cleaner.
* Remove one duplicate copyright notice.

3 years agoefibootmgr.8: Add commas before long options for better readability.
Sascha Wildner [Fri, 19 Jun 2020 06:32:14 +0000 (08:32 +0200)]
efibootmgr.8: Add commas before long options for better readability.

While here, upper-case .Sh Examples -> EXAMPLES.

3 years agoefi{dp,var}.8: Add commas before long options for better readability.
Sascha Wildner [Fri, 19 Jun 2020 06:21:32 +0000 (08:21 +0200)]
efi{dp,var}.8: Add commas before long options for better readability.

3 years agoetc/network.subr: enhance wlan initialization
Daniel Fojt [Thu, 18 Jun 2020 06:16:04 +0000 (08:16 +0200)]
etc/network.subr: enhance wlan initialization

Teach wlan_up() and wlan_down() to process just a single interface
passed as optional argument. If no argument is given, process all
"net.wlan.devices" just like before.

Reviewed by: Aaron LI

3 years agotail(1): improve style consistency of previous change
Daniel Fojt [Thu, 18 Jun 2020 04:28:36 +0000 (06:28 +0200)]
tail(1): improve style consistency of previous change

Suggested by: Sascha Wildner

3 years agotail(1): fix misbehaviour on pseudo filesystems
Daniel Fojt [Wed, 17 Jun 2020 06:56:17 +0000 (08:56 +0200)]
tail(1): fix misbehaviour on pseudo filesystems

When processing regular zero-sized files, use display_lines() instead of
rlines(). This fixes tail(1) behaviour with files on pseudo filesystems
(like procfs) which are often reported to have zero size while having
a content.

Issue: https://bugs.dragonflybsd.org/issues/3034

3 years agoetc/periodic: fix off-by-one error in 220.snapshot-hammer2
Daniel Fojt [Tue, 16 Jun 2020 17:05:40 +0000 (19:05 +0200)]
etc/periodic: fix off-by-one error in 220.snapshot-hammer2

Increase $_keep before passing it to tail(1) as the output from
tail -n+N starts at N-th line of its input which is the last
snapshot to be kept actually.

3 years agokernel: improve open(2) error handling
Daniel Fojt [Tue, 16 Jun 2020 05:23:19 +0000 (07:23 +0200)]
kernel: improve open(2) error handling

When trying to open a file with O_CREAT and O_EXCL flags while the file
exists, disregard the file permissions and always return EEXIST as
described in manpage and required by the standard.

Issue: https://bugs.dragonflybsd.org/issues/2953

3 years agodhcpcd: Update README.DRAGONFLY
Roy Marples [Tue, 16 Jun 2020 08:50:55 +0000 (08:50 +0000)]
dhcpcd: Update README.DRAGONFLY

3 years agodhcpcd: Fix build for 9.1.2
Roy Marples [Tue, 16 Jun 2020 08:47:49 +0000 (08:47 +0000)]
dhcpcd: Fix build for 9.1.2

3 years agoMerge branch 'vendor/DHCPCD'
Roy Marples [Tue, 16 Jun 2020 08:46:44 +0000 (08:46 +0000)]
Merge branch 'vendor/DHCPCD'

3 years agoUpdate to dhcpcd-9.1.2 with the following changes:
Roy Marples [Tue, 16 Jun 2020 08:43:31 +0000 (08:43 +0000)]
Update to dhcpcd-9.1.2 with the following changes:

 * BSD: Only mark static routes from dhcpcd.conf as static
 * DHCP6: Ensure requested addresses are requested
 * DHCP6: Fix prefix length calculation when no prefix specified

 * privsep: Implement a resource limited sandbox

You will see a control proxy process now.
This is for the resource limited sandbox so that we can isolate
requests over the control socket.
For NetBSD, FreeBSD and derivatives such as DragonFlyBSD this is a massive win
as these OS now enjoy a similar level of protection as Capsicum or Pledge,
but without the syscall filtering.

3 years agodrm/i915: enable i915_gem_phys_ops
François Tigeot [Tue, 16 Jun 2020 08:05:25 +0000 (10:05 +0200)]
drm/i915: enable i915_gem_phys_ops

3 years agosed(1): sync with FreeBSD
Daniel Fojt [Mon, 15 Jun 2020 17:15:41 +0000 (19:15 +0200)]
sed(1): sync with FreeBSD

Summary of notable changes:

- fix sed functions 'i' and 'a' from discarding leading white space
- rewrite the main loop of the "sed s/..." command
- fix -i option behavior with 'q' command
- process \r, \n, and \t
- attempt to learn about hex escapes (e.g. \x27)
- read commands from stdin when -f - is passed

Reviewed by: Sascha Wildner

3 years ago<protocols/dumprestore.h>: Fix include guard comment.
Sascha Wildner [Mon, 15 Jun 2020 18:25:18 +0000 (20:25 +0200)]
<protocols/dumprestore.h>: Fix include guard comment.

3 years agodrm/i915: Use kmem_cache functions
François Tigeot [Mon, 15 Jun 2020 10:16:39 +0000 (12:16 +0200)]
drm/i915: Use kmem_cache functions

3 years agodrm/linux: Add kmem_cache functions and related constants
François Tigeot [Mon, 15 Jun 2020 09:51:21 +0000 (11:51 +0200)]
drm/linux: Add kmem_cache functions and related constants

3 years agoUpdate the pciconf(8) database.
Sascha Wildner [Mon, 15 Jun 2020 09:13:32 +0000 (11:13 +0200)]
Update the pciconf(8) database.

May 29, 2020 snapshot from https://pci-ids.ucw.cz

3 years agoBring in efibootmgr(8) from FreeBSD.
Sascha Wildner [Sat, 13 Jun 2020 06:52:58 +0000 (08:52 +0200)]
Bring in efibootmgr(8) from FreeBSD.

Taken-from: FreeBSD

3 years agoinitrd/mkinitrd.sh: Use 'du -t' to simplify size calculation
Aaron LI [Fri, 12 Jun 2020 15:57:01 +0000 (23:57 +0800)]
initrd/mkinitrd.sh: Use 'du -t' to simplify size calculation

The du(1)'s '-t' option calculates the apparent size, which is what we
want here for determining the required size of the initrd image.  This
saves us a shell function to do the same work.

3 years agoetc/periodic: Use 'LINKS' to create links for 220.snapshot-hammer2
Aaron LI [Fri, 12 Jun 2020 14:58:42 +0000 (22:58 +0800)]
etc/periodic: Use 'LINKS' to create links for 220.snapshot-hammer2

Avoid the ad-hoc 'ln' command.  In addition, the original linked-to
files are absolute paths but missing the '${DESTDIR}', so they can be on
two different installations.  Use 'LINKS' that creates hard-links to
fix this issue.

Reviewed-by: swildner, deef
3 years agomk/bsd.README: Document 'SYMLINKS' and update 'LINKS' and 'MLINKS'
Aaron LI [Fri, 12 Jun 2020 14:54:53 +0000 (22:54 +0800)]
mk/bsd.README: Document 'SYMLINKS' and update 'LINKS' and 'MLINKS'

* Add description of 'SYMLINKS' that creates symbolic links.
* 'MLINKS' creates hard links rather than soft links.
* Update description of 'LINKS' and the example.  '${DESTDIR}' will be
  auto prepended so it should not be used.

Reviewed-by: swildner
3 years agoUpgrade less(1). 2/2
Daniel Fojt [Fri, 12 Jun 2020 11:34:05 +0000 (13:34 +0200)]
Upgrade less(1). 2/2

- update README.{DELETED,DRAGONFLY}
- import regenerated defines.h
- fix -Werror=unused-variable in screen.c

3 years agoUpgrade less(1). 1/2
Daniel Fojt [Fri, 12 Jun 2020 11:33:18 +0000 (13:33 +0200)]
Upgrade less(1). 1/2

Merge branch vendor/LESS into master.

3 years agovendor/less: upgrade from 481 to 551
Daniel Fojt [Fri, 12 Jun 2020 11:32:09 +0000 (13:32 +0200)]
vendor/less: upgrade from 481 to 551

- unicode tables updated
- new commands added
- new cmdline options introduced
- bugs and memory leaks fixed

For details see:

http://www.greenwoodsoftware.com/less/news.487.html
http://www.greenwoodsoftware.com/less/news.530.html
http://www.greenwoodsoftware.com/less/news.551.html

3 years agokernel - Refactor sysclock_t from 32 to 64 bits (2)
Matthew Dillon [Thu, 11 Jun 2020 22:57:04 +0000 (15:57 -0700)]
kernel - Refactor sysclock_t from 32 to 64 bits (2)

* Cputimer reload values can be negative, check condition and
  set a small positive reload value instead.

* Also avoids muldivu64() overflow warnings on the console.

Reported-by: kworr
3 years agoshare/example/Makefile: Sort better.
Sascha Wildner [Thu, 11 Jun 2020 20:37:18 +0000 (22:37 +0200)]
share/example/Makefile: Sort better.

3 years agoProperly ignore "trim" failures in swapon(8).
Daniel Fojt [Thu, 11 Jun 2020 18:11:55 +0000 (20:11 +0200)]
Properly ignore "trim" failures in swapon(8).

When trying to "trim" a swap device that doesn't support this, just ignore
particular ioctl() failure and continue activating the swap. This actually
matches the behaviour described in swapon(8) manpage.

Issue: https://bugs.dragonflybsd.org/issues/3207

3 years agoUpgrade diffutils. 2/2
Daniel Fojt [Wed, 10 Jun 2020 09:32:29 +0000 (11:32 +0200)]
Upgrade diffutils. 2/2

- update README.{DELETED,DRAGONFLY}
- regenerate header files
- adapt Makefile to vendor update

3 years agoUpgrade diffutils. 1/2
Daniel Fojt [Thu, 11 Jun 2020 12:33:51 +0000 (14:33 +0200)]
Upgrade diffutils. 1/2

Merge branch vendor/DIFFUTILS into master.

3 years agovendor/diffutils: upgrade from 3.3 to 3.7 vendor/DIFFUTILS
Daniel Fojt [Wed, 10 Jun 2020 09:05:53 +0000 (11:05 +0200)]
vendor/diffutils: upgrade from 3.3 to 3.7

Summary of notable changes:

- new options --color and --palette to generate and configure colored
  output, compatible with less -R
- when binary files differ, diff now exits with status 1 as POSIX requires
- unless the --ignore-file-name-case option is used, diff now
  considers file names to be equal only if they are byte-for-byte
  equivalent
- diff -B no longer generates incorrect output if the two inputs each end
  with a one-byte incomplete line
- diff --brief no longer reports a difference for unusual identical files
- diff3 no longer malfunctions due to use-after-free
- using an invalid regular expression with --ignore-matching-lines=RE (-I)
  no longer causes stack overflow
- possible uninitialized memory read with --strip-trailing-cr fixed
- default algorithm has been adjusted to output higher-quality results,
  and further tweaked to deal better with larger files

For a complete history of changes see:

http://git.savannah.gnu.org/cgit/diffutils.git/log/

3 years agokernel: fix misleading error from allocating file descriptors
Daniel Fojt [Thu, 11 Jun 2020 09:25:27 +0000 (11:25 +0200)]
kernel: fix misleading error from allocating file descriptors

Return EINVAL instead of EMFILE when requested new file descriptor number
exceeds the limit.

Discussed with: Sascha Wildner

3 years agoDeduplicate login environment setup.
Daniel Fojt [Tue, 9 Jun 2020 11:28:45 +0000 (13:28 +0200)]
Deduplicate login environment setup.

Revise default environment assignments in login.conf(5).

Update share/skel/dot.profile to match share/skel/dot.cshrc, ie. comment
assignments done via login.conf (PATH, BLOCKSIZE, umask).

Drop etc/root and update "distribution" target in Makefile to use
share/skel/* instead.

Discussed with and reviewed by: Sascha Wildner
Issue: https://bugs.dragonflybsd.org/issues/3220

3 years agoworld - Change serial port default from 9600 to 115200
Matthew Dillon [Wed, 10 Jun 2020 21:00:28 +0000 (14:00 -0700)]
world - Change serial port default from 9600 to 115200

* Long overdue change, all serial port defaults are now set to
  115200.

* NOTE: legacy BIOS boot0/boot1 use int 0x14 to set the serial
  console baud rate.  This BIOS call only supports up to 9600.
  But once you get into the boot loader it should be able to set
  the correct baud rate.

3 years agoboot.8: Markup a kernel configuration option better.
Sascha Wildner [Wed, 10 Jun 2020 20:06:46 +0000 (22:06 +0200)]
boot.8: Markup a kernel configuration option better.

3 years agouefi.8: Add a reference to efidp(8).
Sascha Wildner [Wed, 10 Jun 2020 19:27:54 +0000 (21:27 +0200)]
uefi.8: Add a reference to efidp(8).

3 years agohammer2.8: Sort SEE ALSO.
Sascha Wildner [Wed, 10 Jun 2020 14:14:19 +0000 (16:14 +0200)]
hammer2.8: Sort SEE ALSO.

3 years agoSync shutdown(8) and reboot(8) with FreeBSD
Krzysztof Piecuch [Sat, 6 Jun 2020 21:55:06 +0000 (21:55 +0000)]
Sync shutdown(8) and reboot(8) with FreeBSD

shutdown now understands offsets in seconds, minutes and hours.
reboot is harder to kill ignoring SIGPIPE, SIGINT, SIGQUIT and SIGSTP.

Taken-from: FreeBSD

3 years agoStop overwriting /etc/gettytab on every 'make upgrade'.
Sascha Wildner [Tue, 9 Jun 2020 19:05:42 +0000 (21:05 +0200)]
Stop overwriting /etc/gettytab on every 'make upgrade'.

There isn't really any important movement in it from our side, but there
are some scenarios (autologin for example) where a user may have changed
it.

3 years agokernel - Refactor sysclock_t from 32 to 64 bits
Matthew Dillon [Tue, 9 Jun 2020 16:08:16 +0000 (09:08 -0700)]
kernel - Refactor sysclock_t from 32 to 64 bits

* Refactor the core cpu timer API, changing sysclock_t from 32
  to 64 bits.  Provide a full 64-bit count from all sources.

* Implement muldivu64() using gcc's 128-bit integer type.  This
  functions takes three 64-bit valus, performs (a * b) / d
  using a 128-bit intermediate calculation, and returns a 64-bit
  result.

  Change all timer scaling functions to use this function which
  effectively gives systimers the capability of handling any
  timeout that fits 64 bits for the timer's resolution.

* Remove TSC frequency scaling, it is no longer needed.  The
  TSC timer is now used at its full resolution.

* Use atomic_fcmpset_long() instead of a clock spinlock when
  updating the msb bits for hardware timer sources less than
  64 bits wide.

* Properly recalculate existing systimers when the clock source
  is changed.  Existing systimers were not being recalculated,
  leading to the system failing to boot when time sources had
  radically different clock frequencies.

3 years agodrm/linux: Add work_pending()
François Tigeot [Tue, 9 Jun 2020 07:32:37 +0000 (09:32 +0200)]
drm/linux: Add work_pending()

3 years agodrm/linux: Add raw_read_seqcount()
François Tigeot [Tue, 9 Jun 2020 07:31:49 +0000 (09:31 +0200)]
drm/linux: Add raw_read_seqcount()

3 years agodrm/linux: Add swiotlb_max_segment()
François Tigeot [Tue, 9 Jun 2020 07:30:24 +0000 (09:30 +0200)]
drm/linux: Add swiotlb_max_segment()

3 years agosbin/newfs_hammer2: Remove extra line break after printf outputs
Tomohiro Kusumi [Mon, 8 Jun 2020 17:50:04 +0000 (02:50 +0900)]
sbin/newfs_hammer2: Remove extra line break after printf outputs

This probably came from newfs_hammer.c, but HAMMER2 doesn't have
a note after this.

3 years agoread.2: improve formatting of previous addition
Daniel Fojt [Mon, 8 Jun 2020 17:11:42 +0000 (19:11 +0200)]
read.2: improve formatting of previous addition

- start sentences on new lines
- highlight mentioned functions properly
- add a reference to readdir(3)

Pointed out by: Sascha Wildner

3 years agoread.2: describe EISDIR error
Daniel Fojt [Mon, 8 Jun 2020 13:13:52 +0000 (15:13 +0200)]
read.2: describe EISDIR error

Discussed with: Sascha Wildner

3 years agokernel: more precious errors from read()ing hammer and hammer2
Daniel Fojt [Mon, 8 Jun 2020 12:42:10 +0000 (14:42 +0200)]
kernel: more precious errors from read()ing hammer and hammer2

To conform POSIX, return EISDIR instead of EINVAL when trying to read(2)
a directory from hammer or hammer2 filesystem.

Discussed with and reviewed by: Sascha Wildner

3 years agoImplement periodic hammer2 snapshots.
Daniel Fojt [Mon, 8 Jun 2020 07:38:49 +0000 (09:38 +0200)]
Implement periodic hammer2 snapshots.

- add new periodic(8) script 220.snapshot-hammer2 to daily interval
- symlink the script also into weekly and monthly intervals
- extend default periodic.conf(5) with variables to configure the script
- describe new variables in periodic.conf.5 manpage
- mention the functionality also in hammer2.8 manpage

Note: "daily" variables are used by the script as defaults, so it's
      possible to set custom cron entry for different periodic invocation
      of the script, to create for example hourly snapshots

Discussed with, reviewed and tested by: Matthew Dillon

3 years agodrm/linux: Rewrite dev_printk()
François Tigeot [Mon, 8 Jun 2020 05:51:16 +0000 (07:51 +0200)]
drm/linux: Rewrite dev_printk()

3 years agodrm/linux: Rewrite seq_printf()
François Tigeot [Mon, 8 Jun 2020 05:46:06 +0000 (07:46 +0200)]
drm/linux: Rewrite seq_printf()

3 years agodrm/mm: Fix definitions of alloc_pages() and __free_pages()
François Tigeot [Mon, 8 Jun 2020 05:42:44 +0000 (07:42 +0200)]
drm/mm: Fix definitions of alloc_pages() and __free_pages()

3 years agodrm/linux: Add mutex_lock_nested() and mutex_trylock_recursive()
François Tigeot [Mon, 8 Jun 2020 05:42:20 +0000 (07:42 +0200)]
drm/linux: Add mutex_lock_nested() and mutex_trylock_recursive()

3 years agodrm/linux: Add list_for_each_entry_safe_reverse()
François Tigeot [Mon, 8 Jun 2020 05:39:28 +0000 (07:39 +0200)]
drm/linux: Add list_for_each_entry_safe_reverse()

Obtained-from: FreeBSD

3 years agodrm/linux: Improve put_user()
François Tigeot [Mon, 8 Jun 2020 05:35:44 +0000 (07:35 +0200)]
drm/linux: Improve put_user()

3 years agoefidp.8: Remove unneeded .Pp
Sascha Wildner [Sun, 7 Jun 2020 20:50:44 +0000 (22:50 +0200)]
efidp.8: Remove unneeded .Pp

3 years agokernel - Refactor kern_kevent(), fix timeout overflow (ppoll() bug) (3)
Matthew Dillon [Sun, 7 Jun 2020 18:30:49 +0000 (11:30 -0700)]
kernel - Refactor kern_kevent(), fix timeout overflow (ppoll() bug) (3)

* Fix a second timer overflow.  The systimer clock variable is
  actualy only 32 bits, a 10 minute timeout will overflow it.
  Change the kqueue timeout to 1 minute to work-around.

  (We really need to redo sysclock_t from 32 to 64 bits)

* This should finally fix both swildner's panic and rsmarples
  continued early timeout issue.

Reported-by: swildner, rsmarples
3 years agodrm: Add linux/llist.h
François Tigeot [Sun, 7 Jun 2020 08:11:47 +0000 (10:11 +0200)]
drm: Add linux/llist.h

Mostly obtained from OpenBSD with a few key modifications

3 years agodrm/linux: Fix casting issues in cmpxchg()
François Tigeot [Sun, 7 Jun 2020 08:09:41 +0000 (10:09 +0200)]
drm/linux: Fix casting issues in cmpxchg()

3 years agolibefivar: Fix (instead of silence) the remaining warnings in libefivar.
Sascha Wildner [Sun, 7 Jun 2020 07:49:43 +0000 (09:49 +0200)]
libefivar: Fix (instead of silence) the remaining warnings in libefivar.

3 years agokernel - Increase KNOTE_CACHE_MAX
Matthew Dillon [Sat, 6 Jun 2020 18:08:22 +0000 (11:08 -0700)]
kernel - Increase KNOTE_CACHE_MAX

* Increase KNOTE_CACHE_MAX from 8 to 64 descriptors.  These are tiny
  descriptors, we can afford to have a larger per-cpu cache.

3 years agokernel - Refactor kern_kevent(), fix timeout overflow (ppoll() bug) (2)
Matthew Dillon [Sat, 6 Jun 2020 18:05:53 +0000 (11:05 -0700)]
kernel - Refactor kern_kevent(), fix timeout overflow (ppoll() bug) (2)

* Certain unsupported EV_ERROR events can cause kern_kevent() to
  live-lock, which hits a 'checkloop failed' panic.  Silently
  deregister such events.

* Complain and deregister any kqueue event on behalf of *poll()
  which does not set any poll return flags.

Reported-by: swildner
3 years agosbin/fsck_hammer2: Fix siz in tsnprintf()
Tomohiro Kusumi [Sat, 6 Jun 2020 17:12:06 +0000 (02:12 +0900)]
sbin/fsck_hammer2: Fix siz in tsnprintf()

Prevent small terminal width causing newline behavior in
print_blockref_stats() in verify_blockref().

3 years agoBring in efidp(8) from FreeBSD.
Sascha Wildner [Sat, 6 Jun 2020 07:09:28 +0000 (09:09 +0200)]
Bring in efidp(8) from FreeBSD.

Taken-from: FreeBSD

3 years agoSync uefisign(8) with FreeBSD.
Sascha Wildner [Sat, 6 Jun 2020 06:35:24 +0000 (08:35 +0200)]
Sync uefisign(8) with FreeBSD.

Taken-from: FreeBSD

3 years agoSync libefivar and efivar(8) with FreeBSD.
Sascha Wildner [Sat, 6 Jun 2020 05:30:48 +0000 (07:30 +0200)]
Sync libefivar and efivar(8) with FreeBSD.

Some larger adjustments were needed in efivar-dp-xlate.c to work
around geom.

Taken-from: FreeBSD

3 years agodrm: Switch to the OpenBSD dma-fence implementation
François Tigeot [Sat, 6 Jun 2020 04:50:06 +0000 (06:50 +0200)]
drm: Switch to the OpenBSD dma-fence implementation

The old NetBSD one did not respect sleep/wakeup sequences Linux code expects

3 years agodrm/linux/dma-buf: Rename struct fence to dma_fence
François Tigeot [Sat, 6 Jun 2020 04:49:35 +0000 (06:49 +0200)]
drm/linux/dma-buf: Rename struct fence to dma_fence

3 years agohammer2 - Enhance pfs-list and pfs-delete (2)
Matthew Dillon [Fri, 5 Jun 2020 20:34:41 +0000 (13:34 -0700)]
hammer2 - Enhance pfs-list and pfs-delete (2)

* Fix cast error last commit.

Reported-by: CuteLarva
3 years agohammer2 - Enhance pfs-list and pfs-delete
Matthew Dillon [Fri, 5 Jun 2020 19:33:26 +0000 (12:33 -0700)]
hammer2 - Enhance pfs-list and pfs-delete

* Enhance pfs-list to list PFSs available across all mounted hammer2
  filesystems instead of just the current directory's mount.  A
  specific mount may be specified via -s mountpt.

* Enhance pfs-delete to look for the PFS name across all mounted
  hammer2 filesystems instead of just the current directory's mount.

  As a safety, pfs-delete will refuse to delete PFS names which are
  duplicated across multiple mounts.  A specific mount may be specified
  via -s mountpt.

3 years agoautofs: Fix example file installation.
Sascha Wildner [Fri, 5 Jun 2020 09:42:31 +0000 (11:42 +0200)]
autofs: Fix example file installation.

Reported-by: deef
3 years agokernel - Refactor kern_kevent(), fix timeout overflow (ppoll() bug)
Matthew Dillon [Thu, 4 Jun 2020 23:33:04 +0000 (16:33 -0700)]
kernel - Refactor kern_kevent(), fix timeout overflow (ppoll() bug)

* Fix a bug where large timeouts or very small timeouts could
  overflow the ustimeout variable.  Change the internal timeout
  cap to ensure that no overflow occurs.

* Fix another bug where the internal timeout cap could cause
  ppoll() to return early.  Internal tsleep (etc) timeouts
  need to be ignored because the external timeout might be
  larger and will handle the error return for us when it is
  checked.

* Refactor kern_kevent() to be somewhat more efficient.

Reported-by: rsmarples
3 years agoA little cleanup after recent dhcpcd(8) changes.
Sascha Wildner [Thu, 4 Jun 2020 21:31:34 +0000 (23:31 +0200)]
A little cleanup after recent dhcpcd(8) changes.

* Remove /var/chroot via 'make upgrade' for now.

* Use spaces for indenting in BSD.var.dist.

* Un-document dhcpcd_chrootdir and /var/chroot.

3 years agodhcp: Restore /var/empty as the homedir
Roy Marples [Thu, 4 Jun 2020 21:26:12 +0000 (21:26 +0000)]
dhcp: Restore /var/empty as the homedir

Punt the old chroot /var/chroot/dhcp

3 years agoautofs: Continue installing auto_master to /usr/share/examples/etc too.
Sascha Wildner [Thu, 4 Jun 2020 21:24:30 +0000 (23:24 +0200)]
autofs: Continue installing auto_master to /usr/share/examples/etc too.

We keep an unmodified copy of our shipped /etc in /usr/share/examples/etc
and the recent move of auto_master from etc/ (where we get this copying
gratis) to usr.sbin/autofs requires an extra Makefile now.

3 years agoedk2: Bring in a bunch of additional TianoCore EDK II headers.
Sascha Wildner [Thu, 4 Jun 2020 19:31:29 +0000 (21:31 +0200)]
edk2: Bring in a bunch of additional TianoCore EDK II headers.

Taken from the MdePkg of the edk2-stable202005 tag of the
git://github.com/tianocore/edk2 repository. All I modified was
killing CRs using 'tr -d "\015"'.

In preparation for some upcoming efidp work in libefivar.

3 years agoedk2: Sync our TianoCore EDK II headers with the edk2-stable202005 tag.
Sascha Wildner [Thu, 4 Jun 2020 19:29:47 +0000 (21:29 +0200)]
edk2: Sync our TianoCore EDK II headers with the edk2-stable202005 tag.

3 years agoFD_SET: cast away signed vs unsigned conversion warnings
Roy Marples [Thu, 4 Jun 2020 15:50:20 +0000 (15:50 +0000)]
FD_SET: cast away signed vs unsigned conversion warnings

3 years agodhcpcd: Update README
Roy Marples [Thu, 4 Jun 2020 13:29:54 +0000 (13:29 +0000)]
dhcpcd: Update README