dragonfly.git
3 years agoMerge branch 'vendor/XZ'
Sascha Wildner [Sun, 4 Apr 2021 20:29:57 +0000 (22:29 +0200)]
Merge branch 'vendor/XZ'

3 years agoRemove {lz,xz}less and manual pages from the vendor branch. vendor/XZ
Sascha Wildner [Sun, 4 Apr 2021 20:29:25 +0000 (22:29 +0200)]
Remove {lz,xz}less and manual pages from the vendor branch.

3 years agoMerge branch 'vendor/ZSTD'
Sascha Wildner [Sun, 4 Apr 2021 20:27:37 +0000 (22:27 +0200)]
Merge branch 'vendor/ZSTD'

3 years agoRemove external *less programs/manpages.
Sascha Wildner [Sun, 4 Apr 2021 20:27:23 +0000 (22:27 +0200)]
Remove external *less programs/manpages.

* Point {xz,bz,...}less manual pages at less(1) since all compressed
  less is handled by its own lessopen.sh support.

* Stop installing external {lz,xz,zstd,z}less programs and manual pages.

3 years agoRemove zstdless and its manual page from the vendor branch. vendor/ZSTD
Sascha Wildner [Sun, 4 Apr 2021 20:24:54 +0000 (22:24 +0200)]
Remove zstdless and its manual page from the vendor branch.

3 years agoless: Add {z,bz,xz,lz,zstd}less wrappers for viewing compressed files.
Sascha Wildner [Sun, 4 Apr 2021 19:02:32 +0000 (21:02 +0200)]
less: Add {z,bz,xz,lz,zstd}less wrappers for viewing compressed files.

Taken-from: FreeBSD

3 years agonewsyslog.8: Uncomment a reference to zstd.1.
Sascha Wildner [Sun, 4 Apr 2021 19:02:00 +0000 (21:02 +0200)]
newsyslog.8: Uncomment a reference to zstd.1.

3 years agolibarchive: Fix Symbol.map.
Sascha Wildner [Sun, 4 Apr 2021 18:09:41 +0000 (20:09 +0200)]
libarchive: Fix Symbol.map.

The two symbols added in c37c9ab3239b3abb889e6cfd43e7211513955129 do not
exist in libarchive. Anything else related to zstd was already present in
the Symbol.map.

3 years agozstd(1): Enable multi-threading support in the zstd(1) utility.
Sascha Wildner [Sun, 4 Apr 2021 13:12:25 +0000 (15:12 +0200)]
zstd(1): Enable multi-threading support in the zstd(1) utility.

Note that it is only used when -T is specified.

Leave libzstd itself without multi-threading, to prevent libarchive from
getting a libpthread dependency. Instead, compile libzstd's necessary
bits into zstd(1) and enable multi-threading only in the utilitily.

For detailed reasoning on this, please check zrj's commit message for
3ff63cdaea3abd5eece6e57d01a1ab57a4312636.

While here, clean up libzstd's Makefile a bit.

3 years agomtree: Indent with spaces.
Sascha Wildner [Sat, 3 Apr 2021 15:05:16 +0000 (17:05 +0200)]
mtree: Indent with spaces.

3 years agolibzstd: Raise WARNS to 4.
Sascha Wildner [Sat, 3 Apr 2021 11:32:42 +0000 (13:32 +0200)]
libzstd: Raise WARNS to 4.

3 years agozstd: Remove Makefile.depend's.
Sascha Wildner [Sat, 3 Apr 2021 11:09:29 +0000 (13:09 +0200)]
zstd: Remove Makefile.depend's.

3 years agozstd: Add our READMEs.
Sascha Wildner [Sat, 3 Apr 2021 09:27:50 +0000 (11:27 +0200)]
zstd: Add our READMEs.

3 years agozstd: Remove unneeded gunk from contrib/zstd.
Sascha Wildner [Sat, 3 Apr 2021 09:26:28 +0000 (11:26 +0200)]
zstd: Remove unneeded gunk from contrib/zstd.

3 years agoMerge branch 'vendor/ZSTD' into master
Sascha Wildner [Sat, 3 Apr 2021 09:23:01 +0000 (11:23 +0200)]
Merge branch 'vendor/ZSTD' into master

3 years agoImport zstd 1.4.8 to a vendor branch.
Sascha Wildner [Sat, 3 Apr 2021 09:18:04 +0000 (11:18 +0200)]
Import zstd 1.4.8 to a vendor branch.

3 years agolibzstd: Fix specifying -fno-tree-vectorize for zstd_decompress_block.c.
Sascha Wildner [Sat, 3 Apr 2021 00:56:07 +0000 (02:56 +0200)]
libzstd: Fix specifying -fno-tree-vectorize for zstd_decompress_block.c.

3 years agonewsyslog.conf.5: Add zstd.1 reference and bump .Dd
Sascha Wildner [Fri, 2 Apr 2021 20:06:19 +0000 (22:06 +0200)]
newsyslog.conf.5: Add zstd.1 reference and bump .Dd

3 years agoRevert "newsyslog(8): Comment out zstd support for now."
Sascha Wildner [Fri, 2 Apr 2021 20:01:38 +0000 (22:01 +0200)]
Revert "newsyslog(8): Comment out zstd support for now."

This reverts commit b4fcc362a220df584355e7fae6974e113e4caf3a.

3 years agobuild - Add zstd to the build (libzstd as private library)
Matthew Dillon [Thu, 1 Apr 2021 17:50:51 +0000 (10:50 -0700)]
build - Add zstd to the build (libzstd as private library)

* Bring in contrib/zstd from FreeBSD.

* Add libzstd as a private library (i.e. priv/libprivate_zstd) to
  avoid confusion.  (Note that FreeBSD also has zstd in base as
  a private library).

* Add zstd, unzstd, zstdcat, zstdmt utilities.

* Integrate into libarchive, initrd, dsynth, and misc other
  base system elements.

Ported-from: FreeBSD

3 years agoSync ACPICA with Intel's version 20210331.
Sascha Wildner [Fri, 2 Apr 2021 12:39:47 +0000 (14:39 +0200)]
Sync ACPICA with Intel's version 20210331.

* ACPI 6.4 support.

* Various fixes.

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

3 years agoFix typo in various licenses: merchantibility -> merchantability
Sascha Wildner [Fri, 2 Apr 2021 12:39:13 +0000 (14:39 +0200)]
Fix typo in various licenses: merchantibility -> merchantability

3 years agodsynth - add zstd support (2)
Matthew Dillon [Thu, 1 Apr 2021 17:05:51 +0000 (10:05 -0700)]
dsynth - add zstd support (2)

* Fix a suffix test to handle tar+zstd's 4-character suffix.

3 years agofcntl.2: Fix typo in .Dd
Sascha Wildner [Thu, 1 Apr 2021 09:13:04 +0000 (11:13 +0200)]
fcntl.2: Fix typo in .Dd

3 years agokernel - More fixes to libc's uname
Matthew Dillon [Wed, 31 Mar 2021 21:34:50 +0000 (14:34 -0700)]
kernel - More fixes to libc's uname

* Remove no no-longer-used buf[] (and fix syntax error during
  compilation).

* Do not parse garbage data in buffers in case the sysctls fail.
  This would not have been fatal anyway since we always ensure
  that the buffers are zero-terminated, but it wasn't clean either.
  Clean it up.

* Use the proper name->arrayname for a pointer to the array instead
  of &name->arrayname.  We could also use &name->arrayname[0] but
  just stick with the first method.

Pointed-out-by: dan
3 years agokernel - Adjust varsym API to match manual page, remove from uname
Matthew Dillon [Wed, 31 Mar 2021 21:09:19 +0000 (14:09 -0700)]
kernel - Adjust varsym API to match manual page, remove from uname

* Adjust the varsym system call to match the manual page.  It
  now returns 0 on success instead of the length, and returns
  -1 with an errno of EOVERFLOW if the supplied buffer is too small.

* The uname*() code in libc actually assumed 0 would be returned
  on success, and thus never actually allowed varsym overrides.  Just
  remove the functionality (that nobody uses) entirely.

Reported-by: dan
3 years agokernel - Add fcntl(F_GETPATH) (3)
Matthew Dillon [Tue, 30 Mar 2021 21:14:15 +0000 (14:14 -0700)]
kernel - Add fcntl(F_GETPATH) (3)

* cache_fullpath() limits the result to MAXPATHLEN, but we must
  still adjust the error code to match the manual page and netbsd.

3 years agoModify fcntl.2 manpage to include informations about F_GETPATH
dan [Tue, 30 Mar 2021 20:29:51 +0000 (22:29 +0200)]
Modify fcntl.2 manpage to include informations about F_GETPATH

3 years agokernel - Add fcntl(F_GETPATH)
1338-1 [Tue, 30 Mar 2021 19:31:32 +0000 (21:31 +0200)]
kernel - Add fcntl(F_GETPATH)

* Implement fcntl(F_GETPATH).  For now limit to fp's representing
  vnodes only.  Use cache_fullpath().

* This fcntl() allows a program to retrieve the file path related to
  an open descriptor.

Author:    1338-1 <1338minus1@protonmail.com> also known as dan_
Tested-by: dillon
3 years agovmstat - Adjust kmalloc zone name display
Matthew Dillon [Mon, 29 Mar 2021 21:10:41 +0000 (14:10 -0700)]
vmstat - Adjust kmalloc zone name display

* Replace any spaces in zone names with underscores in the output
  to make sorting the output by field easier.

* Add double -mm option to sort output by the higher of MemUse
  or SlabUse to make it easier to pick-out high-use zones.

3 years agokernel - Use kmalloc_obj for M_VM_OBJECT
Matthew Dillon [Mon, 29 Mar 2021 19:28:10 +0000 (12:28 -0700)]
kernel - Use kmalloc_obj for M_VM_OBJECT

* Use the kmalloc_obj API for struct vm_object management.  Further
  reduces kernel memory fragmentation.

3 years agodsynth: add zstd support
Krzysztof Piecuch [Wed, 10 Mar 2021 22:02:06 +0000 (22:02 +0000)]
dsynth: add zstd support

* Add support for the extension

* However, we need support in base and in pkg before this will work, so it
  is not the default.

Submitted-by: piecuch (pikrzyszt)
3 years agoem/emx: Add support for I219 LM15~19 and I219 V15~19
Sepherosa Ziehau [Mon, 29 Mar 2021 15:12:25 +0000 (23:12 +0800)]
em/emx: Add support for I219 LM15~19 and I219 V15~19

Obtained-from: e1000e

3 years agoem/emx: Merge Intel em-7.7.8.
Sepherosa Ziehau [Tue, 23 Mar 2021 14:48:52 +0000 (22:48 +0800)]
em/emx: Merge Intel em-7.7.8.

Mainly fix setting for I219-LM12 and I219-V12.

3 years agobmake: Update README.DRAGONFLY.
Sascha Wildner [Sat, 27 Mar 2021 10:31:13 +0000 (11:31 +0100)]
bmake: Update README.DRAGONFLY.

3 years agoMerge branch 'vendor/BMAKE'
Sascha Wildner [Sat, 27 Mar 2021 10:30:43 +0000 (11:30 +0100)]
Merge branch 'vendor/BMAKE'

3 years agovendor/bmake: upgrade from 20210206 to 20210314
Sascha Wildner [Sat, 27 Mar 2021 10:30:18 +0000 (11:30 +0100)]
vendor/bmake: upgrade from 20210206 to 20210314

Fixes an issue where strict mode (-dL) was giving spurious errors.

Thanks to Roland Illig and Simon Gerraty for taking care of it.

3 years agokernel/nfs: Garbage collect M_NFSMOUNT.
Sascha Wildner [Thu, 25 Mar 2021 19:19:09 +0000 (20:19 +0100)]
kernel/nfs: Garbage collect M_NFSMOUNT.

3 years agogrdc.6: Improve grammar a little bit.
Sascha Wildner [Wed, 24 Mar 2021 20:52:39 +0000 (21:52 +0100)]
grdc.6: Improve grammar a little bit.

3 years agokernel: Fix build without INVARIANTS.
Sascha Wildner [Tue, 23 Mar 2021 14:23:24 +0000 (15:23 +0100)]
kernel: Fix build without INVARIANTS.

3 years agogpt - Fix corruption in device_name string
Matthew Dillon [Mon, 22 Mar 2021 23:27:31 +0000 (16:27 -0700)]
gpt - Fix corruption in device_name string

* gpt_open() was assign a global char * to a local stack-based buffer.
  Change the stack-based buffer to a static.

* Fixes corrupted device names.

3 years agoMakefile_upgrade.inc: Remove obsolete comment.
Sascha Wildner [Mon, 22 Mar 2021 22:04:47 +0000 (23:04 +0100)]
Makefile_upgrade.inc: Remove obsolete comment.

We stopped keeping formatted manual pages.

See 105f26b55c3c3ffc9913e781deca4c5973a4940c.

3 years agoinclude/Makefile: Remove a 'make upgrade' predecessor.
Sascha Wildner [Mon, 22 Mar 2021 21:41:40 +0000 (22:41 +0100)]
include/Makefile: Remove a 'make upgrade' predecessor.

A few days after we pushed RMHEADERS to include/Makefile, the 'upgrade'
target was added as a more general approach, but these two headers were
never added to it and removed from include's Makefile.

Add them at the top of Makefile_upgrade.inc.

3 years agobnx: Change clock speed to fix several types of hangs
Sepherosa Ziehau [Mon, 22 Mar 2021 15:10:52 +0000 (23:10 +0800)]
bnx: Change clock speed to fix several types of hangs

- During reset, increase the clock speed temporarily to fix hang
  on 5717/5719/5720.
- On 5762, always increase the clock speed even for normal operation
  to avoid hang on TX.

Obtained-from: tg3
f82995b65c44f353358179f4e2745cf967e00b31
3a498606bb04af603a46ebde8296040b2de350d1

3 years agokernel - Add some sysctls to kmalloc_obj
Matthew Dillon [Mon, 22 Mar 2021 05:42:35 +0000 (22:42 -0700)]
kernel - Add some sysctls to kmalloc_obj

* kern.kzone_pollfreq (default 1hz) - Set polling frequency for
  kmalloc zone cleanups.

* kern.kzone_bretire (default 4) - Set number of zones the kmalloc
  poller can retire per interval.  Too high a number can create
  noticable system stalls due to kernel_map operations.

* Add a few more fields to the kmalloc_mgt structure.  Track
  retirement count to help with debugging.

3 years agokernel - Implement type-stable EXIS semantics for kfree_obj() - step 2
Matthew Dillon [Mon, 22 Mar 2021 05:17:43 +0000 (22:17 -0700)]
kernel - Implement type-stable EXIS semantics for kfree_obj() - step 2

* Put an exislock_t in the kmalloc_slab structure and issue
  exis_terminate() upon entering the slab on the full list.

* Do not return a full slab to the gcache until it becomes
  exis_freeable().

  This implements type-stable operation for objects allocated via the
  kmalloc_obj() mechanism.  Kernel code operating inside an
  exis_hold() / exis_drop() sequence is guaranteed type-stability.

* Note that destroying a kmalloc_obj zone shreds any related slabs
  regardless of their EXIS state.  However, this is not a problem
  for the zones we care about because they are global zones that
  will never be destroyed.

3 years agokernel - Refactor exis_terminate()
Matthew Dillon [Mon, 22 Mar 2021 05:14:29 +0000 (22:14 -0700)]
kernel - Refactor exis_terminate()

* Change exis_terminate() to set the EXIS lock into a CACHED(0) state
  unconditionally, meaning that in one pseudo tick it will wind up
  in NOTCACHED and in two pseudo_ticks it will wind up in the
  TERMINATE (freeable) state.

  This is less confusing, and allows EXIS locks in their simplest form.
  We can add other inlines to perform more nuanced operations.

3 years agokernel - Use kmalloc_obj for more zones - step 1b
Matthew Dillon [Mon, 22 Mar 2021 01:50:49 +0000 (18:50 -0700)]
kernel - Use kmalloc_obj for more zones - step 1b

* Use kmalloc_obj for M_FILE (struct file).

* Use kmalloc_obj for hammer2_io structures.

* Use kmalloc_obj for nfsnode structures, and make it per-mount.

  I don't know if its a good idea to make it per-mount or not.
  As the number of nodes is limited by kern.maxvnodes, it might
  be better to have a global M_NFSNODE kmalloc_obj zone instead
  of a per-mount one.

  (same goes with hammer2_io and hammer2_inode, which are also
  per-mount atm).

3 years agokernel - Add kmalloc_obj subsystem step 1a
Matthew Dillon [Mon, 22 Mar 2021 00:10:38 +0000 (17:10 -0700)]
kernel - Add kmalloc_obj subsystem  step 1a

* Cleanup for LINT64 build

3 years agokernel - Add kmalloc_obj subsystem step 1
Matthew Dillon [Sun, 21 Mar 2021 18:48:26 +0000 (11:48 -0700)]
kernel - Add kmalloc_obj subsystem  step 1

* Implement per-zone memory management to kmalloc() in the form of
  kmalloc_obj() and friends.  Currently the subsystem uses the same
  malloc_type structure but is otherwise distinct from the normal
  kmalloc(), so to avoid programming mistakes the *_obj() subsystem
  post-pends '_obj' to malloc_type pointers passed into it.

  This mechanism will eventually replace objcache.  This mechanism is
  designed to greatly reduce fragmentation issues on systems with long
  uptimes.

  Eventually the feature will be better integrated and I will be able
  to remove the _obj stuff.

* This is a object allocator, so the zone must be dedicated to one
  type of object with a fixed size.  All allocations out of the zone
  are of the object.

  The allocator is not quite type-stable yet, but will be once existential
  locks are integrated into the freeing mechanism.

* Implement a mini-slab allocator for management.  Since the zones are
  single-object, similar to objcache, the fixed-size mini-slabs are a
  lot easier to optimize and much simpler in construction than the
  main kernel slab allocator.

  Uses a per-zone/per-cpu active/alternate slab with an ultra-optimized
  allocation path, and a per-zone partial/full/empty list.

  Also has a globaldata-based per-cpu cache of free slabs.  The mini-slab
  allocator frees slabs back to the same cpu they were originally
  allocated from in order to retain memory locality over time.

* Implement a passive cleanup poller.  This currently polls kmalloc zones
  very slowly looking for excess full slabs to release back to the global
  slab cache or the system (if the global slab cache is full).

  This code will ultimately also handle existential type-stable freeing.

* Fragmentation is greatly reduced due to the distinct zones.  Slabs are
  dedicated to the zone and do not share allocation space with other zones.
  Also, when a zone is destroyed, all of its memory is cleanly disposed
  of and there will be no left-over fragmentation.

* Initially use the new interface for the following.  These zones
  tend to or can become quite big:

  vnodes
  namecache (but not related strings)
  hammer2 chains
  hammer2 inodes
  tmpfs nodes
  tmpfs dirents (but not related strings)

3 years agokernel - Fix /dev/fd/N and clean up the old dup error-code-driven path
Matthew Dillon [Sat, 20 Mar 2021 02:27:11 +0000 (19:27 -0700)]
kernel - Fix /dev/fd/N and clean up the old dup error-code-driven path

* When opening /dev/fd/N, replicate the file pointer for descriptors
  that represent vnodes instead of dup()ing.  This ensures that the seek
  offset and other fp-related elements are not shared unexpectedly.

* Refactor the open() path to allow dev_dopen() to replace the
  struct file by passing a struct file ** instead of a struct file *.
  This removes old error-code-based hacks.

* This fixes the shared seek position that fexecve() was operating with
  due to its use of /dev/fd/N for scripts.

Reported-by: aly
3 years agopciconf(8): Do actually enable the -e and -B options.
Sascha Wildner [Sun, 21 Mar 2021 17:28:41 +0000 (18:28 +0100)]
pciconf(8): Do actually enable the -e and -B options.

Handling them was added in d650e2183cf9557d58c726150ef990202fc85b98 but
for some reason they were neither added to getopt() nor documented.

Documentation was taken from FreeBSD.

3 years agoching(6): Fix typo.
Sascha Wildner [Sun, 21 Mar 2021 07:51:36 +0000 (08:51 +0100)]
ching(6): Fix typo.

3 years agoedk2: Fix some comment typos in a header (syncs with edk2-stable202102).
Sascha Wildner [Sat, 20 Mar 2021 01:45:34 +0000 (02:45 +0100)]
edk2: Fix some comment typos in a header (syncs with edk2-stable202102).

3 years agobnx: Support 57764, 57767 and 57787
Sepherosa Ziehau [Fri, 19 Mar 2021 14:48:09 +0000 (22:48 +0800)]
bnx: Support 57764, 57767 and 57787

Obtained-from: tg3
68273712a19e9107a498a371532b3b3eb6dbb14c

3 years agobnx: Prevent UDP fragments be routed to APE on 5762.
Sepherosa Ziehau [Fri, 19 Mar 2021 14:22:07 +0000 (22:22 +0800)]
bnx: Prevent UDP fragments be routed to APE on 5762.

Obtained-from: tg3
378b72c873b4828cde5b4bc85c7029d98f8f1df4

3 years agoFix some wrong #else/#endif comments in various <sys/*.h> headers.
Sascha Wildner [Thu, 18 Mar 2021 20:06:41 +0000 (21:06 +0100)]
Fix some wrong #else/#endif comments in various <sys/*.h> headers.

3 years ago<sys/time.h>: Use standard integer types. Also, fix a comment.
Sascha Wildner [Thu, 18 Mar 2021 19:29:24 +0000 (20:29 +0100)]
<sys/time.h>: Use standard integer types. Also, fix a comment.

3 years ago<sys/sbuf.h>: Include <sys/cdefs.h> and <sys/types.h> for self sufficiency.
Sascha Wildner [Thu, 18 Mar 2021 19:28:41 +0000 (20:28 +0100)]
<sys/sbuf.h>: Include <sys/cdefs.h> and <sys/types.h> for self sufficiency.

3 years ago<sys/cpuctl.h> Include <sys/types.h> for int types.
Sascha Wildner [Thu, 18 Mar 2021 16:05:42 +0000 (17:05 +0100)]
<sys/cpuctl.h> Include <sys/types.h> for int types.

3 years ago<sys/cpu_topology.h> Include <sys/param.h> for int types and MAXCPU.
Sascha Wildner [Thu, 18 Mar 2021 16:05:19 +0000 (17:05 +0100)]
<sys/cpu_topology.h> Include <sys/param.h> for int types and MAXCPU.

While here, add our copyright.

3 years agobnx: Fix potential hardware uninitialized TX DMA length registers.
Sepherosa Ziehau [Thu, 18 Mar 2021 15:05:27 +0000 (23:05 +0800)]
bnx: Fix potential hardware uninitialized TX DMA length registers.

It can only happen on 5719 and 5720.

Obtained-from: tg3
091f0ea30074bc43f9250961b3247af713024bc6
9bc297ea0622bb2a6b3abfa2fa84f0a3b86ef8c8

3 years agoUpdate the pciconf(8) database.
Sascha Wildner [Thu, 18 Mar 2021 07:00:46 +0000 (08:00 +0100)]
Update the pciconf(8) database.

March 11, 2021 snapshot from https://pci-ids.ucw.cz

3 years agobnx: Fix comment.
Sepherosa Ziehau [Tue, 9 Mar 2021 13:17:30 +0000 (21:17 +0800)]
bnx: Fix comment.

3 years agotcp: Remove debug prints.
Sepherosa Ziehau [Wed, 17 Mar 2021 14:58:01 +0000 (22:58 +0800)]
tcp: Remove debug prints.

Reported-by: peeterm
3 years agood(1): Fix alignment issue in long double (-t fL) output
Aaron LI [Tue, 16 Mar 2021 09:36:26 +0000 (17:36 +0800)]
od(1): Fix alignment issue in long double (-t fL) output

Long double has one more digit in the exponential besides the longer
fractional digits.  So the output width should be LDBL_DIG+9.  While
there, improve the width calculation for all float types.

In addition, minor style tweaks.

3 years agood(1): Fix long ints (L) format output on x86_64 platform
dczheng [Mon, 15 Mar 2021 17:11:04 +0000 (17:11 +0000)]
od(1): Fix long ints (L) format output on x86_64 platform

Long ints are of size 8 bytes on x86_64 platform, and the handle of
8-byte integers was missing in od(1)/hexdump(1).  So using '-t [doux]L'
(long ints) options in od(1) resulted in error:

od: d: bad byte count

Update the parse code to handle 8-byte long integers to fix it, and
update odformatint() to correctly calculate the digits.
In addition, fix the type error of 's8' (int8_t -> int64_t) in print(),
otherwise, long ints are truncated and get wrong.

Reported-by: swildner
3 years agodrm - Fix drm_modeset_unlock() panic
Matthew Dillon [Mon, 15 Mar 2021 04:37:00 +0000 (21:37 -0700)]
drm - Fix drm_modeset_unlock() panic

* Fix a bug in drm_modeset_lock() which sometimes improperly returned
  success when the ww mutex actually failed.

* This should fix a panic in the related drm_modeset_unlock() code
  that complains about unlocking a lock that isn't being held.

3 years agoFix some minor issues in various headers for self sufficiency.
Sascha Wildner [Sun, 14 Mar 2021 22:49:33 +0000 (23:49 +0100)]
Fix some minor issues in various headers for self sufficiency.

* <netgraph/ksocket/ng_ksocket.h>, <netgraph7/ksocket/ng_ksocket.h> and
  <rpc/auth.h>: Include <sys/types.h> because <sys/socket.h> no longer
  brings it in.

* <sys/sysunion.h>: Include <sys/sysproto.h> for struct <syscall>_args
  definitions.

3 years agoworld: Add <byteswap.h> compat header.
zrj [Sun, 14 Mar 2021 09:31:45 +0000 (09:31 +0000)]
world: Add <byteswap.h> compat header.

 This header is to reduce porting efforts in ports.
 Once codebases move to common <endian.h> use <machine/endian.h> for the
 __bswapXY() definitions.

3 years ago<machine/endian.h>: Use __builtin_bswapXY function if c++.
zrj [Sun, 14 Mar 2021 09:31:44 +0000 (09:31 +0000)]
<machine/endian.h>: Use __builtin_bswapXY function if c++.

 There builtins seem to be supported since gcc 4.8.  In theory we could
 use them for C code too, but for now limit this to c++ so to help
 compilers to deal with fun what is constexpr, lambdas, templates, etc.
 Generally, this reduces amount of debug code created through the
 __word_swap_foo() expansions too.

 Note: g++8 implements __word_swap_foo_var() with a bit different asm.

3 years ago<sys/endian.h>: Prefer double underscore versions.
zrj [Sun, 14 Mar 2021 09:31:41 +0000 (09:31 +0000)]
<sys/endian.h>: Prefer double underscore versions.

3 years agokernel: Include <sys/types.h> directly.
zrj [Sun, 14 Mar 2021 09:31:40 +0000 (09:31 +0000)]
kernel: Include <sys/types.h> directly.

 Do not rely on <sys/endian.h> to bring in all needed integer types.

3 years agolibstand: Move H and L macros were they are used.
zrj [Sun, 14 Mar 2021 09:31:39 +0000 (09:31 +0000)]
libstand: Move H and L macros were they are used.

 Avoid possible issues where plain "L" is used for unicode strings.

3 years ago<sys/endian.h>: Unify _QUAD_*WORD macros.
zrj [Sun, 14 Mar 2021 09:31:38 +0000 (09:31 +0000)]
<sys/endian.h>: Unify _QUAD_*WORD macros.

Taken-from: NetBSD

3 years ago<machine/endian.h>: Provide userland double underscore endianess variants.
zrj [Sun, 14 Mar 2021 09:31:37 +0000 (09:31 +0000)]
<machine/endian.h>: Provide userland double underscore endianess variants.

 For compatibility with GNU userland in ports.

3 years agosys/vfs/hammer2: Add break; (not a bug)
Tomohiro Kusumi [Sun, 14 Mar 2021 12:05:39 +0000 (21:05 +0900)]
sys/vfs/hammer2: Add break; (not a bug)

3 years agokillall.1: Mention pkill(1)
Aaron LI [Fri, 12 Mar 2021 01:26:05 +0000 (09:26 +0800)]
killall.1: Mention pkill(1)

While there, group the -h, -? and -help options together so it looks
clearer.

3 years agokillall(1): Handle -h and -? options as described in man page
dczheng [Thu, 11 Mar 2021 23:33:40 +0000 (23:33 +0000)]
killall(1): Handle -h and -? options as described in man page

As described in its man page, options -h and -? are supported to print
the help text, same as -help option.  However, it didn't work and
killall(1) gave such errors:

killall: unknown signal h; valid signals: ...
killall: unknown signal ?; valid signals: ...

While there, update usage text to match the supported options.

3 years agopkill(1): Add option -T to restrict to current terminal
Levente Kurusa [Tue, 4 Dec 2018 22:07:52 +0000 (23:07 +0100)]
pkill(1): Add option -T to restrict to current terminal

This option is introduced for feature parity with killall(1) where it
restricts to matching processes in the current terminal by specifying
the -T option.  While this is achievable via pkill(1)'s -t option, for
feature parity and convenience, this commit implements the -T option.

Signed-off-by: Levente Kurusa <lkurusa@kernelstuff.org>
(aly)
I've reviewed and revised the original patch:
* Adjust the option orders in code and in the man page.
* Check and copy the return of ttyname(), which can be NULL and is a
  internal static buffer.
* Make option '-t' accept a full path to the terminal device.  This
  simplifies the code by avoiding the strip of "/dev/".  Meanwhile
  update the man page accordingly.
* Fix some minor issues in the original patch.

DragonFly-bug: #3163

3 years agodrm - Hack around a drm_setmaster issue
Matthew Dillon [Tue, 9 Mar 2021 22:07:29 +0000 (14:07 -0800)]
drm - Hack around a drm_setmaster issue

* Currently the first-open automatically sets master.  A later attempt
  to issue the drm_set_master ioctl then fails because it is already set.

  It is unclear whether linux automatically sets master on first open
  or not, and quickly hacking that to not results in unhappiness, so...

* For now, just allow the master to be overridden by the ioctl.  And
  throw in some additional kprintf()s to help with debugging.

* Fixes the setDrmMaster error message on X startup and allows X
  to start.

3 years agoethernet: Add AF_ARP support.
Sepherosa Ziehau [Tue, 9 Mar 2021 14:38:44 +0000 (22:38 +0800)]
ethernet: Add AF_ARP support.

Bump __DragonFly_version.

Submitted-by: dillon@ (minor changes from me)
Obtained-from: NetBSD

3 years ago<timeconv.h>: Stop including <sys/types.h>. <machine/stdint.h> is enough.
Sascha Wildner [Tue, 9 Mar 2021 09:15:56 +0000 (10:15 +0100)]
<timeconv.h>: Stop including <sys/types.h>. <machine/stdint.h> is enough.

3 years ago<sys/procctl.h>: Add missing __BEGIN_DECLS/__END_DECLS.
Sascha Wildner [Tue, 9 Mar 2021 04:57:01 +0000 (05:57 +0100)]
<sys/procctl.h>: Add missing __BEGIN_DECLS/__END_DECLS.

Needed by x11-wm/gamescope.

Reported-by: zrj
3 years agolibpthread: Implement pthread_getname_np() and pthread_setname_np().
Sascha Wildner [Mon, 8 Mar 2021 18:34:42 +0000 (19:34 +0100)]
libpthread: Implement pthread_getname_np() and pthread_setname_np().

Varieties of pthread_get_name_np() and pthread_set_name_np() that return
an integer (0 or error number).

These are only used for debugging but it looks like some ports want them.

I took some of the documentation from FreeBSD.

Reported-by: zrj
3 years agolibpthread: Separate the MLINKS better.
Sascha Wildner [Mon, 8 Mar 2021 07:30:23 +0000 (08:30 +0100)]
libpthread: Separate the MLINKS better.

3 years agosbin/mount_hammer2: Minor cleanup
Tomohiro Kusumi [Sun, 7 Mar 2021 13:13:12 +0000 (22:13 +0900)]
sbin/mount_hammer2: Minor cleanup

3 years ago<ifaddrs.h>: Clean it up a bit.
Sascha Wildner [Fri, 5 Mar 2021 16:28:55 +0000 (17:28 +0100)]
<ifaddrs.h>: Clean it up a bit.

* Include the necessary headers to make it self sufficient.

* Move <sys/cdefs.h> to the top.

* Remove 'extern' from prototypes.

Reported-by: zrj (broke devel/kiwix-lib)
3 years agounzip: Remove duplicate brace.
Sascha Wildner [Wed, 3 Mar 2021 16:57:37 +0000 (17:57 +0100)]
unzip: Remove duplicate brace.

3 years agohammer2 - Fix rename-over-non-empty-directory bug
Matthew Dillon [Mon, 1 Mar 2021 20:02:01 +0000 (12:02 -0800)]
hammer2 - Fix rename-over-non-empty-directory bug

* hammer2 was allowing renames to replace non-empty directories.
  Fix by disallowing the case.

Reported-by: zrj
3 years agomount - Do not exit with an error if mountd cannot be signaled
Matthew Dillon [Mon, 1 Mar 2021 19:59:16 +0000 (11:59 -0800)]
mount - Do not exit with an error if mountd cannot be signaled

* The mount program signals mountd to re-test exports.  Do not exit
  with an error if the kill(... SIGUSR1) system call fails.

3 years agox86_64/atomic: Fix comment of testand{clear,set}_long comment.
Sepherosa Ziehau [Mon, 1 Mar 2021 13:19:17 +0000 (21:19 +0800)]
x86_64/atomic: Fix comment of testand{clear,set}_long comment.

3 years agocgram(6): Sync with NetBSD
Aaron LI [Wed, 24 Feb 2021 14:16:45 +0000 (22:16 +0800)]
cgram(6): Sync with NetBSD

* Properly handle input errors from child fortune(6) process.
* Add advanced cursor movement with tab, shift+tab, return.
* Fix the assertion issue in another way as in commit
  18d09f18cf4c93d9a07b8129fed0bdc0d0b967a7.
* Make the '*solved*' marker stand out more (suggested by me).
* Place the '*solved*' marker nearer to the text.
* Don't beep if the window is resized.

3 years agoutimensat.2: Fix the description of EINVAL.
Sascha Wildner [Mon, 1 Mar 2021 13:44:18 +0000 (14:44 +0100)]
utimensat.2: Fix the description of EINVAL.

Reported-by: zrj
Taken-from:  FreeBSD

3 years agoRemove last bits of Intel compiler support. We never had or cared about it.
Sascha Wildner [Sun, 28 Feb 2021 13:15:30 +0000 (14:15 +0100)]
Remove last bits of Intel compiler support. We never had or cared about it.

FreeBSD removed theirs too, a while ago. Our remains were just inherited.

3 years agoClean up the POSIX namespace in <unistd.h> and <sys/socket.h>.
Sascha Wildner [Sun, 28 Feb 2021 11:13:57 +0000 (12:13 +0100)]
Clean up the POSIX namespace in <unistd.h> and <sys/socket.h>.

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

3 years agoliblzma: Add a liblzma.pc file for the benefit of dports.
Sascha Wildner [Sun, 28 Feb 2021 10:03:37 +0000 (11:03 +0100)]
liblzma: Add a liblzma.pc file for the benefit of dports.

Reported-by: zrj
3 years agoFix -Wundef in some code imported from NetBSD.
Sascha Wildner [Sat, 27 Feb 2021 11:57:23 +0000 (12:57 +0100)]
Fix -Wundef in some code imported from NetBSD.

3 years agolibc: Attempt to execute new atexit() destructors during __cxa_finalize().
zrj [Thu, 25 Feb 2021 03:15:49 +0000 (03:15 +0000)]
libc: Attempt to execute new atexit() destructors during __cxa_finalize().

 Some c++ programs might and do register new destructors from other
 destructors.  Try to handle such cases by relooping scan upto
 CXA_DTORS_ITERATIONS times (like what _thread_finalize() does) if new
 destructors get added even if that will not strictly match LIFO order.

3 years agoLINT64: Comment out an option to cover more code.
Sascha Wildner [Wed, 24 Feb 2021 19:23:36 +0000 (20:23 +0100)]
LINT64: Comment out an option to cover more code.