dragonfly.git
4 years ago<string.h>: Clean up the namespace.
Sascha Wildner [Sat, 16 Nov 2019 20:57:39 +0000 (21:57 +0100)]
<string.h>: Clean up the namespace.

* Stop including <sys/types.h> which was needed only for mode_t for
  the BSD specific strmode(). Define mode_t locally in __BSD_VISIBLE.

* Increase visibility of the memccpy() prototype. It is older than
  SUSv3.

4 years agolibc/getaddrinfo: Accept numeric servname for AF_INET/AF_INET6
Antonio Huete Jimenez [Sat, 16 Nov 2019 00:57:36 +0000 (01:57 +0100)]
libc/getaddrinfo: Accept numeric servname for AF_INET/AF_INET6

  According to RFC3493:

    If servname is null, the call shall return network-level addresses
    for the specified nodename.  If servname is not null, it is a null-
    terminated character string identifying the requested service.  This
    can be either a descriptive name or a numeric representation suitable
    for use with the address family or families.  If the specified
    address family is AF_INET, AF_INET6 or AF_UNSPEC, the service can be
    specified as a string specifying a decimal port number.

  Taken from: FreeBSD r190382

4 years agosys/vfs/msdosfs: Unmount on update_mp() failure if !MNT_UPDATE
Tomohiro Kusumi [Sat, 16 Nov 2019 15:12:12 +0000 (00:12 +0900)]
sys/vfs/msdosfs: Unmount on update_mp() failure if !MNT_UPDATE

bits from freebsd/freebsd@7845779267aeba1e407bd512be0720c6129bbbb1

4 years ago<xlocale/_string.h>: Mention that we are missing strerror_l().
Sascha Wildner [Sat, 16 Nov 2019 10:23:27 +0000 (11:23 +0100)]
<xlocale/_string.h>: Mention that we are missing strerror_l().

4 years ago<signal.h>/<sys/_siginfo.h>: Some fixes after my recent commits.
Sascha Wildner [Sat, 16 Nov 2019 09:44:58 +0000 (10:44 +0100)]
<signal.h>/<sys/_siginfo.h>: Some fixes after my recent commits.

* In <sys/_siginfo.h>, include just <machine/stdint.h>. No more is
  needed.

* In <signal.h>, continue to use struct __siginfo in struct sigaction,
  primarily to deal with the case where __POSIX_VISIBLE is <199309,
  of which for example graphics/png is one.

Reported-by: zrj
4 years agosyscalls.master: Remove some trailing whitespace.
Sascha Wildner [Sat, 16 Nov 2019 08:33:57 +0000 (09:33 +0100)]
syscalls.master: Remove some trailing whitespace.

4 years agosys/vfs/fuse: Add note to sys/vfs/fuse/fuse_abi.h
Tomohiro Kusumi [Sat, 16 Nov 2019 05:04:17 +0000 (14:04 +0900)]
sys/vfs/fuse: Add note to sys/vfs/fuse/fuse_abi.h

4 years agoautofs: Change email address (sync with FUSE and others)
Tomohiro Kusumi [Sat, 16 Nov 2019 02:06:02 +0000 (11:06 +0900)]
autofs: Change email address (sync with FUSE and others)

4 years ago<sys/wait.h>: Provide and use siginfo_t and union sigval.
Sascha Wildner [Fri, 15 Nov 2019 16:23:54 +0000 (17:23 +0100)]
<sys/wait.h>: Provide and use siginfo_t and union sigval.

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_wait.h.html

4 years agoAdd <sys/_siginfo.h> to provide the definitions of siginfo_t and sigval.
Sascha Wildner [Fri, 15 Nov 2019 16:23:40 +0000 (17:23 +0100)]
Add <sys/_siginfo.h> to provide the definitions of siginfo_t and sigval.

They will be shared between <signal.h> and <sys/wait.h>.

4 years agoUpdate the pciconf(8) database.
Sascha Wildner [Fri, 15 Nov 2019 16:01:49 +0000 (17:01 +0100)]
Update the pciconf(8) database.

November 10, 2019 snapshot from https://pci-ids.ucw.cz

4 years ago<sys/wait.h>: Remove duplicate include.
Sascha Wildner [Fri, 15 Nov 2019 15:43:53 +0000 (16:43 +0100)]
<sys/wait.h>: Remove duplicate include.

<machine/stdint.h> is already included at this point.

4 years agosail(6): Comment out a double assignment.
Sascha Wildner [Fri, 15 Nov 2019 12:39:37 +0000 (13:39 +0100)]
sail(6): Comment out a double assignment.

4 years agolibc: Add more namespace.h/un-namespace.h.
Sascha Wildner [Fri, 15 Nov 2019 12:25:19 +0000 (13:25 +0100)]
libc: Add more namespace.h/un-namespace.h.

4 years agoRemove the old libc_r.
Sascha Wildner [Fri, 15 Nov 2019 11:39:21 +0000 (12:39 +0100)]
Remove the old libc_r.

Nothing is using it, if it even works, and no one has been working
on it for a long time.

Approved-by: dillon
4 years agotest/libpthread: Clean up a bit.
Sascha Wildner [Thu, 14 Nov 2019 08:51:35 +0000 (09:51 +0100)]
test/libpthread: Clean up a bit.

4 years agoMove libc_r's tests to a more generic location.
Sascha Wildner [Sun, 20 Jan 2019 10:09:53 +0000 (11:09 +0100)]
Move libc_r's tests to a more generic location.

4 years agosigblockall.3/sigprocmask.2: Various small fixes/markup improvements.
Sascha Wildner [Fri, 15 Nov 2019 10:29:51 +0000 (11:29 +0100)]
sigblockall.3/sigprocmask.2: Various small fixes/markup improvements.

4 years agodsynth(1): Fix a couple of typos.
Sascha Wildner [Fri, 15 Nov 2019 10:21:19 +0000 (11:21 +0100)]
dsynth(1): Fix a couple of typos.

While here, remove two useless externs.

4 years agolibmagic: Sort MAGFILES before creating /usr/share/misc/magic.
Sascha Wildner [Fri, 15 Nov 2019 10:11:10 +0000 (11:11 +0100)]
libmagic: Sort MAGFILES before creating /usr/share/misc/magic.

4 years agosys/vfs/msdosfs: Fix comment on locking on rename(2)
Tomohiro Kusumi [Sat, 16 Nov 2019 18:53:11 +0000 (03:53 +0900)]
sys/vfs/msdosfs: Fix comment on locking on rename(2)

fdvp is locked too.

4 years agosys/vfs/msdosfs: Sync VFS lock assertion with FreeBSD
Tomohiro Kusumi [Sat, 16 Nov 2019 15:43:06 +0000 (00:43 +0900)]
sys/vfs/msdosfs: Sync VFS lock assertion with FreeBSD

Same locking applies to DragonFly VFS for these.

4 years agocalendar(1): Remove a useless extern.
Sascha Wildner [Fri, 15 Nov 2019 06:43:14 +0000 (07:43 +0100)]
calendar(1): Remove a useless extern.

4 years agobuild - Add build-all and install-all targets
Matthew Dillon [Thu, 14 Nov 2019 18:48:17 +0000 (10:48 -0800)]
build - Add build-all and install-all targets

* Add a 'smart' build-all and install-all target that spews to a
  log file instead of to the screen and.   Will automatically
  run the build stage -j N, and both targets can be specified on
  one command line.

  make build-all install-all

  build-all: runs buildworld and buildkernel -j hw.ncpu
  install-all: runs installkernel and installworld -j 1

* The usual warnings and cautions still apply when installing a
  new world and kernel.

4 years agodsynth - Go back to NO_DEPENDS, with conditions
Matthew Dillon [Thu, 14 Nov 2019 18:45:50 +0000 (10:45 -0800)]
dsynth - Go back to NO_DEPENDS, with conditions

* Remove STRICT_DEPENDS (that was just added) and go back to
  using NO_DEPENDS, but conditionalized based on the phase.  This
  is an attempt to match what synth does.

* USE_PACKAGE_DEPENDS_ONLY is still set globally, and it seems to
  be in synth as well, but there are still differences in certain
  builds such as textproc/libxslt-reference.

4 years agokernel/vga_switcheroo: Remove duplicate include of <sys/sysctl.h>.
Sascha Wildner [Thu, 14 Nov 2019 16:26:48 +0000 (17:26 +0100)]
kernel/vga_switcheroo: Remove duplicate include of <sys/sysctl.h>.

4 years ago<sys/thread.h>: Mark several structs as kernel structures.
zrj [Wed, 13 Nov 2019 18:06:40 +0000 (20:06 +0200)]
<sys/thread.h>: Mark several structs as kernel structures.

 This reduces pollution in userspace.  Adjust several comments.

 While there, mark "struct lwkt_cpu_msg" and lwkt_cpu_port as disabled.

4 years agokernel: Stop using <stdint.h> during kernel build.
zrj [Tue, 12 Nov 2019 18:43:44 +0000 (20:43 +0200)]
kernel: Stop using <stdint.h> during kernel build.

 This includes VKERNEL too.  Now it should be possible to fully build
 kernel with headers only from src/sys/ (except VKERNEL that is using
 userland headers for obvious reasons, prominently the <signal.h>).

 Now <stdint.h> separation from <sys/types.h> could begin.

4 years ago<sys/stdint.h>: Repurpose.
zrj [Tue, 12 Nov 2019 15:13:34 +0000 (17:13 +0200)]
<sys/stdint.h>: Repurpose.

 Start using this header as proxy to separate non sys/ headers from
 userland only headers.
 * Move in first kernel specific types from <sys/types.h>.
 * Tidy up type definitions for better readability.
 * Remove old comment about cdev that is no longer needed.

 Strictly non functional changes.

4 years ago<sys/kinfo.h>: Fix legacy inclusion issues.
zrj [Tue, 12 Nov 2019 12:43:30 +0000 (14:43 +0200)]
<sys/kinfo.h>: Fix legacy inclusion issues.

 Sadly this header was not being included properly for a long time.
 Make it publicly accessible and put a big NOTE how to do it properly for
 future codes.  This makes the <sys/user.h> the only other header that
 defines _KERNEL_STRUCTURES to solve long term inclusion order issues.
 Previous variant was hiding implicit dependencies, adjust netstat(1).

 Any changes in this header breaks a lot of ports, try not to change any
 of the structs.  Also make sure KERN_SIGTRAMP has public visibility.

 While there remove two defines that were not used since introduced in
 5dfd06ac148512faf075c4e399e8485fd955578f

4 years ago<sys/types.h>: Make boolean_t kernel only type.
zrj [Tue, 12 Nov 2019 10:39:02 +0000 (12:39 +0200)]
<sys/types.h>: Make boolean_t kernel only type.

 This effectively eliminates boolean_t from use in userland.  Injecting
 this type into userland codes often creates issues in DPorts where ports
 are defining their own boolean_t type.  Kernel headers now do not make
 any references to this type even under _KERNEL_STRUCTURES.
 If visibility is desired kernel headers can use __boolean_t that will
 not conflict with 3rd-party software codes.

 While there, make "struct pagerops" in vm/vm_pager.h kernel only, it is
 only used below for pagertab that is already under _KERNEL.

4 years ago<sys/systimer.h>: Do not inject boolean_t type into userland.
zrj [Tue, 12 Nov 2019 08:33:33 +0000 (10:33 +0200)]
<sys/systimer.h>: Do not inject boolean_t type into userland.

 The original workaround in 59ef3aa79b36a4ea4883a900381454c6b3bb4ea8
 seem to have been to unbreak building fstat(1) and newsyslog(8).
 The <sys/proc.h> (through <sys/user.h>) only needs "struct systimer"
 visibility.  Make rest of the structures kernel only, those are not
 referenced in kernel headers.

4 years ago<vm/vm_zone.h>: Adjust visibility.
zrj [Tue, 12 Nov 2019 07:07:54 +0000 (09:07 +0200)]
<vm/vm_zone.h>: Adjust visibility.

4 years agosys/sglist.h: Mark as kernel only header.
zrj [Tue, 12 Nov 2019 07:07:27 +0000 (09:07 +0200)]
sys/sglist.h: Mark as kernel only header.

4 years ago<sys/types.h>: Reduce vm_* types pollution in userland.
zrj [Mon, 11 Nov 2019 17:40:49 +0000 (19:40 +0200)]
<sys/types.h>: Reduce vm_* types pollution in userland.

 Userland should not be using these types outside kernel structures or
 <vm/*.h> scope.  Adjust several userland and boot code sources to
 include <machine/types.h> where they use them (mainly for vm_offset_t).
 * sys/fbio.h: Used in several world utilities and libvgl.
 * sys/kinfo.h: Use size_t for kp_vm_map_size (header used in userland).
 * sys/emulation/ndis/pe_var.h: Used in ndiscvt(8).
 * bus/firewire/fwcrom.c: Compiled directly in fwcontrol(8).
 * mptable(1): include <machine/types.h>, should really not be using
   vm_offset_t and looks to be suspiciously broken.
 * sys/boot: For now include <machine/types.h> for vm_offset_t in
   several headers, should really not be using vm types.

 Rest of world utilities get vm types through <sys/user.h>.

 While there, move pthread type inclusion to the very end of the source,
 doing so improves readability of compiler intermediates a lot.

 Strictly visibility changes only.

4 years ago<cpu/types.h>: Use basic LP types for vm_offset_t and vm_size_t.
zrj [Mon, 11 Nov 2019 15:19:04 +0000 (17:19 +0200)]
<cpu/types.h>: Use basic LP types for vm_offset_t and vm_size_t.

 Adjust PRI in biosacpi.c to use natural "%08x" specifier. The
 sys/boot/pc32/libi386/biosacpi.c is only used in 32bit loader.

 No other functional differences in both kernel and world.

4 years agoAdd <sys/cpumask.h>.
zrj [Mon, 11 Nov 2019 14:46:30 +0000 (16:46 +0200)]
Add <sys/cpumask.h>.

 Collect and gather all scatter cpumask bits to correct headers. This
 cleans up the namespace and simplifies platform handling in asm macros.
 The cpumask_t together with its macros is already non MI feature that is
 used in userland utilities, libraries, kernel scheduler and syscalls.
 It deserves sys/ header.  Adjust syscalls.master and rerun sysent.

 While there, fix an issue in ports that set POSIX env, but has
 implementation of setting thread names through pthread_set_name_np().

4 years agoplatform/pc64: Remove unused PDESIZE/PTESIZE constants.
zrj [Mon, 11 Nov 2019 10:10:04 +0000 (12:10 +0200)]
platform/pc64: Remove unused PDESIZE/PTESIZE constants.

 Leftover from early x86_64 porting.

4 years agocpu/x64_64: Move MMU page table types back to <cpu/pmap.h>.
zrj [Mon, 11 Nov 2019 09:48:04 +0000 (11:48 +0200)]
cpu/x64_64: Move MMU page table types back to <cpu/pmap.h>.

 Reduce namespace pollution.  These types are common for both
 pc64/vkernel64 and are used in pmap context only.
 All userland cases need just VM_MAX_USER_ADDRESS, PS_STRINGS constants
 through <machine/vmparam.h> with huge cpp expansion that requires
 <machine/pmap.h> header inclusion anyway.  Simplify it.

 * Hard-code NPTEPG/NPDEPG/NPDPEPG/NPML4EPG constants to properly solve
   header inclusion ordering.  The SHIFT constants are hard-coded already
   (log2() values) so there are no reasons to pretend everything will
   adjust automatically.
 * Use LU suffixes, debug printf() in vkernel64 use %ld types.
 * Optionally reorder includes in libc setproctitle.c.
 * Optionally add explicit includes in libkvm where pmap.h is only
   coming from <sys/user.h>.  The kvm_*_x86_64.c use X86_PG_* constants.

 For now keep PDESIZE/PTESIZE (used in pc64 genassym.c).

 No intermediates differences observed.

4 years ago<sys/types.h>: Declare register_t type directly.
zrj [Mon, 11 Nov 2019 08:47:21 +0000 (10:47 +0200)]
<sys/types.h>: Declare register_t type directly.

 It is expected by some of the ports.  Use compiler attribute to select
 correct word size if supported, else use LP types in for __register_t.
 Remove unused u_register_t.

4 years ago<sys/types.h>: Adjust visibility of segsz_t.
zrj [Mon, 11 Nov 2019 07:48:16 +0000 (09:48 +0200)]
<sys/types.h>: Adjust visibility of segsz_t.

 It is a historic BSD type used in "struct vmspace", "struct kinfo_lwp".
 Remove no longer needed __ intermediate type.

4 years ago<sys/sem.h>: Use generic types.
zrj [Mon, 11 Nov 2019 07:28:11 +0000 (09:28 +0200)]
<sys/sem.h>: Use generic types.

4 years ago<machine/stdint.h>: Adjust basic types to be more generic.
zrj [Sun, 10 Nov 2019 21:00:04 +0000 (23:00 +0200)]
<machine/stdint.h>: Adjust basic types to be more generic.

 Use basic LP types for time_t to avoid need to use cast (uintmax_t) in
 debug prints.  The clock_t could be adjusted too, but previously on i386
 DragonFly used int for this type.

 The same could be done for vm_offset_t and vm_size_t.

4 years ago<machine/stdint.h>: Add two basic LP types.
zrj [Sun, 10 Nov 2019 16:37:57 +0000 (18:37 +0200)]
<machine/stdint.h>: Add two basic LP types.

 These will be used to derive types that depend on data type models.
 On x64_64 is is very simple.  Non ILP32/LP64 model usage on UNIX-like
 systems is rather exception.  For example if we would support LLP64
 data type model, we would declare these types as follows:
   typedef long long __intlp_t;
   typedef unsigned long long __uintlp_t;

4 years agoAdjust headers for <machine/stdint.h> visibility.
zrj [Sun, 10 Nov 2019 20:32:58 +0000 (22:32 +0200)]
Adjust headers for <machine/stdint.h> visibility.

 This also reduces namespace pollution a bit.  Include <machine/stdint.h>
 where <stdint.h> is used too.  External compiler under -ffreestanding
 (__STDC_HOSTED__ == 0) will use their own <stdint.h> version and will
 not include <machine/stdint.h>.

4 years ago<stdint.h>: Move out ptrdiff_t type.
zrj [Sun, 10 Nov 2019 15:03:35 +0000 (17:03 +0200)]
<stdint.h>: Move out ptrdiff_t type.

 The ISO C does not specify that <stdint.h> should provide this type,
 this type should be declared in <stddef.h> for use by userland.

 Since we do not want to create a separate header for this useful type
 to be used by kernel, move it to <sys/types.h> under _KERNEL visibility.

 Adjust few places to include <stddef.h> with a minor whitespace cleanup.

4 years agosys/vfs/msdosfs: Allow deupdat() against non root directory
Tomohiro Kusumi [Fri, 15 Nov 2019 22:23:24 +0000 (07:23 +0900)]
sys/vfs/msdosfs: Allow deupdat() against non root directory

bits from freebsd/freebsd@c7af094e18c4e4ca2a26a88c488a803472d330ee

Given ondisk layout of root directory in FAT12/16 and FAT32,
don't allow deupdat() or setattr() against root directory,
but allow against other directories.

4 years agoRevert "sys/vfs/msdosfs: Correct _PC_FILESIZEBITS value"
Sascha Wildner [Thu, 14 Nov 2019 10:13:19 +0000 (11:13 +0100)]
Revert "sys/vfs/msdosfs: Correct _PC_FILESIZEBITS value"

This reverts commit 6a951e106bca493303959d97e688c06f9ec21f3a.

32 bits is not enough because per the standard, it has to be the
minimum number of bits needed to represent, "as a signed integer
value", the maximum size of a regular file allowed in the specified
directory. And 32 is the lower limit of this value.

https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html

4 years agosys/vfs/msdosfs: Correct _PC_FILESIZEBITS value
Tomohiro Kusumi [Fri, 15 Nov 2019 15:51:47 +0000 (00:51 +0900)]
sys/vfs/msdosfs: Correct _PC_FILESIZEBITS value

32 is enough (where did 33 come from ?).

4 years agosys/vfs/msdosfs: Remove seemingly unneeded mbnambuf code
Tomohiro Kusumi [Fri, 15 Nov 2019 15:18:08 +0000 (00:18 +0900)]
sys/vfs/msdosfs: Remove seemingly unneeded mbnambuf code

originally from 3435d5778808adf9c89a4f9f0e34010b4dc8888f in 2009.
Sync with what FreeBSD does.
Also sync minor styles with FreeBSD.

4 years agoworld - Add support for lwp_getname() and pthread_get_name_np()
Matthew Dillon [Thu, 14 Nov 2019 00:39:26 +0000 (16:39 -0800)]
world - Add support for lwp_getname() and pthread_get_name_np()

* Add support for the new system call lwp_getname()

* Add support for pthread_get_name_np(), rounding out that function
  set and improving ports compatibility.

4 years agokernel - Add lwp_getname() system call
Matthew Dillon [Thu, 14 Nov 2019 00:37:10 +0000 (16:37 -0800)]
kernel - Add lwp_getname() system call

* Add a new system call to support pthread_get_name_np().

4 years agocpuctl - Implement close() properly for /dev/cpuctl*
Matthew Dillon [Wed, 13 Nov 2019 22:24:52 +0000 (14:24 -0800)]
cpuctl - Implement close() properly for /dev/cpuctl*

* The cpuctl device didn't implement close().  Properly implement
  it so close() on cpuctl descriptors succeeds.

Reported-by: zrj
4 years agoMakefile_upgrade.inc: Remove redundant entry.
Sascha Wildner [Wed, 13 Nov 2019 21:17:26 +0000 (22:17 +0100)]
Makefile_upgrade.inc: Remove redundant entry.

4 years agodsynth - Use STRICT_DEPENDS instead of NO_DEPENDS
Matthew Dillon [Wed, 13 Nov 2019 20:15:44 +0000 (12:15 -0800)]
dsynth - Use STRICT_DEPENDS instead of NO_DEPENDS

* Use STRICT_DEPENDS instead of NO_DEPENDS.  NO_DEPENDS prevents
  source-extraction dependencies, which is not what we want.

  STRICT_DEPENDS is intended to ensure that dsynth installed
  the proper precursor packages and to fail if it didn't.

4 years agolibc: Remove _nmalloc_thr_init from Symbol.map again.
Sascha Wildner [Wed, 13 Nov 2019 18:31:21 +0000 (19:31 +0100)]
libc: Remove _nmalloc_thr_init from Symbol.map again.

My fault, it is now internal only.

Pointed-out-by: dillon
4 years agocontrib/dhcpcd - update README
Roy Marples [Wed, 13 Nov 2019 17:08:31 +0000 (17:08 +0000)]
contrib/dhcpcd - update README

4 years agoMerge branch 'vendor/DHCPCD'
Roy Marples [Wed, 13 Nov 2019 17:05:41 +0000 (17:05 +0000)]
Merge branch 'vendor/DHCPCD'

4 years agosys/vfs/msdosfs: Assume up to 8192 bytes sector for BPB
Tomohiro Kusumi [Thu, 14 Nov 2019 19:09:07 +0000 (04:09 +0900)]
sys/vfs/msdosfs: Assume up to 8192 bytes sector for BPB

from freebsd/freebsd@dba17f21d375effcf89349e1d86b34b2f408ad0b

4 years agosys/vfs/msdosfs: Return EBUSY on lookup on delete/rename of MSDOSFSROOT_OFS
Tomohiro Kusumi [Thu, 14 Nov 2019 17:04:13 +0000 (02:04 +0900)]
sys/vfs/msdosfs: Return EBUSY on lookup on delete/rename of MSDOSFSROOT_OFS

from freebsd/freebsd@e672feb26e335afc5801c618b8d3e24ee7d29414

4 years agosys/vfs/msdosfs: Sync minor styles with FreeBSD
Tomohiro Kusumi [Thu, 14 Nov 2019 16:10:04 +0000 (01:10 +0900)]
sys/vfs/msdosfs: Sync minor styles with FreeBSD

4 years agosys/vfs/msdosfs: Allow B_CLUSTEROK in deupdat()
Tomohiro Kusumi [Wed, 13 Nov 2019 17:19:16 +0000 (02:19 +0900)]
sys/vfs/msdosfs: Allow B_CLUSTEROK in deupdat()

Since now that VFS clustering is supported, apply remaining bits
from freebsd/freebsd@3bbdcb77fd843ff34a0054bea92392cee78dd0ec
that was dropped in 8480e7bcdf9ffa9f44f80f9362c6f62424ada748.

4 years agosys/vfs/msdosfs: Don't use MSDOSFSMNT_WAITONFAT
Tomohiro Kusumi [Wed, 13 Nov 2019 16:51:52 +0000 (01:51 +0900)]
sys/vfs/msdosfs: Don't use MSDOSFSMNT_WAITONFAT

from freebsd/freebsd@5e07d49c626dea51d672ea9d9bd1499e0ae8eb29

4 years agosys/vfs/msdosfs: Include FAT headers via <vfs/msdosfs/...>
Tomohiro Kusumi [Wed, 13 Nov 2019 15:33:13 +0000 (00:33 +0900)]
sys/vfs/msdosfs: Include FAT headers via <vfs/msdosfs/...>

Sync order with FreeBSD.

4 years agoImport dhcpcd-8.1.2
Roy Marples [Wed, 13 Nov 2019 17:01:06 +0000 (17:01 +0000)]
Import dhcpcd-8.1.2

 * hooks: STOPPED is now run on timeout and exit
 * BSD: Use IP_REVCIF rather than IN_PKTINFO
 * DHCP: When rebinding, ensure we have a DHCP ARP state
 * RA: Sort routers when reachability changes
 * RA: Apply hoplimit, reachable and retrans timer values to kernel
 * RA: Warn if advertised MTU > interface MTU
 * dhcpcd: Report SSID connection to when we gain carrier
 * DHCP: Fix corruption of address flags when renewing

4 years agokernel - Fix first-lwp access race vs process creation
Matthew Dillon [Tue, 12 Nov 2019 22:49:30 +0000 (14:49 -0800)]
kernel - Fix first-lwp access race vs process creation

* It is possible for a process to be looked up before its primary
  lwp is installed.  Make sure this doesn't crash the kernel.

4 years agopthreads - Fix incorrect fork assumption
Matthew Dillon [Tue, 12 Nov 2019 22:45:09 +0000 (14:45 -0800)]
pthreads - Fix incorrect fork assumption

* libthread_xu assumed that the forked child process's TID would be 1,
  but that is no longer the case.

* Fix the assumption and correct some comments while we are here.

Reported-by: zrj
4 years agodocs - Add manual page for sigblockall() and sigunblockall()
Matthew Dillon [Tue, 12 Nov 2019 19:54:57 +0000 (11:54 -0800)]
docs - Add manual page for sigblockall() and sigunblockall()

* Add a nice manual page for sigblockall() and sigunblockall()

4 years agokernel and libc - Reimplement lwp_setname*() using /dev/lpmap
Matthew Dillon [Tue, 12 Nov 2019 19:00:42 +0000 (11:00 -0800)]
kernel and libc - Reimplement lwp_setname*() using /dev/lpmap

* Generally speaking we are implementing the features necessary
  to allow per-thread titling set via pthread_set_name_np() to
  show up in 'ps' output, and to use lpmap to make it fast.

* The lwp_setname() system call now stores the title in
  lpmap->thread_title[].

* Implement a libc fast-path for lwp_setname() using lpmap.
  If called more than 10 times, libc will use lpmap for any
  further calls, which omits the need to make any system calls.

* setproctitle() now stores the title in upmap->proc_title[]
  instead of replacing proc->p_args.  proc->p_args is now no
  longer modified from its original contents.

* The kernel now includes lpmap->thread_title[] in the following
  priority order when retrieving the process command line:

  lpmap->thread_title[] User-supplied thread title, if not empty
  upmap->proc_title[] User-supplied process title, if not empty
  proc->p_args Original process arguments (no longer modified)

* Put the TID in /dev/lpmap for convenient access

* Enhance the KERN_PROC_ARGS sysctl to allow the TID to be specified.
  The sysctl now accepts { KERN_PROC, KERN_PROC_ARGS, pid, tid }
  in addition to the existing { KERN_PROC, KERN_PROC_ARGS, pid }
  mechanism.

  Enhance libkvm to use the new feature.  libkvm will fall-back to
  the old version if necessary.

4 years agolibc - Implement sigblockall() and sigunblockall() (3)
Matthew Dillon [Tue, 12 Nov 2019 18:56:37 +0000 (10:56 -0800)]
libc - Implement sigblockall() and sigunblockall() (3)

* I half expected my reordering of lwp_fork*() to cause problems,
  and it did.  Fix a panic window due to the new lwp getting added
  to the process before its underlying lwkt thread is assigned.

* Document the subtle issues, including the fact that in the
  [v]fork() case we must assign the correct TID in lwp_fork1() for
  vm_fork() to consume when dealing with /dev/lpmap

4 years agosys/gnu/vfs/ext2fs: Use IO_SEQSHIFT
Tomohiro Kusumi [Tue, 12 Nov 2019 18:34:55 +0000 (03:34 +0900)]
sys/gnu/vfs/ext2fs: Use IO_SEQSHIFT

0d540a44319db497468b7c5b37893f5328ce7d5e was missing ext2.

4 years agosys/vfs: Use IO_SEQSHIFT
Tomohiro Kusumi [Tue, 12 Nov 2019 18:02:39 +0000 (03:02 +0900)]
sys/vfs: Use IO_SEQSHIFT

4 years agosys/vfs/msdosfs: Fix va_fileid casts
Tomohiro Kusumi [Tue, 12 Nov 2019 16:05:59 +0000 (01:05 +0900)]
sys/vfs/msdosfs: Fix va_fileid casts

bits from freebsd/freebsd@ab16560f3305829961b71dbe71233abcd50f0aba

4 years agosys/vfs/msdosfs: Save/restore fatchain cache in VOP_BMAP()
Tomohiro Kusumi [Tue, 12 Nov 2019 15:09:05 +0000 (00:09 +0900)]
sys/vfs/msdosfs: Save/restore fatchain cache in VOP_BMAP()

from freebsd/freebsd@651827134bd3a0e50aa76f83e6b83d6976b010a6

Prevent VOP_BMAP() from updating FC_LASTMAP fatchain cache
with irrelevant location.

4 years agosys/vfs/msdosfs: Support vfs clustering
Tomohiro Kusumi [Mon, 11 Nov 2019 20:57:40 +0000 (05:57 +0900)]
sys/vfs/msdosfs: Support vfs clustering

from freebsd/freebsd@8fdd1a79d0f77863b38e6de503ef08f19bef2e89

fio shows random read/write throughput improvement by 10% or so.

4 years agoUse our standard bool type in a few places.
Sascha Wildner [Tue, 12 Nov 2019 10:12:58 +0000 (11:12 +0100)]
Use our standard bool type in a few places.

4 years agolibc: Fix up two Symbol.map's a bit.
Sascha Wildner [Tue, 12 Nov 2019 08:37:53 +0000 (09:37 +0100)]
libc: Fix up two Symbol.map's a bit.

* Keep _nmalloc_thr_init, it didn't go away.

* Put _libc_thr_init into DF508.0.

* Reindent like everywhere else.

4 years agolibc - Implement sigblockall() and sigunblockall() (2)
Matthew Dillon [Tue, 12 Nov 2019 05:38:33 +0000 (21:38 -0800)]
libc - Implement sigblockall() and sigunblockall() (2)

* Cleanup the logic a bit.  Store the lwp or proc pointer
  in the vm_map_backing structure and make vm_map_fork()
  and friends more aware of it.

* Rearrange lwp allocation in [v]fork() to make the pointer(s)
  available to vm_fork().

* Put the thread mappings on the lwp's list immediately rather
  than waiting for the first fault, which means that per-thread
  mappings will be deterministically removed on thread exit
  whether any faults happened or not.

* Adjust vmspace_fork*() functions to not propagate 'dead' lwp
  mappings for threads that won't exist in the forked process.
  Only the lwp mappings for the thread doing the [v]fork() is
  retained.

4 years agokernele - lpmap work - split lwp_fork() into lwp_fork1() and lwp_fork2()
Matthew Dillon [Tue, 12 Nov 2019 03:24:48 +0000 (19:24 -0800)]
kernele - lpmap work - split lwp_fork() into lwp_fork1() and lwp_fork2()

* Split lwp_fork() so we can have the lwp in-hand when issuing the
  vm_fork().

4 years agoacpi - Catch infinite parser recursions
Matthew Dillon [Tue, 12 Nov 2019 02:14:07 +0000 (18:14 -0800)]
acpi - Catch infinite parser recursions

* Instrument AcpiPsParseLoop() and limited recursion depth to 5.
  Generally speaking this loop can call a very deep stack of
  routines and eat up the kernel stack.  A depth limit of 5 might
  be a bit too low, but it doesn't take much more to blow up
  our current 16KB kernel stack.

  This prevents the kernel from double-faulting on excessively bad
  AML.

* Works around reported boot-time double-faults on some laptops.

4 years agokernel - Repurpose td_tracker
Matthew Dillon [Tue, 12 Nov 2019 02:12:57 +0000 (18:12 -0800)]
kernel - Repurpose td_tracker

* Remove td_tracker use from hammer2

* The field is now a general purpose call recursion tracker, base
  value 0.

4 years agovmstat - Increase buffer for vmstat -m
Matthew Dillon [Tue, 12 Nov 2019 02:03:00 +0000 (18:03 -0800)]
vmstat - Increase buffer for vmstat -m

* Increase the buffer from 1024 entries to 16384 entries.

4 years agolibc - make strtok() thread-safe
Matthew Dillon [Tue, 12 Nov 2019 01:51:35 +0000 (17:51 -0800)]
libc - make strtok() thread-safe

* Make strtok() thread-safe.  Applications are getting too complex
  to trust that they will do the right thing.

4 years agolibc - Implement sigblockall() and sigunblockall()
Matthew Dillon [Tue, 12 Nov 2019 01:35:42 +0000 (17:35 -0800)]
libc - Implement sigblockall() and sigunblockall()

* Signal safety is becoming a defacto requirement for most of libc and
  pthreads.  In particular, the memory allocator.  Given the chances of
  teaching tens of thousands of programmers about signal safety, and
  just making it work in libc and pthreads, only one of these two
  possibilities is actually realizable.

  In particular, high-level languages have become so complex, and some
  applications (chrome, firefox, etc) have become so complex, that the
  code is regularly tripping over signal safety issues.

  However, implementing signal safety with current mechanisms is extremely
  expensive due to the need for multiple system calls.  To whit,
  DragonFlyBSD now has a mechanism that does not require system calls
  in the critical path.

* Implement sigblockall() and sigunblockall().  These functions
  leverage the new /dev/lpmap per-thread shared page mechanism
  to provide a way to temporary block the dispatch of all maskable
  signals without having to make any system calls.

  These are extremely fast routines.

  - Reentrant / Recursable

  - Temporarily blocks any dispatch of a maskable asynchronous signal
    to the calling thread.  Other threads are not affected... this is
    a per-thread mechanism.

  - The last sigunblockall() will immediately dispatch any blocked
    signals.

  - The normal signal mask is not affected by these routines.

  - Does not block signals caused by synchronous traps.

  - The current recursion count is retained on [v]fork() to ease
    coding and to also allow signals to be temporarily blocked across a
    fork until the child process is ready to deal with them, if desired.

* Implement signal safety for most of pthreads.  All temporary internal
  mutexes are now wrapped with sigblockall() and sigunblockall().

* Implement signal safety for the malloc subsystem.  All functions
  are wrawpped with sigblockall() and sigunblockall().

  These implementations make lang/mono and lang/rust far more reliable
  than they were before.  Where 9 out of 10 builds used to fail, now
  they succeed.

4 years agokernel - sigblockall()/sigunblockall() support (per thread shared page)
Matthew Dillon [Tue, 12 Nov 2019 01:06:55 +0000 (17:06 -0800)]
kernel - sigblockall()/sigunblockall() support (per thread shared page)

* Implement /dev/lpmap, a per-thread RW shared page between userland
  and the kernel.  Each thread in the process will receive a unique
  shared page for communication with the kernel when memory-mapping
  /dev/lpmap and can access varous variables via this map.

* The current thread's TID is retained for both fork() and vfork().
  Previously it was only retained for vfork().  This avoids userland
  code confusion for any bits and pieces that are indexed based on the
  TID.

* Implement support for a per-thread block-all-signals feature that
  does not require any system calls (see next commit to libc).  The
  functions will be called sigblockall() and sigunblockall().

  The lpmap->blockallsigs variable prevents normal signals from being
  dispatched.  They will still be queued to the LWP as per normal.
  The behavior is not quite that of a signal mask when dealing with
  global signals.

  The low 31 bits represents a recursion counter, allowing recursive
  use of the functions.  The high bit (bit 31) is set by the kernel
  if a signal was prevented from being dispatched.  When userland decrements
  the counter to 0 (the low 31 bits), it can check and clear bit 31 and
  if found to be set userland can then make a dummy 'real' system call
  to cause pending signals to be delivered.

  Synchronous TRAPs (e.g. kernel-generated SIGFPE, SIGSEGV, etc) are not
  affected by this feature and will still be dispatched synchronously.

* PThreads is expected to unmap the mapped page upon thread exit.
  The kernel will force-unmap the page upon thread exit if pthreads
  does not.

  XXX needs work - currently if the page has not been faulted in
  the kernel has no visbility into the mapping and will not unmap it,
  but neither will it get confused if the address is accessed.  To
  be fixed soon.  Because if we don't, programs using LWP primitives
  instead of pthreads might not realize that libc has mapped the page.

* The TID is reset to 1 on a successful exec*()

* On [v]fork(), if lpmap exists for the current thread, the kernel will
  copy the lpmap->blockallsigs value to the lpmap for the new thread
  in the new process.  This way sigblock*() state is retained across
  the [v]fork().

  This feature not only reduces code confusion in userland, it also
  allows [v]fork() to be implemented by the userland program in a way
  that ensures no signal races in either the parent or the new child
  process until it is ready for them.

* The implementation leverages our vm_map_backing extents by having
  the per-thread memory mappings indexed within the lwp.  This allows
  the lwp to remove the mappings when it exits (since not doing so
  would result in a wild pmap entry and kernel memory disclosure).

* The implementation currently delays instantiation of the mapped
  page(s) and some side structures until the first fault.

  XXX this will have to be changed.

4 years agouseful_macros.cocci: Improve a bit.
Sascha Wildner [Mon, 11 Nov 2019 09:13:46 +0000 (10:13 +0100)]
useful_macros.cocci: Improve a bit.

Submitted-by: Markus Elfring
https://github.com/DragonFlyBSD/DragonFlyBSD/commit/194bb2afcef86db2c8a0a56b7d8527aa3eb01fb0#commitcomment-35885096

4 years agoMakefile_upgrade.inc: Sort a bit.
Sascha Wildner [Mon, 11 Nov 2019 08:15:56 +0000 (09:15 +0100)]
Makefile_upgrade.inc: Sort a bit.

4 years agoRemove OPIE remains.
Sascha Wildner [Mon, 11 Nov 2019 08:15:39 +0000 (09:15 +0100)]
Remove OPIE remains.

4 years agosys/vfs/msdosfs: Need to explicitly set bp to NULL
Tomohiro Kusumi [Sun, 10 Nov 2019 16:27:06 +0000 (01:27 +0900)]
sys/vfs/msdosfs: Need to explicitly set bp to NULL

for several vnops.

4 years agodsynth - Improve 'debug' target, fix "x\n" in logs
Matthew Dillon [Sun, 10 Nov 2019 16:53:09 +0000 (08:53 -0800)]
dsynth - Improve 'debug' target, fix "x\n" in logs

* Improve the 'debug' target.  Remove the target packages first,
  just like the 'test' target, and include a description for the
  'debug' target in dsynth help.

* Change the pty handshake to just a newline, it still shows up in the
  logs due to (probably) master-pty echo mode, but it isn't really
  noticeable verses the previous "x\n".

4 years agoinet6: Support the ioctl SIOCSIFINFO_IN6
Roy Marples [Sun, 10 Nov 2019 15:17:54 +0000 (15:17 +0000)]
inet6: Support the ioctl SIOCSIFINFO_IN6

This allows setting hop limit, reachable and retransmit times,
as well as link mtu for the interface.
It's analogous to the SIOCGIFINFO_IN6 ioctl.

Taken from NetBSD.

4 years agoif_tap: Handle 'SIOCSIFMTU' ioctl directly to support MTU > 1500
Aaron LI [Sun, 10 Nov 2019 09:28:52 +0000 (17:28 +0800)]
if_tap: Handle 'SIOCSIFMTU' ioctl directly to support MTU > 1500

Add the SIOCSIFMTU ioctl handling directly to tap(4) permitting it to
have its MTU set higher than 1500 (ETHERMTU).  Its new limit is now
65535 as enforced by 'ifhwioctl()' in 'if.c'.

This allows a tap(4) device to be added to a bridge, which requires all
interface members to have the same MTU, with an interface configured for
jumbo frames.  QEMU may now connect to a network via tap(4) without
requiring the real interface to have its MTU set to 1500 or lower.

Also bump __DragonFly_version.

Obtained-from: FreeBSD (revision 189866)

4 years agotools/wesside: Update to use /dev/tap directly
Aaron LI [Thu, 30 Aug 2018 13:09:54 +0000 (21:09 +0800)]
tools/wesside: Update to use /dev/tap directly

Use the autocloner /dev/tap instead of relying upon pre-created (and
hard-coded) /dev/tap3.

4 years agonos-tun(8): Directly use /dev/tun and remove option '-t'
Aaron LI [Thu, 30 Aug 2018 13:05:50 +0000 (21:05 +0800)]
nos-tun(8): Directly use /dev/tun and remove option '-t'

Update nos-tun(8) to directly use /dev/tun instead of the pre-created
/dev/tunX devices.  Therefore, the option '-t' is no longer used and
removed.

4 years ago#include <sys/cdefs.h> in a number of headers that use macros from it.
Sascha Wildner [Sun, 10 Nov 2019 10:12:32 +0000 (11:12 +0100)]
#include <sys/cdefs.h> in a number of headers that use macros from it.

All these are public headers and check some kind of __*_VISIBLE macro
with #if but were not making sure that these macros are available and
set correctly.

4 years ago<sys/msgport.h>: Add <sys/types.h> for boolean_t (kernel only).
Sascha Wildner [Sun, 10 Nov 2019 10:26:12 +0000 (11:26 +0100)]
<sys/msgport.h>: Add <sys/types.h> for boolean_t (kernel only).

4 years agocalendar(1): Define "LANG" for national calendars
Aaron LI [Sun, 10 Nov 2019 04:43:14 +0000 (12:43 +0800)]
calendar(1): Define "LANG" for national calendars

Similar to the other national calendars in 'calendars/*.UTF-8'
directories.

4 years agocalendar(1): Reset locale after parsing each calendar file
Aaron LI [Sun, 10 Nov 2019 04:40:45 +0000 (12:40 +0800)]
calendar(1): Reset locale after parsing each calendar file

This avoids that one calendar file that changed the locale by defining
the "LANG") does not interfere the following calendar files without the
"LANG" definition.

4 years agocalendar(1): Search calendar file in current directory first
Aaron LI [Sun, 10 Nov 2019 03:54:44 +0000 (11:54 +0800)]
calendar(1): Search calendar file in current directory first

This fixes the regression introduced in commit
f8b849d1082177cbfa11f941feeeced54815dc56.

4 years agocalendar(1): Refactor mail header composition and sending
Aaron LI [Sun, 10 Nov 2019 02:27:24 +0000 (10:27 +0800)]
calendar(1): Refactor mail header composition and sending

* Use 'struct iovec header[]' to hold all mail headers, and then use
  writev(2) to write them into the pipe.

* Explicitly set 'LC_TIME=C' when formating the date string for the mail
  header.

Obtained-from: OpenBSD