dragonfly.git
4 years agogdb(1): Explicitly include <stdint.h>.
zrj [Sat, 1 Feb 2020 12:21:18 +0000 (14:21 +0200)]
gdb(1): Explicitly include <stdint.h>.

4 years agolibc - Update for realpath() system call support
Matthew Dillon [Sun, 2 Feb 2020 01:34:30 +0000 (17:34 -0800)]
libc - Update for realpath() system call support

* The realpath() implementation now checks to see if the system call
  is available and uses it.

* getosreldate() now caches the result to avoid multiple sysctl()
  calls.

* Add the new system calls (__realpath and getrandom()) to the symbol
  list.

4 years agokernel - Add __realpath() and getrandom() system calls
Matthew Dillon [Sun, 2 Feb 2020 01:30:28 +0000 (17:30 -0800)]
kernel - Add __realpath() and getrandom() system calls

* Add a kernel __realpath() system call.  libc must still implement
  the realpath() function to handle NULL buffers (malloc()d buffer
  returned).

  The libc implementation checks the osversion for backwards compatibility
  before attempting to use the new system call.

* Add a kernel getrandom() system call.

* Bump __DragonFly_version to 500710.

Suggested-by: tuxillo, mjg
4 years agoenv(1): Match glibc getopt() semantics.
zrj [Sat, 1 Feb 2020 11:52:57 +0000 (13:52 +0200)]
env(1): Match glibc getopt() semantics.

 Move '-' to the end of opstring since position within opstring is not
 meaningful.

Taken-from: OpenBSD

4 years agoxargs(1): Disable prompt support (-p) in btools.
zrj [Sat, 1 Feb 2020 11:49:48 +0000 (13:49 +0200)]
xargs(1): Disable prompt support (-p) in btools.

 Not needed and helps with bootstrapping on different OS.

4 years agoxargs(1): Add limit for args_max.
zrj [Sat, 1 Feb 2020 11:48:37 +0000 (13:48 +0200)]
xargs(1): Add limit for args_max.

 Current logic does not handle cases where args_max > int32_t limit.

4 years agotr(1): Fix compilation on Linux hosts.
zrj [Sat, 1 Feb 2020 11:46:01 +0000 (13:46 +0200)]
tr(1): Fix compilation on Linux hosts.

4 years agodd(1): Allow to bootstrap on OpenBSD and glibc based systems.
zrj [Sat, 1 Feb 2020 11:41:24 +0000 (13:41 +0200)]
dd(1): Allow to bootstrap on OpenBSD and glibc based systems.

 Disable tape detection support (reduces host requirements).
 Redirect siginfo to SIGUSR1 to match dd behavior on glibc systems.

4 years agotime(1): Disable -l support in btools.
zrj [Sat, 1 Feb 2020 11:36:03 +0000 (13:36 +0200)]
time(1): Disable -l support in btools.

 This removes kinfo(3) requirement to bootstrap time(1) on OpenBSD.

4 years agotime(1): Install signal handle only if SIGINFO is available.
zrj [Sat, 1 Feb 2020 11:30:14 +0000 (13:30 +0200)]
time(1): Install signal handle only if SIGINFO is available.

 While there, adjust needed headers and remove few trailing whitespaces.

4 years agowc(1): Install signal handler only if SIGINFO is available.
zrj [Sat, 1 Feb 2020 11:25:19 +0000 (13:25 +0200)]
wc(1): Install signal handler only if SIGINFO is available.

 Allows to bootstrap on glibc based systems.

4 years agotail(1): Disable -f and -F (follow) functionality in btools.
zrj [Sat, 1 Feb 2020 11:21:27 +0000 (13:21 +0200)]
tail(1): Disable -f and -F (follow) functionality in btools.

 Allows to bootstrap on OpenBSD (no kevent support).

4 years agopatch(1): Check for _DIRENT_HAVE_D_NAMLEN availability.
zrj [Sat, 1 Feb 2020 11:17:51 +0000 (13:17 +0200)]
patch(1): Check for _DIRENT_HAVE_D_NAMLEN availability.

4 years agosh(1): Check for _DIRENT_HAVE_D_NAMLEN availability.
zrj [Sat, 1 Feb 2020 11:16:43 +0000 (13:16 +0200)]
sh(1): Check for _DIRENT_HAVE_D_NAMLEN availability.

 To allow bootstrapping on OpenBSD.

4 years agostrfile(8): Include <stdint.h> explicitly.
zrj [Sat, 1 Feb 2020 11:15:11 +0000 (13:15 +0200)]
strfile(8): Include <stdint.h> explicitly.

4 years agolibc/citrus: Include <stdint.h> explicitly.
zrj [Sat, 1 Feb 2020 11:13:45 +0000 (13:13 +0200)]
libc/citrus: Include <stdint.h> explicitly.

4 years agolocaledef(1): Allow easier bootstrapping.
zrj [Sat, 1 Feb 2020 11:11:26 +0000 (13:11 +0200)]
localedef(1): Allow easier bootstrapping.

 Solves issue when bootstrapping on OpenBSD.

4 years agolorder(1): Use POSIX defined flags for sort(1).
zrj [Sat, 1 Feb 2020 11:07:44 +0000 (13:07 +0200)]
lorder(1): Use POSIX defined flags for sort(1).

 While there, add -s to ensure stable sort (commonly available).

 No functional change.

4 years agoworld: Pass relative location of sys/ to newvers.sh as argument.
zrj [Sat, 1 Feb 2020 11:05:03 +0000 (13:05 +0200)]
world: Pass relative location of sys/ to newvers.sh as argument.

 Location is known at invoke time and avoids issue where <osreldate.h>
 might not be properly populated when building on OpenBSD host.

4 years agotaskqueue: Fix the order of TASKQUEUE_DEFINE_THREAD
Sepherosa Ziehau [Fri, 31 Jan 2020 11:57:05 +0000 (19:57 +0800)]
taskqueue: Fix the order of TASKQUEUE_DEFINE_THREAD

So it can be used by drivers.

4 years agosound/hda: Use driver specific taskqueue, instead of per-cpu taskqueue
Sepherosa Ziehau [Fri, 31 Jan 2020 10:45:31 +0000 (18:45 +0800)]
sound/hda: Use driver specific taskqueue, instead of per-cpu taskqueue

This driver is not per-cpu ready, so don't user per-cpu taskqueue,
which causes assertion during taskqueue_enqueue.  Instead use driver
specific taskqueue.

4 years agotaskqueue: Fix TASKQUEUE_DEFINE_THREAD
Sepherosa Ziehau [Fri, 31 Jan 2020 10:44:53 +0000 (18:44 +0800)]
taskqueue: Fix TASKQUEUE_DEFINE_THREAD

4 years agohammer2 - Fix inode & chain limits, improve flush pipeline.
Matthew Dillon [Thu, 30 Jan 2020 23:40:01 +0000 (15:40 -0800)]
hammer2 - Fix inode & chain limits, improve flush pipeline.

* Reorganize VFS_MODIFYING() to avoid certain deadlock conditions and
  adjust hammer2 to unconditionally stall in VFS_MODIFYING() when dirty
  limits are exceeded.

  Make sure VFS_MODIFYING() is called in all appropriate filesystem-
  modifying paths.

  This ensures that inode and chain structure allocation limits are
  adhered to.

* Fix hammer2's wakeup code for the dirty inode count hystereis.  This
  fixes a situation where stalls due to excessive dirty inodes were waiting
  a full second before resuming operation based on the dirty count
  hysteresis.

  The hysteresis now works as intended:

  (1) Trigger a sync when the dirty count reache 50% N.
  (2) Stall the frontend when the dirty count reaches 100% N.
  (3) Resume the frontend when the diirty count drops to 66% N.

* Fix trigger_syncer() to guarantee that the syncer will flush the
  filesystem ASAP when called.  If the filesystem is already in a flush,
  it will be flushed again.

  Previously if the filesystem was already in a flush it would wait one
  second before flushing again, which significantly reduces performance
  under conditions where the dirty chain limit or the dirty inode limit is
  constantly being hit (e.g. chown -R, etc).

Reported-by: tuxillo
4 years agokernel - Document UPREQ and EXREQ cases better
Matthew Dillon [Wed, 29 Jan 2020 17:59:51 +0000 (09:59 -0800)]
kernel - Document UPREQ and EXREQ cases better

* Do a better job documenting responsibilities for UPREQ and EXREQ.

4 years agolibfetch: Fix buffer overflow (CVE-2020-7450)
Antonio Huete Jimenez [Wed, 29 Jan 2020 16:52:50 +0000 (17:52 +0100)]
libfetch: Fix buffer overflow (CVE-2020-7450)

  - A remote attacker, who can supply a malicious URL to the application
    that uses libfetch(3), can trigger memory corruption and execute arbitrary
    code on the target system.
  - FreeBSD-SA-20:01.libfetch

Submitted-by: bapt, emaste
4 years agodaemon(8): Sync with FreeBSD. Some ports need options we didn't have.
Sascha Wildner [Wed, 29 Jan 2020 16:46:49 +0000 (17:46 +0100)]
daemon(8): Sync with FreeBSD. Some ports need options we didn't have.

Mainly for -T, see https://github.com/DragonFlyBSD/DeltaPorts/issues/914

Most of the changes revolve around supporting logging the program's
output with syslog(3).

Reported-by: kworr
Taken-from:  FreeBSD

4 years agodsynth - Hack elfinfo note output a bit
Matthew Dillon [Tue, 28 Jan 2020 18:29:22 +0000 (10:29 -0800)]
dsynth - Hack elfinfo note output a bit

* The elf info is a bit of a hack and typically contains two
  note structures, but only one has the version.  The other typically
  has zero for the version field.

* The structures in the .note section can sometimes be transposed,
  so allow the case by testing to see if version is 0 and using the
  second structure's version if it is.

Reported-by: Romick
4 years agolockmgr - Fix bug in lockmgr() cancel path
Matthew Dillon [Mon, 27 Jan 2020 23:00:20 +0000 (15:00 -0800)]
lockmgr - Fix bug in lockmgr() cancel path

* Fix a bug in the lockmgr() cancel path where a cancelable blocked
  exclusive lock is not canceled.  The EXREQ2 bit must be tested in
  addition to EXREQ, as it is possible for EXREQ to be clear when
  EXREQ2 is set.

* Fixes a situation where the usb path could deadlock a softclock
  cpu thread, causing a cascade of issues on that cpu.

4 years agokernel/atkbdc: Remove some dead code.
Sascha Wildner [Mon, 27 Jan 2020 15:17:44 +0000 (16:17 +0100)]
kernel/atkbdc: Remove some dead code.

4 years agophantasia(6)/dsynth(1): Add two missing DPADD definitions.
Sascha Wildner [Sun, 26 Jan 2020 19:14:32 +0000 (20:14 +0100)]
phantasia(6)/dsynth(1): Add two missing DPADD definitions.

4 years agolibc - Check for invalid context in setcontext() and swapcontext()
Matthew Dillon [Sat, 25 Jan 2020 23:44:57 +0000 (15:44 -0800)]
libc - Check for invalid context in setcontext() and swapcontext()

* Check for an invalid context in setcontext() and swapcontext()
  and return -1 instead of switching to the invalid context.

* This is not an exhaustive check but will handle invalid states set
  by makecontext() if e.g. argc is messed up or the supplied stack is
  too small.  In particular, if makecontext() fails and set/swap tries
  to switch to it, it will switch to the state from the getcontext()
  prior to the makecontext() instead of to the desired makecontext()
  state.

Reported-by: zrj, tuxillo
4 years agokernel/vga: Sort I/O port addresses in vgareg.h.
Sascha Wildner [Sat, 25 Jan 2020 20:41:40 +0000 (21:41 +0100)]
kernel/vga: Sort I/O port addresses in vgareg.h.

4 years agorc.d/root: Fix return code that I broke in November.
Sascha Wildner [Sat, 25 Jan 2020 01:03:49 +0000 (02:03 +0100)]
rc.d/root: Fix return code that I broke in November.

After f304a32950ea980273aabeb3a194836fbb8471d2, the umount ended up
being the last command in root_start(), but it is expected to
return a non-zero status.

Fix this by inserting a return 0.

4 years agokernel/ntfs: Fix lockinit() flags.
Sascha Wildner [Fri, 24 Jan 2020 22:17:24 +0000 (23:17 +0100)]
kernel/ntfs: Fix lockinit() flags.

4 years agokernel - Fix missing lock in devfs
Matthew Dillon [Fri, 24 Jan 2020 22:02:30 +0000 (14:02 -0800)]
kernel - Fix missing lock in devfs

* The master devfs lock must be held across a devfs_reference_ops()
  call.

* Should fix races and panics related to fast device creation and
  deletion (typically only triggered by dsynth's use of pty's).

Reported-by: zrj, multiple
4 years agodrm: Fix lockinit() calls in previous commit
François Tigeot [Fri, 24 Jan 2020 21:00:04 +0000 (22:00 +0100)]
drm: Fix lockinit() calls in previous commit

LK_EXCLUSIVE is a lockmgr() argument, not a lockinit() one.

4 years agodrm: Replace all Linux spinlocks by lockmgr locks
François Tigeot [Fri, 24 Jan 2020 19:51:08 +0000 (20:51 +0100)]
drm: Replace all Linux spinlocks by lockmgr locks

* The DragonFly kernel can sleep in different circumstances than Linux

* Linux driver code has not been written to prevent it

* Make all Linux spinlock_t spinlocks lockmgr locks and avoid potential
  problems once and for all

4 years agodrm: Pass CRTC ID in userspace vblank events
Peeter Must [Thu, 23 Jan 2020 08:43:48 +0000 (10:43 +0200)]
drm: Pass CRTC ID in userspace vblank events

* Add DRM_CAP_CRTC_IN_VBLANK_EVENT so userspace can
  query the crtc field.

* This follows Linux's commit
  5db06a8a98f515f67446a69c57577c4c363ec65d.

4 years agolibutil: Fix some weird indentation.
Sascha Wildner [Wed, 22 Jan 2020 19:41:37 +0000 (20:41 +0100)]
libutil: Fix some weird indentation.

4 years agomtest(8): Fix two -Wunused-parameter warnings and raise WARNS to 6.
Sascha Wildner [Wed, 22 Jan 2020 18:04:34 +0000 (19:04 +0100)]
mtest(8): Fix two -Wunused-parameter warnings and raise WARNS to 6.

4 years agoifmcstat(8): Fix a -Wshadow and raise WARNS to 6.
Sascha Wildner [Wed, 22 Jan 2020 18:00:55 +0000 (19:00 +0100)]
ifmcstat(8): Fix a -Wshadow and raise WARNS to 6.

4 years agopflogd(8): Fix a duplicate prototype and raise WARNS to 6.
Sascha Wildner [Wed, 22 Jan 2020 17:33:10 +0000 (18:33 +0100)]
pflogd(8): Fix a duplicate prototype and raise WARNS to 6.

4 years agoLocal changes for the flex upgrade.
Sascha Wildner [Sun, 19 Jan 2020 10:59:28 +0000 (11:59 +0100)]
Local changes for the flex upgrade.

4 years agoMerge branch 'vendor/FLEX'
Sascha Wildner [Sun, 19 Jan 2020 10:25:39 +0000 (11:25 +0100)]
Merge branch 'vendor/FLEX'

4 years agoImport flex-2.6.4 to the vendor branch. vendor/FLEX
Sascha Wildner [Sun, 19 Jan 2020 10:06:36 +0000 (11:06 +0100)]
Import flex-2.6.4 to the vendor branch.

4 years ago[fish] require the user have the card they ask for
Eitan Adler [Sat, 18 Jan 2020 22:29:44 +0000 (22:29 +0000)]
[fish] require the user have the card they ask for

This bug was introduced in ef388479 by me.

Reported by: Matthew Kern <mkern@alconconstruction.com>

4 years agokernel - Fix indefinite wait buffer bug with encrypted disks
Matthew Dillon [Sat, 18 Jan 2020 17:49:45 +0000 (09:49 -0800)]
kernel - Fix indefinite wait buffer bug with encrypted disks

* Preallocate all (nmax) mpipe buffers to avoid doing any large buffer
  allocations inside critical low-memory I/O paths.

* Remove the per-sector objcache, which could cause numerous blocking
  memory allocations in critical low-memory I/O paths.  Instead,
  pre-allocate all necessary data outside of the critical path.

  For now these per-sector structures are cached in a simple linked
  list with a single spin-lock (not ideal).

* Reorganize per-sector data into its own essiv_ivgen_data structure,
  Plus other minor cleanups.

* TODO - We need to queue the bio in the target_crypt_config structure
  instead of relying on mpipe_alloc_callback() which must still allocate
  a small structure via M_INTWAIT.

Reported-by: goleo, profmakx, daftaupe, others
4 years agorrenumd(8): Clean up the Makefile a bit wrt yacc(1) handling.
Sascha Wildner [Sat, 18 Jan 2020 01:08:09 +0000 (02:08 +0100)]
rrenumd(8): Clean up the Makefile a bit wrt yacc(1) handling.

* Remove -d because it is default.

* Remove a target and CLEANFILES handling for y.tab.h, it is all
  done in bsd.dep.mk.

* Add y.output to CLEANFILES when YACCDEBUG is specified.

4 years agoiasl(8): Remove -d from YFLAGS, it is default.
Sascha Wildner [Sat, 18 Jan 2020 01:07:17 +0000 (02:07 +0100)]
iasl(8): Remove -d from YFLAGS, it is default.

4 years agokernel - Reduce mpipe overhead
Matthew Dillon [Fri, 17 Jan 2020 21:01:42 +0000 (13:01 -0800)]
kernel - Reduce mpipe overhead

* Reduce unnecessary wakeups when an asynchronous mpipe_thread is
  employed.  The thread was setting a flag that caused all disposals
  to wake it up, even if it did not have any work.

4 years agokernel - Cleanup unused / redundant code
Matthew Dillon [Fri, 17 Jan 2020 21:01:15 +0000 (13:01 -0800)]
kernel - Cleanup unused / redundant code

* Cleanup some unused and redundant code left over from older
  works.

4 years ago<sys/syslimits.h>: FWIW, use __GNUC_PREREQ__().
Sascha Wildner [Fri, 17 Jan 2020 15:19:58 +0000 (16:19 +0100)]
<sys/syslimits.h>: FWIW, use __GNUC_PREREQ__().

4 years agoinstaller - Change default /build size
Matthew Dillon [Fri, 17 Jan 2020 04:39:12 +0000 (20:39 -0800)]
installer - Change default /build size

* /build was previously configured to use 1/3 of the drive,
  but was capped at roughly 20GB.  The cap doesn't really
  scale well on modern systems, particularly since /usr/obj
  and /var/crash are put on the /build partition.

* Remove the cap and change the configuration to use 1/4 of
  the drive instead of 1/3.

* Also make a number of other minor adjustments to ensure that
  space is not wasted in situations where swap and/or build
  would be too small for auto-configuration.

4 years agolibkvm - Fix 'ps' and 'fstat' on kernel cores
Matthew Dillon [Fri, 17 Jan 2020 02:36:36 +0000 (18:36 -0800)]
libkvm - Fix 'ps' and 'fstat' on kernel cores

* Fix 'ps' and 'fstat' on kernel cores by fixing the broken
  process list iteration code.

4 years agopsm - Fix memory corruption and panic in psm driver
Matthew Dillon [Thu, 16 Jan 2020 06:25:18 +0000 (22:25 -0800)]
psm - Fix memory corruption and panic in psm driver

* Fix two locations where pb->inputbytes might not get reset to
  0.  The main problem appears to be in psmsoftintr() where
  pb->inputbytes is not reset to 0 when mouse cases 'goto next',
  do being before the next: label instead of after the label.

Reported-by: noob237
4 years agohammer2 - Update manual page
Matthew Dillon [Wed, 15 Jan 2020 20:07:19 +0000 (12:07 -0800)]
hammer2 - Update manual page

* Update manual page to clarify how media data overwrite mode works.

  This is a long-standing feature in HAMMER2 that allows copy-on-write
  to be disabled on a file-by-file basis when overwriting existing data.

4 years agoacpi/pstate: Be lenient about the invalid PPC.
Sepherosa Ziehau [Wed, 15 Jan 2020 13:23:53 +0000 (21:23 +0800)]
acpi/pstate: Be lenient about the invalid PPC.

If the PPC is invalid, just start from the first P-state, which
normally has the highest frequency.

4 years agousr.sbin/fstyp: Remove redundant best_i check in HAMMER2
Tomohiro Kusumi [Tue, 14 Jan 2020 14:34:12 +0000 (23:34 +0900)]
usr.sbin/fstyp: Remove redundant best_i check in HAMMER2

Bring in HAMMER2 fix from FreeBSD.
best_i will always be >= 0.
https://reviews.freebsd.org/D23159

from freebsd/freebsd@bf17a6315052ebf1b19b547d422b9c204e840c66

4 years agousr.sbin/fstyp: Use strlcpy(3) for HAMMER1
Tomohiro Kusumi [Tue, 14 Jan 2020 14:30:09 +0000 (23:30 +0900)]
usr.sbin/fstyp: Use strlcpy(3) for HAMMER1

Bring in HAMMER1 fix from FreeBSD.
https://reviews.freebsd.org/D23159

from freebsd/freebsd@1e63e28754df7b70eb0c3ba496fde0145c2c0aaa

4 years agoMakefile.inc1: Add a missing '@' before an 'echo'.
Sascha Wildner [Mon, 13 Jan 2020 19:10:23 +0000 (20:10 +0100)]
Makefile.inc1: Add a missing '@' before an 'echo'.

4 years agoyacc(1): Define GCC_PRINTFLIKE in the Makefile.
Sascha Wildner [Mon, 13 Jan 2020 18:55:22 +0000 (19:55 +0100)]
yacc(1): Define GCC_PRINTFLIKE in the Makefile.

4 years agoSync ACPICA with Intel's version 20200110 (coming from 20190703).
Sascha Wildner [Mon, 13 Jan 2020 18:27:36 +0000 (19:27 +0100)]
Sync ACPICA with Intel's version 20200110 (coming from 20190703).

* Allow more OwnerId's to prevent OWNER_ID_LIMIT exceptions.

* Return a Buffer object for all fields created via CreateField.

* Add AcpiDispatchGpe() function.

* Exit the interpreter before initializing objects within a newly
  loaded table.

* Add new 'Fields' debugger command.

* Make AcpiLoadTable() return a table index and add AcpiUnloadTable().

* Fix acpinames(8) which was broken for some time.

* Added "Windows 2019" _OSI string.

* Various improvements to iasl(8).

* Fix some compilation warnings, fix missing ACPI_PRINTF_LIKE.

* Update copyrights to 2020.

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

4 years agosbin/fsck_msdosfs: Correct off-by-two issue when determining FAT type.
Tomohiro Kusumi [Mon, 13 Jan 2020 05:13:53 +0000 (14:13 +0900)]
sbin/fsck_msdosfs: Correct off-by-two issue when determining FAT type.

In the code we used NumClusters as the upper (non-inclusive) boundary
of valid cluster number, so the actual value was 2 (CLUST_FIRST) more
than the real number of clusters. This causes a FAT16 media with
65524 clusters be treated as FAT32 and might affect FAT12 media with
4084 clusters as well.

To fix this, we increment NumClusters by CLUST_FIRST after the type
determination.

from freebsd/freebsd@27b822d4d61893d02ca0bc7163fa323331c497fe

4 years agosbin/fsck_msdosfs: Apply typo fix from FreeBSD from NetBSD
Tomohiro Kusumi [Mon, 13 Jan 2020 05:01:53 +0000 (14:01 +0900)]
sbin/fsck_msdosfs: Apply typo fix from FreeBSD from NetBSD

from freebsd/freebsd@77000233cce907a5633e0b086a58086767674566

4 years agosbin/fsck_msdosfs: Require FAT to occupy at least one sector
Tomohiro Kusumi [Mon, 13 Jan 2020 05:01:07 +0000 (14:01 +0900)]
sbin/fsck_msdosfs: Require FAT to occupy at least one sector

from freebsd/freebsd@d705f2ff45142d43945572e5ff53166ae1ead1e2

4 years agosbin/fsck_msdosfs: Avoid mixing cluster numbers and sector numbers
Tomohiro Kusumi [Mon, 13 Jan 2020 04:55:58 +0000 (13:55 +0900)]
sbin/fsck_msdosfs: Avoid mixing cluster numbers and sector numbers

Makes code more readable.

from freebsd/freebsd@643521d9cba4f6b4717f042e6ce8bb0c71e5a3a0

4 years agodsynth - Fix prepare-system directive
Matthew Dillon [Mon, 13 Jan 2020 02:48:39 +0000 (18:48 -0800)]
dsynth - Fix prepare-system directive

* prepare-system was using 'pkg info -a -o' but this command does not
  conveniently list the flavors of installed packages, resulting in
  truncated origins and duplicates.

* Use a more complete 'pkg info -a -o -A' and parse the more sophisticated
  output.

* If some of the top-level packages no longer exist in dports (a common
  occurance), allow the user to choose to proceed with the build anyway.

Reported-by: xiwang
4 years agolibc: Improve nslexer.c generation using FLAGS_GROUPS.
Sascha Wildner [Sun, 12 Jan 2020 08:08:37 +0000 (09:08 +0100)]
libc: Improve nslexer.c generation using FLAGS_GROUPS.

Flex detects YY_BUF_SIZE being defined since some time so there is
no need anymore to sed it in the source.

4 years ago<sys/procctl.h>: Sync idtype_t comments with <sys/wait.h>.
Sascha Wildner [Fri, 10 Jan 2020 21:40:14 +0000 (22:40 +0100)]
<sys/procctl.h>: Sync idtype_t comments with <sys/wait.h>.

4 years agokernel - Fix ip6_setpktoptions() panic
Matthew Dillon [Fri, 10 Jan 2020 19:13:31 +0000 (11:13 -0800)]
kernel - Fix ip6_setpktoptions() panic

* Fix a panic in the control message processing for ipv6.  The loop
  could blow up if the last cmsg is not stored in an aligned number
  of bytes.

Reported-by: tuxillo
4 years agodrm/radeon: Use Linux memory-mapped IO functions
François Tigeot [Thu, 9 Jan 2020 15:29:50 +0000 (16:29 +0100)]
drm/radeon: Use Linux memory-mapped IO functions

Partially sync driver code with Linux 4.9

4 years agodrm/linux: Add readX() memory-mapped IO functions
François Tigeot [Thu, 9 Jan 2020 15:27:44 +0000 (16:27 +0100)]
drm/linux: Add readX() memory-mapped IO functions

They are meant to be used for accessing directly mapped device registers.

4 years agodrm/linux: Add pci_free_consistent()
François Tigeot [Wed, 8 Jan 2020 16:21:51 +0000 (17:21 +0100)]
drm/linux: Add pci_free_consistent()

4 years agodrm: Remove the gen-drm_pciids script
François Tigeot [Wed, 8 Jan 2020 10:41:20 +0000 (11:41 +0100)]
drm: Remove the gen-drm_pciids script

All drm drivers now directly use Linux PCI IDs descriptions

4 years agodsynth - Remove /etc/localtime from template
Matthew Dillon [Tue, 7 Jan 2020 19:15:45 +0000 (11:15 -0800)]
dsynth - Remove /etc/localtime from template

* Remove /etc/localtime from the template so all package builds
  occur with the default (GMT I think).

* Fixes at least one broken package.  Also so we are a little closer
  to the synth environment which also does not populate /etc/localtime.

Recommend-by: zrj
4 years agovmstat - Pull ncpus from kmem/core-image
Matthew Dillon [Tue, 7 Jan 2020 19:13:38 +0000 (11:13 -0800)]
vmstat - Pull ncpus from kmem/core-image

* Obtain ncpus from the specified kmem/core-image instead of
  from the current system via sysctl.

4 years agoworld: Introduce NO_INITRD option.
zrj [Tue, 7 Jan 2020 08:50:44 +0000 (10:50 +0200)]
world: Introduce NO_INITRD option.

 Sometimes it is useful to skip rebuilding initrd during development.

4 years agoshare/zoneinfo: Do not hardcode zic(8) install flags.
zrj [Tue, 7 Jan 2020 08:47:15 +0000 (10:47 +0200)]
share/zoneinfo: Do not hardcode zic(8) install flags.

 Will be used for unpriv builds.

4 years agoshare/terminfo: Use less generic variable name.
zrj [Tue, 7 Jan 2020 08:46:42 +0000 (10:46 +0200)]
share/terminfo: Use less generic variable name.

4 years agoMakefile: Use internal variable for setting PATH.
zrj [Tue, 7 Jan 2020 08:45:22 +0000 (10:45 +0200)]
Makefile: Use internal variable for setting PATH.

 Mainly to prevent double override PATH when invoking submakes.

4 years agoMakefile.inc1: Remove id(1) from btools.
zrj [Tue, 7 Jan 2020 08:32:35 +0000 (10:32 +0200)]
Makefile.inc1: Remove id(1) from btools.

 No longer required for buildworld/installworld.

4 years agobsd.cpu.mk: Allow externally override host binutils.
zrj [Tue, 7 Jan 2020 08:31:18 +0000 (10:31 +0200)]
bsd.cpu.mk: Allow externally override host binutils.

 Will be used from buildworld/buildkernel from OpenBSD hosts.

4 years agokernel/kmod.mk: Do not hardcode awk path.
zrj [Tue, 7 Jan 2020 08:30:20 +0000 (10:30 +0200)]
kernel/kmod.mk: Do not hardcode awk path.

4 years agokernel: Use relative paths for syscons fonts.
zrj [Tue, 7 Jan 2020 08:27:04 +0000 (10:27 +0200)]
kernel: Use relative paths for syscons fonts.

4 years agokernel: Include syscons fonts in src-sys.tar.bz2 archive.
zrj [Tue, 7 Jan 2020 08:23:43 +0000 (10:23 +0200)]
kernel: Include syscons fonts in src-sys.tar.bz2 archive.

 This will be used to reduce host dependencies when building
 nativekernel from src-sys.tar.bz2.  Building kernel without syscons
 fonts is possible if SC_DFLT_FONT kernel options are not enabled.

4 years agoMerge branch 'vendor/GDB'
zrj [Tue, 7 Jan 2020 18:25:48 +0000 (20:25 +0200)]
Merge branch 'vendor/GDB'

 Conflicts:
contrib/binutils-2.25/ld/fdl.texi
contrib/gcc-4.7/gcc/doc/include/gpl_v3.texi

4 years agoRemove few unused texi sources on gdb branch. vendor/GDB
zrj [Tue, 7 Jan 2020 18:08:17 +0000 (20:08 +0200)]
Remove few unused texi sources on gdb branch.

 As it was done in 874e15d007943a40fad40d5e25620e2bf00235a1

4 years agovmstat - Add verbose for -m
Matthew Dillon [Tue, 7 Jan 2020 05:23:29 +0000 (21:23 -0800)]
vmstat - Add verbose for -m

* If -m -v is specified all memory pools are dumped, even
  if not in use.

4 years agolibkvm - Fix minidump page table processing
Matthew Dillon [Mon, 6 Jan 2020 23:33:27 +0000 (15:33 -0800)]
libkvm - Fix minidump page table processing

* libkvm was not properly handling 1GB and 2MB page table entries.
  These entries need to be masked against PG_PS_FRAME, not PG_FRAME.

* Fixes vmstat -m -N kernel -M vmcore output, and probably other
  output too.

4 years agovmstat - Fix vmstat -m output
Matthew Dillon [Mon, 6 Jan 2020 18:05:35 +0000 (10:05 -0800)]
vmstat - Fix vmstat -m output

* The malloc_type structure's ks_use field is now a pointer
  to a dynamically malloc()d array of ncpus, instead of a fixed
  array of SMP_MAXCPU.

* Fixes segfault for vmstat -m output.

4 years agokernel - Fix bug in malloc_reinit_ncpus()
Matthew Dillon [Mon, 6 Jan 2020 18:04:35 +0000 (10:04 -0800)]
kernel - Fix bug in malloc_reinit_ncpus()

* malloc_reinit_ncpus() was not properly reinitializing the
  last malloc_type in the linked list.

4 years agokernel - Change default vfs timestamp precision sec -> usec
Matthew Dillon [Mon, 6 Jan 2020 08:27:52 +0000 (00:27 -0800)]
kernel - Change default vfs timestamp precision sec -> usec

* Change the default vfs.timestamp_precision setting from
  seconds (0) to microseconds (2).

* Nanoseconds is more problematic because utimes() only has a
  microsecond precision and cpu concurrency might cause some confusion.
  So for now leave it set to microseconds.

4 years agocpdup - Bump version, add usec timestamp precision
Matthew Dillon [Mon, 6 Jan 2020 08:21:44 +0000 (00:21 -0800)]
cpdup - Bump version, add usec timestamp precision

* cpdup will now run utimes() with microsecond precision (the
  most it can handle), if possible.  It previously only used
  seconds precision.

* Compatibilty with older cpdup's is maintained for remote copies
  (though it will warn you of the version mismatch).  Older cpdup's
  only transfer the seconds field.

* cpdup still only uses the seconds field when comparing files,
  in order to maintain maximum compatibility between operating systems
  and filesystems.

4 years agodsynth - Enhance purge-distfiles directive
Matthew Dillon [Mon, 6 Jan 2020 01:43:52 +0000 (17:43 -0800)]
dsynth - Enhance purge-distfiles directive

* Improve the distfiles list by using -VALLFILES instead of -VDISTFILES.

* Match up the related lock files so we can purge lock files that
  are no longer relevant.

4 years ago<time.h>: Check strptime()'s format argument with __strftimelike.
Sascha Wildner [Sun, 5 Jan 2020 10:22:06 +0000 (11:22 +0100)]
<time.h>: Check strptime()'s format argument with __strftimelike.

As the manual page says, "all conversion specifications are identical
to those described in strftime(3)."

4 years agobasename.3/dirname.3: Adjust for recent commits.
Sascha Wildner [Sat, 4 Jan 2020 21:54:16 +0000 (22:54 +0100)]
basename.3/dirname.3: Adjust for recent commits.

4 years agolibc - Adopt more linux-friendly basename() and dirname()
Matthew Dillon [Sat, 4 Jan 2020 20:48:20 +0000 (12:48 -0800)]
libc - Adopt more linux-friendly basename() and dirname()

* Essentially take the FreeBSD basename() and dirname() code, changing
  the API to be more linux-friendly.  This reduces work required in dports.

* Adjust numerous cases in our base code that assumed the old prototypes
  and side effects.

* The passed-in string pointers are no longer const and can be modified
  in-place by the functions.  The returned value is no longer sometimes
  dynamically allocated and will instead either return a constant string,
  a portion of the passed in string, or a modified portion of the
  passed-in string.

  The API unfortunately has to be declared to return a char * instead of
  a const char *, even though it sometimes returns pointers to constant
  strings.

  The API is now thread-safe.

* The API is still a huge historical mess but at least the ports for
  the most part assume the above behavior now due to linux doing the
  same thing.

Reviewed-by: multiple people
4 years agodrm - Fix workqueue bugs w/recent drm pushes
Matthew Dillon [Sat, 4 Jan 2020 19:58:56 +0000 (11:58 -0800)]
drm - Fix workqueue bugs w/recent drm pushes

* The linux workqueue code uses pcpu queues in many situations.
  At least one use-case in the recent drm code push can result in
  taskqueue_enqueue() calls being issued on active tasks to a different
  queue, causing (typically) overnight or idle related panics.

* Adjust the linux workqueue code to use the new taskqueue API
  functions that supports this behavior.

4 years agokernel - Update taskq code
Matthew Dillon [Sat, 4 Jan 2020 19:51:58 +0000 (11:51 -0800)]
kernel - Update taskq code

* Move the task_queue declaration out of struct timeout_task and
  into struct task.

  Generally speaking we want to transition to using the stored
  queue instead of requiring it to be passed in every API call,
  but we maintain API compatibility for now.

* Assert that the stored queue matches the passed-in queue
  in several places.

* Add taskqueue_enqueue_optq(), an API function that allows the
  queue a task is placed on to be changed.  For example, when a
  pcpu queue is passed-in.

  If the task cannot be moved to the passed-in queue it will remain
  on its current queue, otherwise it will be moved/added to the
  passed-in queue.  The queue the task is placed on is returned in
  an indirect rgument.

* Add taskqueue_cancel_simple() and taskqueue_drain_simple().
  These functions just take the task as an argument, the
  queue does not need to be specified.

4 years agodrm/radeon: Use pci_alloc_consistent()
François Tigeot [Sat, 4 Jan 2020 09:50:09 +0000 (10:50 +0100)]
drm/radeon: Use pci_alloc_consistent()