dragonfly.git
5 years agoupgrade: Clarify deprecated files message.
zrj [Sat, 2 Mar 2019 09:14:04 +0000 (11:14 +0200)]
upgrade: Clarify deprecated files message.

Suggested-by: swildner
5 years agodrm/linux/rbtree.h: Rename RB_ROOT to LINUX_RB_ROOT
François Tigeot [Sun, 3 Mar 2019 20:10:07 +0000 (21:10 +0100)]
drm/linux/rbtree.h: Rename RB_ROOT to LINUX_RB_ROOT

Preventing clashes with the more general RB_ROOT kernel definition

5 years agoRemove some IPSec remains via 'make upgrade'.
Sascha Wildner [Sun, 3 Mar 2019 18:25:41 +0000 (19:25 +0100)]
Remove some IPSec remains via 'make upgrade'.

Reported-by: zrj
5 years agokernel/ixgbe: Fix buildkernel, re-apply 9e2814118aabe1f24cf00485.
Sascha Wildner [Sun, 3 Mar 2019 14:41:48 +0000 (15:41 +0100)]
kernel/ixgbe: Fix buildkernel, re-apply 9e2814118aabe1f24cf00485.

5 years agoix: Sync with Intel ixgbe-3.3.6
Sepherosa Ziehau [Mon, 25 Feb 2019 15:03:32 +0000 (23:03 +0800)]
ix: Sync with Intel ixgbe-3.3.6

- Honor VLAN_HWTAGGING setting when setup RX VLAN tag stripping.
- Add workaround for possible FW hang on X550.

5 years agokernel - Add callout debugging
Matthew Dillon [Sat, 2 Mar 2019 22:45:33 +0000 (14:45 -0800)]
kernel - Add callout debugging

* We still have a few issues where the callout lists become corrupt.
  Add debugging to store the originator of a callout by file/line in
  the structure itself as a debugging aid.

5 years ago<semaphore.h>: Fix guard comment.
Sascha Wildner [Sat, 2 Mar 2019 22:25:00 +0000 (23:25 +0100)]
<semaphore.h>: Fix guard comment.

5 years agokernel: Remove numerous #include <sys/thread2.h>.
Sascha Wildner [Sat, 2 Mar 2019 20:34:21 +0000 (21:34 +0100)]
kernel: Remove numerous #include <sys/thread2.h>.

Most of them were added when we converted spl*() calls to
crit_enter()/crit_exit(), almost 14 years ago. We can now
remove a good chunk of them again for where crit_*() are
no longer used.

I had to adjust some files that were relying on thread2.h
or headers that it includes coming in via other headers
that it was removed from.

5 years agokernel/sound: Remove local KOBJMETHOD_END defines.
Sascha Wildner [Sat, 2 Mar 2019 10:27:24 +0000 (11:27 +0100)]
kernel/sound: Remove local KOBJMETHOD_END defines.

5 years ago<sys/systm.h>: No need to include <sys/callout.h> here.
Sascha Wildner [Sat, 2 Mar 2019 10:25:00 +0000 (11:25 +0100)]
<sys/systm.h>: No need to include <sys/callout.h> here.

5 years agoMakefile.inc1: Minor fixes for CTOOLS handling.
zrj [Sat, 2 Mar 2019 08:21:47 +0000 (10:21 +0200)]
Makefile.inc1: Minor fixes for CTOOLS handling.

Simplify logic a bit, remove no longer needed variables and duplicates.
Fix gnu/lib/Makefile (WORLD_CCVER should not be used in tree context).

5 years agogpt(8): "show" command support to print partition GUID
Aaron LI [Sat, 2 Mar 2019 02:17:33 +0000 (10:17 +0800)]
gpt(8): "show" command support to print partition GUID

The "show" subcommand gains the "-g" option to print the partition GUID
instead of the partition type/label.

This helps to identify the GPT partition corresponding to the UUIDs
shown in "/dev/slice-by-uuid".

5 years agogpt(8): Improve "show" subcommand
Aaron LI [Sat, 2 Mar 2019 02:12:13 +0000 (10:12 +0800)]
gpt(8): Improve "show" subcommand

* Mark unused space with "Unused".
* Catch unknown partition types and print "Unknown"
* Show active MBR partition with the "(active)" mark.  This can be
  helpful for a hybrid GPT/MBR setup.

Obtained-from: NetBSD

5 years agoAdjust various things for the recent brk(2) removal.
Sascha Wildner [Fri, 1 Mar 2019 15:38:39 +0000 (16:38 +0100)]
Adjust various things for the recent brk(2) removal.

5 years agokernel/ena: Fix another error path.
Sascha Wildner [Fri, 1 Mar 2019 13:30:07 +0000 (14:30 +0100)]
kernel/ena: Fix another error path.

Release the MSI-X vector if we fail after it's been allocated but
before we can use the goto.

5 years agokernel/ena: Fix an uninitialized variable issue in an error path.
Sascha Wildner [Fri, 1 Mar 2019 13:24:13 +0000 (14:24 +0100)]
kernel/ena: Fix an uninitialized variable issue in an error path.

At this point in initialization, we just return ENXIO on failure.

Reported-by: zrj
5 years agodrm/linux: Add rcu_assign_pointer()
François Tigeot [Thu, 28 Feb 2019 21:23:40 +0000 (22:23 +0100)]
drm/linux: Add rcu_assign_pointer()

5 years agolibc: Remove old MLINKS for fpclassify.3.
Sascha Wildner [Thu, 28 Feb 2019 16:10:48 +0000 (17:10 +0100)]
libc: Remove old MLINKS for fpclassify.3.

I forgot to remove them in b6b35a1b4c682b25f983fc039f153dcd04094189.

Reported-by: zrj
5 years agoGC: Remove old clang 3.8 that required extern sources.
zrj [Thu, 28 Feb 2019 15:17:17 +0000 (17:17 +0200)]
GC: Remove old clang 3.8 that required extern sources.

  In preparations for libc++ import.

5 years agogcc50: Mark as deprecated.
zrj [Thu, 28 Feb 2019 15:07:53 +0000 (17:07 +0200)]
gcc50: Mark as deprecated.

  If gcc50 will not be further used as alternative compiler and it's
  private dynamic libraries are no longer needed, it can be safely
  removed from the base system using: make upgrade -DREMOVE_DEPRECATED

5 years agoRevert "kernel - Temporarily change WORLD_ALTCOMPILER default in master"
zrj [Thu, 28 Feb 2019 13:27:17 +0000 (15:27 +0200)]
Revert "kernel - Temporarily change WORLD_ALTCOMPILER default in master"

This reverts commit 6ef7b2b34b7cd49e3e26cf7316d8217e102e6b75.

  Issue should be resolved by now. Build only gcc47 as alternative compiler
  by default (for time being gcc50 can still be hooked into the build).
  This reduces buildworld time by ~6 minutes.

5 years agonrelease: Minor cleanups to the Makefile
Aaron LI [Thu, 28 Feb 2019 15:34:02 +0000 (23:34 +0800)]
nrelease: Minor cleanups to the Makefile

5 years agonrelease: More unambiguous label based on gitrev.sh
Aaron LI [Thu, 28 Feb 2019 15:17:32 +0000 (23:17 +0800)]
nrelease: More unambiguous label based on gitrev.sh

Use the git revision to compose the label to make it more unambiguous.

Use the same label as the .iso volume ID, but truncated to be <= 32
characters.  Thank zrj for the make variable operation :D

Discusssed-with: swildner

5 years agonrelease: Use part-by-label to identify root in .img
Aaron LI [Thu, 28 Feb 2019 07:59:00 +0000 (15:59 +0800)]
nrelease: Use part-by-label to identify root in .img

Previously, the DragonFly .img hardcoded "da8" as the USB device, but
this may not be the case on some systems and requires user interaction
to boot.

Now that DragonFly has "/dev/part-by-label", use this new mechanism
(i.e., the label/name of the disklabel64(5) slice in the .img file) to
better identify the USB device with DragonFly installation image on it.
The label name is "DragonFly_${KERNCONF}" by default.

5 years agokernel - Add /dev/part-by-label
Matthew Dillon [Thu, 28 Feb 2019 06:36:27 +0000 (22:36 -0800)]
kernel - Add /dev/part-by-label

* The DragonFly disklabel has a 'label' field which accepts up to
  a 63 byte ascii label.

* When this field is not empty, the kernel will now create a
  "/dev/part-by-label/<label>.<part>" alias.

  For example, if the label is FUBAR and you create a label with
  partitions 'a', 'b', and 'd', then you will get:

  # ls /dev/part-by-label
  FUBAR.a      FUBAR.b      FUBAR.d

* WARNING!  Duplicate labels will replace each other, so the
  label that shows up will be non-deterministic.

Suggested-by: Aaron LI
5 years agokernel - Slightly change the behavior of MADV_NOSYNC and MAP_NOSYNC
Matthew Dillon [Thu, 28 Feb 2019 05:42:25 +0000 (21:42 -0800)]
kernel - Slightly change the behavior of MADV_NOSYNC and MAP_NOSYNC

* When files pages are mapped with the NOSYNC flag, the user program
  is requesting that the kernel not periodically flush the dirty pages
  to the filesystem under normal operation.  Such pages can still be
  flushed due to memory pressure.

* However, if the pages are not set back to MADV_AUTOSYNC, this behavior
  can persist indefinitely (until umount or vnode recyclement), even
  after all the related processes have closed/unmapped the file.  This
  results in very non-deterministic (and likely unexpected) flush behavior.

* Change the behavior to flush such dirty pages during the normal periodic
  filesystem sync if the file is found to no longer be mapped and also
  no longer open for writing.  If the program wants to throw the data away
  permanently, the program should delete or truncate the file.

  In otherwords, the requested NOSYNC behavior is only applicable when the
  file is open for writing or memory mapped.

5 years agokernel - Document possible dead code
Matthew Dillon [Thu, 28 Feb 2019 05:41:40 +0000 (21:41 -0800)]
kernel - Document possible dead code

* Document possible dead code due to the removal of B_MALLOC
  buffers, but do not replace it with an assertion yet.

5 years agokernel - Reduce vm_page_list_find2() stalls
Matthew Dillon [Tue, 26 Feb 2019 06:58:24 +0000 (22:58 -0800)]
kernel - Reduce vm_page_list_find2() stalls

* Reduce stalls in vm_page_list_find2() which can occur in low-memory
  situations, as well as in other situations.  The problem is two fold.

  First, that potentially all cpu cores can wind up waiting for a
  single vm_page's spin-lock to be released.

  Second, that a long-held vm_page spin-lock can cause the VM system
  to stall unnecessarily long.

* Change vm_page_list_find() and vm_page_list_find2() to no longer
  unconditionally spinlock a vm_page candidate and then retry if it
  is found to be on the wrong queue.

  Instead the code now spinlocks the queue, then iterates vm_page
  candidates using spin_trylock(), skipping any pages whos spinlocks
  cannot be immediately acquired.  This is lock-order-reversed but
  is ok because we use trylock.  Also, by locking the queue first we
  guarantee that a successfully spinlocked vm_page will be on the
  correct queue.

* Should also reduce IPIQ drain stalls reported to the console as
  shown below.  The %rip sample is often found in vm_page_list_find2().

  send_ipiq X->Y tgt not draining (STALL_SECONDS)

5 years agosys/vfs/autofs: Drop .vop_getpages/.vop_putpages
Tomohiro Kusumi [Mon, 25 Feb 2019 16:07:28 +0000 (08:07 -0800)]
sys/vfs/autofs: Drop .vop_getpages/.vop_putpages

Autofs only supports getattr/lookup/mkdir/readdir for
inmemory directory inodes.

5 years agokernel - Implement sbrk(), change low-address mmap hinting (2)
Matthew Dillon [Sun, 24 Feb 2019 19:43:11 +0000 (11:43 -0800)]
kernel - Implement sbrk(), change low-address mmap hinting (2)

* Fix sysproto.h for the sbrk() change. 'incr' is size_t now.
  (make sysent hadn't been run)

Reported-by: swildner
5 years agosys/vm: Fix debug message in generic VOP_GETPAGES() handler
Tomohiro Kusumi [Sun, 24 Feb 2019 20:02:42 +0000 (12:02 -0800)]
sys/vm: Fix debug message in generic VOP_GETPAGES() handler

5 years agonetif/re: Sync with Realtek's re-1.95.
Sepherosa Ziehau [Sat, 16 Feb 2019 11:42:32 +0000 (19:42 +0800)]
netif/re: Sync with Realtek's re-1.95.

Mainly fix some register settings.

5 years agolibc/sysvipc: Remove duplicate include.
Sascha Wildner [Sun, 24 Feb 2019 01:35:33 +0000 (02:35 +0100)]
libc/sysvipc: Remove duplicate include.

5 years ago<semaphore.h>: Whitespace cleanup.
Sascha Wildner [Sat, 23 Feb 2019 23:45:23 +0000 (00:45 +0100)]
<semaphore.h>: Whitespace cleanup.

5 years ago<sys/ioctl.h>: Remove old SunOS compatibility definitions.
Sascha Wildner [Sat, 23 Feb 2019 20:24:54 +0000 (21:24 +0100)]
<sys/ioctl.h>: Remove old SunOS compatibility definitions.

Nothing needs this anymore.

Thanks to tuxillo for build-testing dports.

5 years agokernel/bktr: Clean up unused code and the Makefile.
Sascha Wildner [Sat, 23 Feb 2019 09:11:56 +0000 (10:11 +0100)]
kernel/bktr: Clean up unused code and the Makefile.

There should be no functional change.

5 years agoRemove <sys/semaphore.h> so that we have <semaphore.h> only.
Sascha Wildner [Fri, 22 Feb 2019 21:16:09 +0000 (22:16 +0100)]
Remove <sys/semaphore.h> so that we have <semaphore.h> only.

There is no point for us to go through the kernel for getting at
SEM_VALUE_MAX from sysconf(3), so return it directly and remove
the associated p1003_1b.sem_value_max sysctl.

Beyond that, the kernel didn't need this header. I've found no
ports that need it, either.

For safety, bump __DragonFly_version anyway.

5 years agonrelease - Fix target for Makefile.usr
Antonio Huete Jimenez [Thu, 21 Feb 2019 20:21:07 +0000 (21:21 +0100)]
nrelease - Fix target for Makefile.usr

- src-create-repo was merged to src-create in ad8b70e08d. This happens only
  for the GUI build.

5 years agodrm: Reduce ioctl differences with Linux 4.7.10
François Tigeot [Tue, 19 Feb 2019 22:32:57 +0000 (23:32 +0100)]
drm: Reduce ioctl differences with Linux 4.7.10

Add a pair of missing generic drm ioctls.

5 years agolibc - Use sbrk() system call, remove brk() (2)
Matthew Dillon [Tue, 19 Feb 2019 17:34:28 +0000 (09:34 -0800)]
libc - Use sbrk() system call, remove brk() (2)

* Change the initial TLS allocation to use mmap() instead of sbrk()
  in order to maintain compatibility with older kernels.

* Using sbrk() will work with a fully updated system, but will not
  work with an old kernel because it returns an error and sets errno,
  but setting errno requires the TLS to already be installed.  So
  even though we have back-off code in libc, it seg-faults before
  it gets to it.

* Only affects a few programs in base such as 'chflags' so not a
  disaster.  But still, the intent was to maintain compatibility
  with older kernels.

5 years agoLINT64: Add KTR_LAPIC.
Sascha Wildner [Tue, 19 Feb 2019 12:23:36 +0000 (13:23 +0100)]
LINT64: Add KTR_LAPIC.

5 years ago<sys/cdio.h>: Remove definitions that are related to unimplemented ioctls.
Sascha Wildner [Mon, 18 Feb 2019 14:07:56 +0000 (15:07 +0100)]
<sys/cdio.h>: Remove definitions that are related to unimplemented ioctls.

None of this is handled in the kernel.

5 years ago<libutil.h>: Remove an orphaned prototype.
Sascha Wildner [Mon, 18 Feb 2019 10:52:33 +0000 (11:52 +0100)]
<libutil.h>: Remove an orphaned prototype.

Reported-by: tuxillo
5 years agoktr.4: Add a few words about KTR_LAPIC.
Sascha Wildner [Mon, 18 Feb 2019 07:45:50 +0000 (08:45 +0100)]
ktr.4: Add a few words about KTR_LAPIC.

5 years agokernel - Implement sbrk(), change low-address mmap hinting
Matthew Dillon [Sun, 17 Feb 2019 00:41:25 +0000 (16:41 -0800)]
kernel - Implement sbrk(), change low-address mmap hinting

* Change mmap()'s internal lower address bound from dmax (32GB)
  to RLIMIT_DATA's current value.  This allows the rlimit to be
  e.g. reduced and for hinted mmap()s to then map space below
  the 4GB mark.  The default data rlimit is 32GB.

  This change is needed to support several languages, at least
  lua and probably another one or two, who use mmap hinting
  under the assumption that it can map space below the 4GB
  address mark.  The data limit must be lowered with a limit command
  too, which can be scripted or patched for such programs.

* Implement the sbrk() system call.  This system call was already
  present but just returned EOPNOTSUPP and libc previously had its
  own shim for sbrk() which used the ancient break() system call.
  (Note that the prior implementation did not ENOSYS or signal).

  sbrk() in the kernel is thread-safe for positive increments and
  is also byte-granular (the old libc sbrk() was only page-granular).

  sbrk() in the kernel does not implement negative increments and
  will return EOPNOTSUPP if asked to.  Negative increments were
  historically designed to be able to 'free' memory allocated with
  sbrk(), but it is not possible to implement the case in a modern
  VM system due to the mmap changes above.

  (1) Because the new mmap hinting changes make it possible for
  normal mmap()s to have mapped space prior to the RLIMIT_DATA resource
  limit being increased, causing intermingling of sbrk() and user mmap()d
  regions.  (2) because negative increments are not even remotely
  thread-safe.

* Note the previous commit refactored libc to use the kernel sbrk()
  and fall-back to its previous emulation code on failure, so libc
  supports both new and old kernels.

* Remove the brk() shim from libc.  brk() is not implemented by the
  kernel.  Symbol removed.  Requires testing against ports so we may
  have to add it back in but basically there is no way to implement
  brk() properly with the mmap() hinting fix

* Adjust manual pages.

5 years agolibc - Use sbrk() system call, remove brk()
Matthew Dillon [Sat, 16 Feb 2019 19:40:04 +0000 (11:40 -0800)]
libc - Use sbrk() system call, remove brk()

* Attempt to use the kernel sbrk() system call.  If it fails
  with EOPNOTSUPP, back-off to the older libc sbrk() emulation
  code which uses still-present but obsolete break() system call.

* Changes support both old and new kernels.  Older kernels do not
  implement the sbrk() system call, causing the call to return
  -1/EOPNOTSUPP.  Note that older kernels did not generate an
  ENOSYS/signal for sbrk().

* sbrk() cannot support negative increments.  Allow only 0 and positive
  increments.

* Fix MPSAFE issues (requires new kernels) while we are here.

* Remove brk() support entirely.  This was also emulated in older
  kernels using break().

* These changes are necessary in order to support mmap() hinting above
  RLIMIT_DATA's current value.  Older kernels only support hinting above
  the system maximum value (above the 32GB mark).  Several languages in
  dports really want to mmap() addresses below 4GB.

5 years agoUpdate the pciconf(8) database.
Sascha Wildner [Sun, 17 Feb 2019 09:32:21 +0000 (10:32 +0100)]
Update the pciconf(8) database.

February 13, 2019 snapshot from https://pci-ids.ucw.cz

5 years agoinstall(1): Fix usage(), we don't have -T.
Sascha Wildner [Wed, 6 Feb 2019 18:05:26 +0000 (19:05 +0100)]
install(1): Fix usage(), we don't have -T.

5 years agoSync ACPICA with Intel's version 20190215.
Sascha Wildner [Sat, 16 Feb 2019 21:27:50 +0000 (22:27 +0100)]
Sync ACPICA with Intel's version 20190215.

* Add support for the ACPI specification version 6.3.

* Fix skipping erroneous extended opcodes.

* Some improvements in iasl(8).

* Remove the legacy AcpiGbl_ExecuteTablesAsMethods global and all
  associated code, i.e. the debug.acpi.group_module_level_code tunable
  and acpiexec(8)'s -dp option.

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

5 years agomanpath.config: Add ravenports paths.
Sascha Wildner [Sat, 16 Feb 2019 20:08:51 +0000 (21:08 +0100)]
manpath.config: Add ravenports paths.

While here, remove an obsolete line.

Reported-by: marino
5 years agodrm/linux: Add asm/processor.h
François Tigeot [Sun, 17 Feb 2019 09:25:59 +0000 (10:25 +0100)]
drm/linux: Add asm/processor.h

5 years agodrm: Fix Linux/DragonFly PAGE_MASK confusion
François Tigeot [Sun, 17 Feb 2019 08:06:17 +0000 (09:06 +0100)]
drm: Fix Linux/DragonFly PAGE_MASK confusion

* Both Linux and the DragonFly kernel use a PAGE_MASK constant,
  which is unfortunately defined differently in each one

* Define a LINUX_PAGE_MASK macro and use it when applicable in the
  drm code to fix this confusion

* One or two drm/radeon bugs were possibly caught during the process

* This commit based on a patch by tuxillo

Spotted-by: tuxillo
Fixes: https://bugs.dragonflybsd.org/issues/3171

5 years agofstab.5: Remove trailing whitespace from 828221af1c1fe3514.
Sascha Wildner [Sat, 16 Feb 2019 09:52:56 +0000 (10:52 +0100)]
fstab.5: Remove trailing whitespace from 828221af1c1fe3514.

5 years agosys/vfs/autofs: Drop <sys/bus.h>
Tomohiro Kusumi [Sat, 16 Feb 2019 09:27:25 +0000 (01:27 -0800)]
sys/vfs/autofs: Drop <sys/bus.h>

Looks like this is no longer needed just to compile.

5 years agoMove some accidentally separated text back to the correct spot.
Justin C. Sherrill [Sat, 16 Feb 2019 02:57:58 +0000 (21:57 -0500)]
Move some accidentally separated text back to the correct spot.

5 years agodd(1): Sync with FreeBSD
Aaron LI [Thu, 14 Feb 2019 16:12:06 +0000 (00:12 +0800)]
dd(1): Sync with FreeBSD

Some highlights:
* Add the "fillchar" operand.
* Add the "speed" operand to limit the speed.
* Support to specify the output data parity in the "conv" operand.
* Add tests, which can be run with "make test".

I adjusted the device names in the examples of the man page.  Some minor
tweaks (e.g., styles, function prototypes, comments) were also applied.

5 years agodd(1): Implement GNU's extension of "status" operand
Aaron LI [Thu, 14 Feb 2019 12:34:21 +0000 (20:34 +0800)]
dd(1): Implement GNU's extension of "status" operand

* status=none: do not print status information
* status=noxfer: do not print transfer  statistics

  This feature is useful because the statistics information can
  sometimes be annoying, and redirecting stderr to /dev/null would also
  lost error messages.

  Obtained from FreeBSD (revision 264059)

* status=progress: report the current status on a single line every
  second.

  Obtained from FreeBSD (revisions 337505,337865,338646)

5 years agodd(1): Rework the time interval calculation
Aaron LI [Thu, 14 Feb 2019 13:38:21 +0000 (21:38 +0800)]
dd(1): Rework the time interval calculation

dd(1) uses gettimeofday(2) to compute the throughput statistics.
However, gettimeofday returns the system clock, which may jump forward
or back, especially if NTP is in use.  If the time jumps backwards, then
dd will see negative elapsed time, round it up to 1usec, and print an
absurdly fast transfer rate.

The solution is to use clock_gettime(2) with CLOCK_MONOTONIC as the
clock_id.  That clock advances steadily, regardless of changes to the
system clock.

Don't sacrifice precision by converting the output of clock_gettime() to
a double and then comparing the results.  Instead, subtract the values
of the two clock_gettime() calls, then convert to double.

Obtained-from: FreeBSD (revisions 265472,265698)

5 years agodd(1): Make signal handler async safe
Aaron LI [Thu, 14 Feb 2019 13:06:26 +0000 (21:06 +0800)]
dd(1): Make signal handler async safe

Obtained-from: FreeBSD (revision 250469)

5 years agosys/sys/mutex2: Fix mutex(9) man page
Tomohiro Kusumi [Fri, 15 Feb 2019 00:27:25 +0000 (16:27 -0800)]
sys/sys/mutex2: Fix mutex(9) man page

"mtxex" does no exist after cabfc9f6989fa1e4dbccc61162309bd2ec6891c9.

5 years agortld-elf - Allow dynamic (late) relocations to relro section (2)
Matthew Dillon [Tue, 12 Feb 2019 20:28:11 +0000 (12:28 -0800)]
rtld-elf - Allow dynamic (late) relocations to relro section (2)

* Add missing header file adjustment

5 years agoipfw3: allow the ipfw_insn with only the basic action
Bill Yuan [Tue, 12 Feb 2019 14:17:11 +0000 (14:17 +0000)]
ipfw3: allow the ipfw_insn with only the basic action

5 years agortld-elf - Allow dynamic (late) relocations to relro section
Matthew Dillon [Mon, 11 Feb 2019 21:47:22 +0000 (13:47 -0800)]
rtld-elf - Allow dynamic (late) relocations to relro section

* Normally the relro section is mprotect()ed to read-only after normal
  load relocations.

* It appears that some programs can issue dynamic relocations at
  run-time to such sections.

* If the relro mprotect has been done on an object, temporarily mprotect
  the object back to RW to execute the relocation, then mprotect it back
  to RO.

Reported-by: marino
5 years agobsd-family-tree: Sync with FreeBSD (add macOS 10.14).
Sascha Wildner [Mon, 11 Feb 2019 16:31:55 +0000 (17:31 +0100)]
bsd-family-tree: Sync with FreeBSD (add macOS 10.14).

5 years agomakefs(8): DragonFly porting.
Sascha Wildner [Sun, 10 Feb 2019 09:01:52 +0000 (10:01 +0100)]
makefs(8): DragonFly porting.

Some notes:

* UFS2 support has been disabled for now. It would require more UFS2
  related pieces in our UFS kernel headers. I might look at enabling
  this in the future.

* Our CGSIZE() macro causes issues when used in makefs(8), which is
  why I'm using FreeBSD's currently.

* makefs(8) uses a local daddr_t type which is 64 bits wide, since
  ours is 32 bits.

* I added cg_blks() and cg_blktot() calls in a few places because
  our fsck(8) checks them in pass 5. I'm not sure if the associated
  fields are actually needed anymore.

5 years agoBring in most of makefs(8) from FreeBSD unchanged.
Sascha Wildner [Sun, 10 Feb 2019 08:11:11 +0000 (09:11 +0100)]
Bring in most of makefs(8) from FreeBSD unchanged.

To create filesystem images without kernel involvement. We can use it
to create our initrd without needing vn(4).

Originally from NetBSD.

5 years agoFix pkg "-f" flag in the "make upgrade" message
Aaron LI [Mon, 4 Feb 2019 05:33:39 +0000 (13:33 +0800)]
Fix pkg "-f" flag in the "make upgrade" message

5 years agorc.d/sysctl: Only set a sysctl when give a new value
Aaron LI [Mon, 4 Feb 2019 05:22:02 +0000 (13:22 +0800)]
rc.d/sysctl: Only set a sysctl when give a new value

For a sysctl, compare the given value with its current value, and only
update the value if the new value is different.  This suppresses
unhelpful messages on the console.

Reported-by: sephe
5 years agokernel - Fix panic in mlock() and munlock()
Matthew Dillon [Sat, 2 Feb 2019 22:29:40 +0000 (14:29 -0800)]
kernel - Fix panic in mlock() and munlock()

* Fix a degenerate case when mlock() or munlock() is called
  with a size of 0.  Silently allow the case and return success
  (0).

* Fixes vm_map panic.

5 years agogcore(1): Some cleanup.
Sascha Wildner [Sat, 2 Feb 2019 18:07:58 +0000 (19:07 +0100)]
gcore(1): Some cleanup.

* Update usage(). While here, remove void casts.

* Sentences in manual pages should start on a new line.

* Flags without arguments should be specified first in the SYNOPSIS
  grouped together.

* Bump manual page date.

5 years agogcore - Fix /proc map reading, add verbose option, add limit option
Matthew Dillon [Sat, 2 Feb 2019 17:57:54 +0000 (09:57 -0800)]
gcore - Fix /proc map reading, add verbose option, add limit option

* Our /proc/*/map code allows incremental reads so the old
  code that detects an insufficient buffer size no longer works.
  Fix the code so processes with long maps are properly processed.

* Add -v to verbosely print the segments being dumped.

* Add -l <limit>{,k,m,g,t} to ignore segments larger than the
  specified limitm.

5 years agosys/vfs/autofs: Drop unused autofs_mount/autofs_softc fields
Tomohiro Kusumi [Sat, 2 Feb 2019 16:57:25 +0000 (08:57 -0800)]
sys/vfs/autofs: Drop unused autofs_mount/autofs_softc fields

Drop unused ones which originate from FreeBSD.

5 years agogcore - Handle segments > 2GB
Matthew Dillon [Sat, 2 Feb 2019 08:15:16 +0000 (00:15 -0800)]
gcore - Handle segments > 2GB

* Fix an improper 'int' plus a little cleanup.  This allows gcore to
  operate on processes which map segments greater than 2GB.

5 years agosys/vfs/autofs: Whitespace cleanups
Tomohiro Kusumi [Thu, 31 Jan 2019 17:45:43 +0000 (09:45 -0800)]
sys/vfs/autofs: Whitespace cleanups

Use space rather than tab (originates from FreeBSD).

5 years agokernel - Sync usb3.0 pci ids w/FreeBSD
Matthew Dillon [Thu, 31 Jan 2019 19:35:40 +0000 (11:35 -0800)]
kernel - Sync usb3.0 pci ids w/FreeBSD

* Add missing PCI ids for Sunrise Point, Lewisburg, Union Point,
  and Cavium ThunderX.

Reported-by: dualcyclo
5 years agosys/vfs/autofs: Rename autofs_readdir_one() -> autofs_write_dirent()
Tomohiro Kusumi [Wed, 30 Jan 2019 23:05:14 +0000 (15:05 -0800)]
sys/vfs/autofs: Rename autofs_readdir_one() -> autofs_write_dirent()

5 years agosys/vfs/autofs: Don't calculate dirent reclen twice
Tomohiro Kusumi [Wed, 30 Jan 2019 22:50:41 +0000 (14:50 -0800)]
sys/vfs/autofs: Don't calculate dirent reclen twice

when autofs_readdir() may call autofs_dirent_reclen() after
returned from autofs_readdir_one().

5 years agoatomic: Alway use inline functions.
Sepherosa Ziehau [Sun, 27 Jan 2019 14:06:08 +0000 (22:06 +0800)]
atomic: Alway use inline functions.

Originally only builtin functions use the inline version of the
atomic ops, while modules only use real function call, which is
designed for binary compatibility.  However, this kind of
compatibility is not necessary for DragonFly.

5 years agodrm/linux: Add EXPORT_SYMBOL_GPL()
François Tigeot [Sun, 27 Jan 2019 10:15:31 +0000 (11:15 +0100)]
drm/linux: Add EXPORT_SYMBOL_GPL()

5 years agodrm/linux: Add preempt.h
François Tigeot [Sat, 26 Jan 2019 09:04:34 +0000 (10:04 +0100)]
drm/linux: Add preempt.h

5 years agopcm.4: Use .Dx
Sascha Wildner [Sat, 26 Jan 2019 08:51:08 +0000 (09:51 +0100)]
pcm.4: Use .Dx

5 years agoefirt.9: Comment out a non-existant function.
Sascha Wildner [Mon, 21 Jan 2019 10:50:09 +0000 (11:50 +0100)]
efirt.9: Comment out a non-existant function.

5 years agodrm: Fix excessive wired memory usage
François Tigeot [Sun, 20 Jan 2019 20:11:44 +0000 (21:11 +0100)]
drm: Fix excessive wired memory usage

* This is a partial revert of 7ca4ece0a85bea451332580015344d3f12333419:
  "drm: Rename struct drm_gem_object.vm_obj to filp".

* That commit caused wired memory usage to become excessive over time.

5 years agodrm/gem: de-inline the ref/unref functions
François Tigeot [Sat, 19 Jan 2019 19:11:34 +0000 (20:11 +0100)]
drm/gem: de-inline the ref/unref functions

Reducing differences with Linux 4.7.10

5 years agodrm/linux/workqueue: the internal function is named func
François Tigeot [Wed, 16 Jan 2019 19:43:47 +0000 (20:43 +0100)]
drm/linux/workqueue: the internal function is named func

Some driver code expects to be able to access it.

5 years agofgetln.3: Recommend to use the safer POSIX getline()
Aaron LI [Wed, 16 Jan 2019 09:00:47 +0000 (17:00 +0800)]
fgetln.3: Recommend to use the safer POSIX getline()

Obtained-from: OpenBSD

5 years agofgetln.3: Add the CAVEATS section with an example
Aaron LI [Wed, 16 Jan 2019 08:57:05 +0000 (16:57 +0800)]
fgetln.3: Add the CAVEATS section with an example

Add the CAVEATS section to warn about the behavior of fgetln().  An
example is included to demonstrate how to properly use it.

Obtained-from: NetBSD, with the ferror() check from OpenBSD

5 years agogetline.3: Note to distinguish between error and EoF
Aaron LI [Wed, 16 Jan 2019 08:51:41 +0000 (16:51 +0800)]
getline.3: Note to distinguish between error and EoF

Note that the getline() and getdelim() functions do not distinguish
between end-of-file and error, so the callers must use feof() or
ferror() to determine which occurred.

Update the example to check the error.

Obtained-from: OpenBSD

5 years agotmpfs - Fix periodic syncer cpu-bound stalls w/tmpfs on big-mem boxes
Matthew Dillon [Tue, 15 Jan 2019 22:17:26 +0000 (14:17 -0800)]
tmpfs - Fix periodic syncer cpu-bound stalls w/tmpfs on big-mem boxes

* A bug in tmpfs leaves dirty tmpfs vnodes (which is basically all
  of them) on the syncer list, causing the syncer to scan the entire
  list every few seconds.  When a large number of vnodes are involved,
  this can lead to noticable cpu-bound stalls on the cpu the syncer is
  running on.

* Generally speaking this should significantly improve applications
  which use tmpfs a lot, such as synth runs, but was probably not noticed
  on machines with less than 32GB of ram due to the lower kern.maxvnodes
  default.

* Solved by unconditionally removing the vnode from the syncer list
  in tmpfs_fsync(), but otherwise leaving the vnode marked VISDIRTY and
  usually also VOBJDIRTY.  Tmpfs's reclaim code properly handles the
  disconnect regardless of the syncer state of the vnode.

  Removing the vnode ensures that only one syncer pass is performed on
  it, instead of repeated passes every few seconds.

5 years agoUpdate the pciconf(8) database.
Sascha Wildner [Tue, 15 Jan 2019 06:37:48 +0000 (07:37 +0100)]
Update the pciconf(8) database.

January 9, 2019 snapshot from https://pci-ids.ucw.cz

5 years agokernel: Remove puffs(4), putter(9) and associated libs and utilities.
Sascha Wildner [Tue, 15 Jan 2019 03:44:42 +0000 (04:44 +0100)]
kernel: Remove puffs(4), putter(9) and associated libs and utilities.

All of these were originally pushed and hooked into the build in non-
working condition so that they would not go stale break building. The
hope was that someone would pick up the work and fix the remaining
issues, which never materialized.

This has led to more harm than good, with people occasionally assuming
that this code is functional. Also, the existence of /usr/include/fuse.h
might lead configure checks into believing that we have a working
implementation.

5 years agokernel: Hide the sysctl.debug sysctl in the SYSCTL_DEBUG kernel option.
Sascha Wildner [Mon, 14 Jan 2019 17:59:58 +0000 (18:59 +0100)]
kernel: Hide the sysctl.debug sysctl in the SYSCTL_DEBUG kernel option.

The output is quite excessive and was previously too easily triggered,
like with "sysctl name=value" (instead of just "name=value") in
/etc/sysctl.conf.

Taken-from: FreeBSD

5 years agolibcrypto: Switch over to libc's reallocarray().
Sascha Wildner [Sun, 13 Jan 2019 14:54:35 +0000 (15:54 +0100)]
libcrypto: Switch over to libc's reallocarray().

5 years agosbin/hammer2: Silence -Wformat-truncation= warning on Linux (gcc 7.3)
Tomohiro Kusumi [Sun, 13 Jan 2019 22:40:19 +0000 (14:40 -0800)]
sbin/hammer2: Silence -Wformat-truncation= warning on Linux (gcc 7.3)

filename[HAMMER2_INODE_MAXNAME] may not be sufficient if
snprintf source pfs.name string is large enough. To silence
the warning, filename[] needs another 16 bytes.

This doesn't make difference on runtime, because bytes beyond
sizeof(pfs.name) won't be used even if strlen(pfs.name) is
large enough that filename[] contents exceeds sizeof(pfs.name).

(i.e. end result of pfs.name may be incomplete with or without
this commit)

--
cmd_snapshot.c: In function 'cmd_pfs_snapshot':
cmd_snapshot.c:84:9: warning: '%04d' directive output may be truncated writing between 4 and 11 bytes into a region of size between 0 and 255 [-Wformat-truncation=]
     "%s.%04d%02d%02d.%02d%02d%02d",
         ^~~~
cmd_snapshot.c:83:3: note: 'snprintf' output between 17 and 324 bytes into a destination of size 256
   snprintf(filename, sizeof(filename),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     "%s.%04d%02d%02d.%02d%02d%02d",
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     pfs.name,
     ~~~~~~~~~
     tp->tm_year + 1900,
     ~~~~~~~~~~~~~~~~~~~
     tp->tm_mon + 1,
     ~~~~~~~~~~~~~~~
     tp->tm_mday,
     ~~~~~~~~~~~~
     tp->tm_hour,
     ~~~~~~~~~~~~
     tp->tm_min,
     ~~~~~~~~~~~
     tp->tm_sec);
     ~~~~~~~~~~~

5 years agolibc: Adjust Versions.def properly.
Sascha Wildner [Sun, 13 Jan 2019 03:34:23 +0000 (04:34 +0100)]
libc: Adjust Versions.def properly.

5 years agoi386 removal, part 70/x: Remove some i386 specific bits in the kernel.
Sascha Wildner [Sun, 13 Jan 2019 00:07:03 +0000 (01:07 +0100)]
i386 removal, part 70/x: Remove some i386 specific bits in the kernel.

5 years agoi386 removal, part 69/x: Clean up sys/dev/netif.
Sascha Wildner [Thu, 3 Jan 2019 22:25:39 +0000 (23:25 +0100)]
i386 removal, part 69/x: Clean up sys/dev/netif.

According to comments from sephe.

5 years agoMake libssh and mandoc use reallocarray() from libc.
Sascha Wildner [Sat, 12 Jan 2019 22:39:00 +0000 (23:39 +0100)]
Make libssh and mandoc use reallocarray() from libc.

5 years agolibc: Add reallocarray() from OpenBSD.
Sascha Wildner [Sat, 12 Jan 2019 22:37:36 +0000 (23:37 +0100)]
libc: Add reallocarray() from OpenBSD.

It is useful for dhcpcd, mandoc and libssh. Also some dports might pick
it up. A few other dports have workarounds which, once reallocarray() is
in release too, can be removed.

Taken-from:     OpenBSD (manual page from FreeBSD)
Pointed-out-by: aly
5 years agodrm/linux: Add struct device_driver
François Tigeot [Sat, 12 Jan 2019 12:05:56 +0000 (13:05 +0100)]
drm/linux: Add struct device_driver