dragonfly.git
2 months agosys/net: Add dom_if_up and dom_if_down
Roy Marples [Tue, 10 Sep 2019 11:09:20 +0000 (12:09 +0100)]
sys/net: Add dom_if_up and dom_if_down

Domain functions for when the interface goes up and down.

2 months agoroute: Don't install a cloned route when interface is down
Roy Marples [Tue, 10 Sep 2019 11:00:36 +0000 (12:00 +0100)]
route: Don't install a cloned route when interface is down

When an interface is taken down, all subnet routes are removed
and thus all cloned routes are flushed.

It's possible, although unlikely, for userland to add a subnet
route when the interface is down.

In this state, EHOSTDOWN would be returned regardless, but a
cloned route would be created locked to the interface.
Instead, check if interface is down before creating the cloned
route so it's not made needlessly.

2 months ago<netinet/in_var.h>: Adjust visibility.
zrj [Sat, 31 Aug 2019 14:12:33 +0000 (17:12 +0300)]
<netinet/in_var.h>: Adjust visibility.

 It appears that only struct in_ifaddr and in_aliasreq need to be exposed
 to the userland.

 While there, disable two macros that do not seem to be used by DPorts.

2 months ago<netinet/in_var.h>: Include sys/fnv_hash.h only for _KERNEL.
zrj [Sat, 31 Aug 2019 13:06:25 +0000 (16:06 +0300)]
<netinet/in_var.h>: Include sys/fnv_hash.h only for _KERNEL.

 Many dports have their own hash-32.c and hash-fnv.cc implementations.
 This makes the lib/libkvm/kvm_minidump_x86_64.c the only consumer of
 <sys/fnv_hash.h> in userland.

2 months ago<sys/fnv_hash.h>: Remove unused fnv_64*() inline functions.
zrj [Sat, 31 Aug 2019 11:58:37 +0000 (14:58 +0300)]
<sys/fnv_hash.h>: Remove unused fnv_64*() inline functions.

 Unused in base (neither OpenBSD or NetBSD has this header).  Once needed
 64 variants can be added from www.isthe.com/chongo/src/fnv/hash_64.c
 For now keep fnv_32_str() inline, but disable it.  It could be used in
 several kernel places instead of fnv_32_buf().  The smbfs_hash() in
 sys/vfs/smbfs/smbfs_node.c could be adjusted to use <sys/fnv_hash.h>.

 Reduces kernel.stripped size by 72 bytes.

2 months ago<sys/dmsg.h>: Reduce userland namespace pollution.
zrj [Sat, 31 Aug 2019 09:54:15 +0000 (12:54 +0300)]
<sys/dmsg.h>: Reduce userland namespace pollution.

 Do not include <sys/malloc.h> and <sys/thread.h> for userland here.
 This removes dependencies on these headers for all dmsg consumers like:
  fstyp(8), hammer2(8), mount_hammer2(8), newfs_hammer2(8) and libstand
 which is desired in standalone boot environment.
 Add missing <machine/param.h> for libstand/hammer2.c that needs the
 DEV_BSHIFT definition, previously it was visible through <sys/malloc.h>
 namespace pollution.

 While there, mark some guards for clarity too.

 Noticed while investigating .depend ​violations.

2 months ago<sys/device.h>: Adjust userland visibility.
zrj [Sat, 31 Aug 2019 09:51:34 +0000 (12:51 +0300)]
<sys/device.h>: Adjust userland visibility.

 While there, do the same to sys/devfs.h and sys/vfsops.h.

 No functional change for base.

2 months ago<sys/device.h>: Disable some no longer used types.
zrj [Sat, 31 Aug 2019 09:47:37 +0000 (12:47 +0300)]
<sys/device.h>: Disable some no longer used types.

 Some additional cleanup in sys/devfs.h and sys/vfsops.h:
 * dev_args_union/vop_args_union unused since introduced in
   fef8985e09e16aeee4a2014876e2e4b758656ac2 and
   2d3e977e265c8a4a48b58061b9d91ad235ed2265
 * devfs_unit_hash unused since 898c91ee87ff48eab03bcce3add7afc16a58754e
 * D_NAGGED unused since 335dda388a5c13edd38c87c32b72e51eaaedce75
 * DEVFS_ISDIGIT unused since 07dfa375a25f4ef43c956ee33c739661306f601

 While there, minor trailing whitespace cleanup in sys/vfsops.h.

2 months ago<cpu/param.h>: Change visibility for several macros.
zrj [Sat, 31 Aug 2019 09:46:16 +0000 (12:46 +0300)]
<cpu/param.h>: Change visibility for several macros.

 While there, remove two unused ones since introduced in
 c8fe38ae0761c8117b13caf9b76ad5fb86ac2135

2 months agokernel: Remove kvtop() remnant form early x86_64 port.
zrj [Sat, 31 Aug 2019 09:45:16 +0000 (12:45 +0300)]
kernel: Remove kvtop() remnant form early x86_64 port.

2 months agoplatform/pc64: Remove unused pte_store() and pde_store().
zrj [Sat, 31 Aug 2019 09:44:33 +0000 (12:44 +0300)]
platform/pc64: Remove unused pte_store() and pde_store().

 Never used since introduced in 48ffc2362a11e481bf0398dc7ce5e4815acd2190

2 months ago<machine/param.h>: Remove unused KSTACK_PAGES.
zrj [Sat, 31 Aug 2019 09:43:29 +0000 (12:43 +0300)]
<machine/param.h>: Remove unused KSTACK_PAGES.

 Unused since 4611d87f91be625f8ef4c7ea2709b86abe035b65

2 months ago<sys/serialize.h>: Limit prototypes to kernel only.
zrj [Sat, 31 Aug 2019 09:42:07 +0000 (12:42 +0300)]
<sys/serialize.h>: Limit prototypes to kernel only.

 The "struct lwkt_serialize" must be left userland visible for if_net.

2 months ago<sys/jail.h>: Use forward declarations for private members.
zrj [Sat, 31 Aug 2019 09:40:42 +0000 (12:40 +0300)]
<sys/jail.h>: Use forward declarations for private members.

 This reduces dependencies on <sys/sysctl.h> in both kernel and userland.

2 months agolibc: Add gets_s(3) from ISO/IEC TR 24731-1.
Sascha Wildner [Mon, 9 Sep 2019 17:44:47 +0000 (19:44 +0200)]
libc: Add gets_s(3) from ISO/IEC TR 24731-1.

For more information see the Technical Report (drafts of it are on
the web) or e.g. http://en.cppreference.com/w/c/io/gets.

This also adds set_constraint_handler_s(), abort_handler_s(),
ignore_handler_s(), the RSIZE_MAX define, and the types rsize_t,
errno_t and constraint_handler_t.

Visibility is restricted to our default environment by default, but
can be enabled by defining __STDC_WANT_LIB_EXT1__ to 1, per the TR.

While here, put gets()'s documentation into a manual page of its own
with a note that it is depracated. We'll likely remove it from libc
too at a later point in time.

Requested-by: zrj
Taken-from:   FreeBSD (with some adjustments)

2 months ago<sys/cdefs.h>: Add a macro to control ISO/IEC TR 24731-1 visibility.
Sascha Wildner [Sun, 8 Sep 2019 10:28:54 +0000 (12:28 +0200)]
<sys/cdefs.h>: Add a macro to control ISO/IEC TR 24731-1 visibility.

The __STDC_WANT_LIB_EXT1__ macro controls visibility for code that
wants to use it. In addition, visibility is enabled for our default
environment that exposes everything.

Taken-from: FreeBSD

2 months agoinet: return EHOSTDOWN if we cannot resolve an address in time
Roy Marples [Mon, 9 Sep 2019 16:48:11 +0000 (17:48 +0100)]
inet: return EHOSTDOWN if we cannot resolve an address in time

This allows programs to make informed decisions about what to do
if anything goes wrong trying to resolve the address.

For example, ping(8) now reports sendto: Host is down, which is
more useful than not reporting anything.

Taken-from: NetBSD

2 months agoinet: Don't mark cloned route as RTF_REJECT on RTM_MISS
Roy Marples [Mon, 9 Sep 2019 16:20:29 +0000 (17:20 +0100)]
inet: Don't mark cloned route as RTF_REJECT on RTM_MISS

With the current behaviour, the cloned route is marked as
RTF_REJECT which means subsequent use is delayed until either an
ARP reply comes in or the ARP entry times out and resolution
can then begin again.

Instead, no longer mark the route for RTF_REJECT and allow more
ARP requests to go out if something really wants to use it.
This mirror the current behaviour for inet6.

2 months agosbin/newfs_msdos: Bring in -A/-T options from FreeBSD
Tomohiro Kusumi [Sun, 8 Sep 2019 00:19:12 +0000 (09:19 +0900)]
sbin/newfs_msdos: Bring in -A/-T options from FreeBSD

Basically from FreeBSD/Git 284893ba and 8255b708.

2 months agonewfs_msdos.8: Re-fix typo. :)
Sascha Wildner [Mon, 9 Sep 2019 11:07:04 +0000 (13:07 +0200)]
newfs_msdos.8: Re-fix typo. :)

2 months agosbin/newfs_msdos: Sync newfs_msdos.8 with FreeBSD
Tomohiro Kusumi [Mon, 9 Sep 2019 01:19:43 +0000 (10:19 +0900)]
sbin/newfs_msdos: Sync newfs_msdos.8 with FreeBSD

2 months agosbin/newfs_msdos: Bring in FreeBSD/Git 47266d91, b25a2bc0
Tomohiro Kusumi [Mon, 9 Sep 2019 01:02:22 +0000 (10:02 +0900)]
sbin/newfs_msdos: Bring in FreeBSD/Git 47266d91b25a2bc0

2 months agosys/vfs/msdosfs: Bring back EXBOOTSIG2 (unbreak lib/libfsid build)
Tomohiro Kusumi [Sun, 8 Sep 2019 18:36:43 +0000 (03:36 +0900)]
sys/vfs/msdosfs: Bring back EXBOOTSIG2 (unbreak lib/libfsid build)

Note that fatgen103 doesn't mention such thing.
FreeBSD/NetBSD don't have it either.

2 months agoopenresolv: correct README
Roy Marples [Sun, 8 Sep 2019 21:56:42 +0000 (22:56 +0100)]
openresolv: correct README

2 months agoresolvconf: We need the onestatus argument
Roy Marples [Sun, 8 Sep 2019 21:25:36 +0000 (22:25 +0100)]
resolvconf: We need the onestatus argument

As status suffers the same flaw as FreeBSD.
Namely it returns 0 if not running AND not enabled.

2 months agoopenresolv: Update README
Roy Marples [Sun, 8 Sep 2019 21:23:49 +0000 (22:23 +0100)]
openresolv: Update README

2 months agoMerge branch 'vendor/OPENRESOLV' with the following changes:
Roy Marples [Sun, 8 Sep 2019 21:15:16 +0000 (22:15 +0100)]
Merge branch 'vendor/OPENRESOLV' with the following changes:
  *  dnsmasq: clear cache after updating servers via dbus
  *  pdns_recursor: Fix global forwards (thus now installed by default)
  *  man: layout and misc fixes

2 months agoImport openresolv-3.9.2 to vendor branch. vendor/OPENRESOLV
Roy Marples [Sun, 8 Sep 2019 21:11:05 +0000 (22:11 +0100)]
Import openresolv-3.9.2 to vendor branch.

2 months agosbin/newfs_msdos: Bring in FreeBSD/Git 902f77041b477be4d9d99608b463be01ac7611ea
Tomohiro Kusumi [Sun, 8 Sep 2019 18:08:08 +0000 (03:08 +0900)]
sbin/newfs_msdos: Bring in FreeBSD/Git 902f77041b477be4d9d99608b463be01ac7611ea

Invalidate FSI_Nxt_Free hint in FSInfo for FAT32.

2 months agosys/vfs/msdosfs: Sync with FreeBSD (non functional diffs)
Tomohiro Kusumi [Sat, 7 Sep 2019 17:33:01 +0000 (02:33 +0900)]
sys/vfs/msdosfs: Sync with FreeBSD (non functional diffs)

2 months agoroute: Seperate route messages from creation/lookup.
Roy Marples [Sun, 8 Sep 2019 10:56:18 +0000 (11:56 +0100)]
route: Seperate route messages from creation/lookup.

This allows a more fine grained choice about whether to announce
messsages via route(4) or not.

For example, a freshly added clone route is useless without the
resolved hardware address it's talking to.
Instead, announce the route when the hardware address has
been resolved, changed or if it's not resolvable.

For IPv6 destinations, we can now interpret RTM_MISS as unreachable.
This allows listening software to take action, such as soliciting
a new router if the destination missed was originally a router.

Reviewed-by: sephe
2 months agosys/vfs/msdosfs: Cleanups
Tomohiro Kusumi [Sat, 7 Sep 2019 07:52:31 +0000 (16:52 +0900)]
sys/vfs/msdosfs: Cleanups

2 months agosys/vfs/msdosfs: u_int*_t -> uint*_t
Tomohiro Kusumi [Fri, 6 Sep 2019 17:27:05 +0000 (02:27 +0900)]
sys/vfs/msdosfs: u_int*_t -> uint*_t

2 months agoieee80211: set link state before notifying of link state change
Roy Marples [Fri, 6 Sep 2019 22:41:30 +0000 (23:41 +0100)]
ieee80211: set link state before notifying of link state change

Unknown link state is no good for any interface.
Set the state before calling out.
Now dhcpcd can see that wireless links are actually up

2 months agoftpd(8): No need to specify WFORMAT=0 explicitly in the Makefile.
Sascha Wildner [Fri, 6 Sep 2019 19:51:53 +0000 (21:51 +0200)]
ftpd(8): No need to specify WFORMAT=0 explicitly in the Makefile.

2 months agosys/vfs/msdosfs: Drop redundant msdosfsmount::pm_fatsize
Tomohiro Kusumi [Fri, 6 Sep 2019 15:05:13 +0000 (00:05 +0900)]
sys/vfs/msdosfs: Drop redundant msdosfsmount::pm_fatsize

No need to keep incore FAT byte size in ulong.

2 months agoroute: ensure RTM_IFINFO is sent first when bring interface down/up
Roy Marples [Fri, 6 Sep 2019 16:36:13 +0000 (17:36 +0100)]
route: ensure RTM_IFINFO is sent first when bring interface down/up

Taking an interface down can generate a lot of route messages.
This can overflow the route socket, so ensure that the most
important message is sent first - that of the interface state.

While here, these functions can be made static.

2 months agosys/vfs/msdosfs: Add description for fatblock()
Tomohiro Kusumi [Thu, 5 Sep 2019 20:58:17 +0000 (05:58 +0900)]
sys/vfs/msdosfs: Add description for fatblock()

2 months agosbin/route: Improve display of socket errors
Roy Marples [Fri, 6 Sep 2019 13:23:14 +0000 (14:23 +0100)]
sbin/route: Improve display of socket errors

2 months agosbin/route: Add support for printing link state from RTM_IFINFO
Roy Marples [Fri, 6 Sep 2019 13:06:06 +0000 (14:06 +0100)]
sbin/route: Add support for printing link state from RTM_IFINFO

Taken-from: NetBSD

2 months agosbin/route: Add support for printing RTM_IEEE80211 messages
Roy Marples [Fri, 6 Sep 2019 12:42:06 +0000 (13:42 +0100)]
sbin/route: Add support for printing RTM_IEEE80211 messages

Taken-from: NetBSD

2 months agosbin/route: Add support for SO_RERROR and log errors for monitor
Roy Marples [Fri, 6 Sep 2019 12:22:44 +0000 (13:22 +0100)]
sbin/route: Add support for SO_RERROR and log errors for monitor

2 months agosbin/hammer2: Remove unused if0'd malloc/free wrappers
Tomohiro Kusumi [Thu, 5 Sep 2019 14:08:04 +0000 (23:08 +0900)]
sbin/hammer2: Remove unused if0'd malloc/free wrappers

Unused since 0c3a8cd0eb169fa13895a5691f9a1c298c489721 in 2012.
Prototypes have also been removed from header.

2 months agolib/libc: Whitespace fix
Tomohiro Kusumi [Thu, 5 Sep 2019 13:15:03 +0000 (22:15 +0900)]
lib/libc: Whitespace fix

2 months agodhcpcd: Fix buildworld
Antonio Huete Jimenez [Wed, 4 Sep 2019 23:10:35 +0000 (01:10 +0200)]
dhcpcd: Fix buildworld

  - Fix based on 31f23bc71ced3b. Also pointed out by
    kworr.

2 months agodhcpcd: Remove left over patches.
Roy Marples [Wed, 4 Sep 2019 19:43:28 +0000 (20:43 +0100)]
dhcpcd: Remove left over patches.

2 months agodrm/linux: Add atomic64_inc_return()
François Tigeot [Wed, 4 Sep 2019 19:28:09 +0000 (21:28 +0200)]
drm/linux: Add atomic64_inc_return()

Obtained-from: OpenBSD

2 months agodrm/radeon: Correct FIRMWARE_BONAIRE definition
François Tigeot [Wed, 4 Sep 2019 19:23:55 +0000 (21:23 +0200)]
drm/radeon: Correct FIRMWARE_BONAIRE definition

Submitted-by: zrj
2 months agodhcpcd: Adjust Makefile for dhcpcd-8.0.4
Roy Marples [Wed, 4 Sep 2019 18:32:37 +0000 (19:32 +0100)]
dhcpcd: Adjust Makefile for dhcpcd-8.0.4

2 months agodhcpcd: Import new config.h
Roy Marples [Wed, 4 Sep 2019 18:31:07 +0000 (19:31 +0100)]
dhcpcd: Import new config.h

2 months agodhcpcd: Add README.DRAGONFLY
Roy Marples [Wed, 4 Sep 2019 18:30:39 +0000 (19:30 +0100)]
dhcpcd: Add README.DRAGONFLY

2 months agoMerge dhcpcd-8.0.4 from branch 'vendor/DHCPCD'
Roy Marples [Wed, 4 Sep 2019 18:29:08 +0000 (19:29 +0100)]
Merge dhcpcd-8.0.4 from branch 'vendor/DHCPCD'

2 months agosbin/Makefile: Sort SUBDIR.
Sascha Wildner [Wed, 4 Sep 2019 17:51:54 +0000 (19:51 +0200)]
sbin/Makefile: Sort SUBDIR.

2 months agoImport dhcpcd-8.0.4 to vendor branch.
Roy Marples [Wed, 4 Sep 2019 16:55:23 +0000 (17:55 +0100)]
Import dhcpcd-8.0.4 to vendor branch.

2 months agodsynth - Add hook_* support (2)
Matthew Dillon [Tue, 3 Sep 2019 19:44:54 +0000 (12:44 -0700)]
dsynth - Add hook_* support (2)

* Fix bug in call to doHook()

2 months agolib/libdmsg: Fix compile warnings on Linux distros
Tomohiro Kusumi [Tue, 3 Sep 2019 07:58:42 +0000 (16:58 +0900)]
lib/libdmsg: Fix compile warnings on Linux distros

--
crypto.c:210: warning: pointer targets in passing argument 5 of 'EVP_EncryptInit_ex' differ in signedness
/usr/include/openssl/evp.h:586: note: expected 'const unsigned char *' but argument is of type 'char *'
crypto.c:216: warning: pointer targets in passing argument 2 of 'EVP_EncryptUpdate' differ in signedness
/usr/include/openssl/evp.h:588: note: expected 'unsigned char *' but argument is of type 'char *'
crypto.c:216: warning: pointer targets in passing argument 4 of 'EVP_EncryptUpdate' differ in signedness
/usr/include/openssl/evp.h:588: note: expected 'const unsigned char *' but argument is of type 'char *'
crypto.c:221: warning: pointer targets in passing argument 2 of 'EVP_EncryptFinal' differ in signedness
/usr/include/openssl/evp.h:591: note: expected 'unsigned char *' but argument is of type 'char *'
...

2 months agolib/libdmsg: Fix compile warnings on Linux distros
Tomohiro Kusumi [Mon, 2 Sep 2019 23:00:07 +0000 (08:00 +0900)]
lib/libdmsg: Fix compile warnings on Linux distros

--
crypto.c: In function 'dmsg_crypto_negotiate':
crypto.c:552: warning: pointer targets in passing argument 2 of 'RSA_private_encrypt' differ in signedness
/usr/include/openssl/rsa.h:305: note: expected 'const unsigned char *' but argument is of type 'char *'
crypto.c:552: warning: pointer targets in passing argument 3 of 'RSA_private_encrypt' differ in signedness
/usr/include/openssl/rsa.h:305: note: expected 'unsigned char *' but argument is of type 'char *'

2 months agodsynth - Add hook_* support
Matthew Dillon [Tue, 3 Sep 2019 03:28:51 +0000 (20:28 -0700)]
dsynth - Add hook_* support

* Add hook_* support.  Note that hook_run_start and hook_run_end are
  serialized, but all package-building hooks can run concurrently with
  each other.

  The package-building hooks are: success, failure, ignored, and
  skipped.

2 months agosys/vfs/msdosfs: Cleanups
Tomohiro Kusumi [Sun, 1 Sep 2019 23:22:11 +0000 (08:22 +0900)]
sys/vfs/msdosfs: Cleanups

2 months agosys/vfs/msdosfs: Add mprintf()
Tomohiro Kusumi [Sun, 1 Sep 2019 19:44:01 +0000 (04:44 +0900)]
sys/vfs/msdosfs: Add mprintf()

2 months agosys/vfs/msdosfs: Cleanups
Tomohiro Kusumi [Sun, 1 Sep 2019 16:51:01 +0000 (01:51 +0900)]
sys/vfs/msdosfs: Cleanups

2 months agosys/vfs/msdosfs: Cleanups
Tomohiro Kusumi [Sun, 1 Sep 2019 12:30:12 +0000 (21:30 +0900)]
sys/vfs/msdosfs: Cleanups

2 months agosys/vfs/msdosfs: Whitespace cleanups
Tomohiro Kusumi [Sat, 31 Aug 2019 16:22:17 +0000 (01:22 +0900)]
sys/vfs/msdosfs: Whitespace cleanups

Mostly trailing whitespace and >80 chars per line.
Also remove redundant static function prototypes.

2 months agocdefs.h/libm: Add __sym_{compat,default}() helper macros and use in libm.
Sascha Wildner [Sat, 31 Aug 2019 19:12:42 +0000 (21:12 +0200)]
cdefs.h/libm: Add __sym_{compat,default}() helper macros and use in libm.

While here, change the "past<function>" naming scheme to "past_<function>"
like it is already for "weak_" and "imprecise_" cases.

Macros-taken-from: FreeBSD

2 months agosbin/hammer2: Introduce hammer2_media_config::thread_started
Tomohiro Kusumi [Sat, 31 Aug 2019 13:09:33 +0000 (22:09 +0900)]
sbin/hammer2: Introduce hammer2_media_config::thread_started

Don't test ->thread address itself to test if a pthread is running.
Having assumption on actual type breaks portability.

2 months agosbin/hammer2: Don't assume pthread_t is a pointer
Tomohiro Kusumi [Sat, 31 Aug 2019 12:47:45 +0000 (21:47 +0900)]
sbin/hammer2: Don't assume pthread_t is a pointer

NULL initialization isn't necessary.
Also having assumption on actual type breaks portability.

2 months agowho/utmpentry: Clean up a bit.
Sascha Wildner [Fri, 30 Aug 2019 17:39:38 +0000 (19:39 +0200)]
who/utmpentry: Clean up a bit.

* Use _Static_assert() for assertions.

* Remove #if 1.

2 months agoenv(1)/printenv(1): Bump .Dd, remove (void) casts.
Sascha Wildner [Sat, 17 Aug 2019 20:06:57 +0000 (22:06 +0200)]
env(1)/printenv(1): Bump .Dd, remove (void) casts.

2 months agoSync utmp_update(8) with NetBSD.
Sascha Wildner [Fri, 30 Aug 2019 17:20:39 +0000 (19:20 +0200)]
Sync utmp_update(8) with NetBSD.

Not much to see here.

2 months agosetutxdb(3): Constify the file name argument.
Sascha Wildner [Fri, 30 Aug 2019 17:03:30 +0000 (19:03 +0200)]
setutxdb(3): Constify the file name argument.

Taken-from: FreeBSD

2 months agolibc/utmpx: Some updates from NetBSD.
Sascha Wildner [Fri, 30 Aug 2019 17:01:23 +0000 (19:01 +0200)]
libc/utmpx: Some updates from NetBSD.

* Open some various descriptors as close-on-exec.

* Remove dead code.

* Use VIS_NOLOCALE in the strvisx().

2 months ago<utmpx.h>: Some small updates.
Sascha Wildner [Fri, 30 Aug 2019 16:43:41 +0000 (18:43 +0200)]
<utmpx.h>: Some small updates.

* Add comments to the standard ut_type constants. Taken from FreeBSD.

* Put a number of non-standard structs, enums and constants under
  __BSD_VISIBLE. Add some explaining comments. Taken from NetBSD.

2 months agoinit(8): Pass waitpid() status to clear_session_logs() and log to wtmpx.
Sascha Wildner [Thu, 29 Aug 2019 15:30:46 +0000 (17:30 +0200)]
init(8): Pass waitpid() status to clear_session_logs() and log to wtmpx.

Taken-from: NetBSD

2 months agodrm/linux: Add kstrtol()
François Tigeot [Wed, 28 Aug 2019 20:04:26 +0000 (22:04 +0200)]
drm/linux: Add kstrtol()

Obtained-from: FreeBSD

2 months agodrm: Make it clear CONFIG_GENERIC_ATOMIC64 is not set on x86
François Tigeot [Wed, 28 Aug 2019 19:57:25 +0000 (21:57 +0200)]
drm: Make it clear CONFIG_GENERIC_ATOMIC64 is not set on x86

2 months agojail.8 - Adjust manpage for the new changes
Antonio Huete Jimenez [Tue, 27 Aug 2019 17:21:09 +0000 (19:21 +0200)]
jail.8 - Adjust manpage for the new changes

2 months agorc: Adjust rc.d/jail for the new changes
Antonio Huete Jimenez [Sat, 24 Aug 2019 19:14:47 +0000 (21:14 +0200)]
rc: Adjust rc.d/jail for the new changes

2 months agojail - Remove MPLOCK
Antonio Huete Jimenez [Sat, 24 Aug 2019 18:03:36 +0000 (20:03 +0200)]
jail - Remove MPLOCK

  - Replace with a lockmgr global lock.

2 months agojail - Rework sysctl configuration variables
Antonio Huete Jimenez [Wed, 21 Aug 2019 00:35:42 +0000 (02:35 +0200)]
jail - Rework sysctl configuration variables

- Jail sysctls are now jail-specific so that different jails
  can have different settings.
  Each jail will have its own subtree which can be operated
  directly with sysctl(8).

  Naming convention:

      jail.<n>.<setting>

- All previous sysctls are now moved to 'jail.defaults' and they
  are used as a template for any newly created jail.

  Example:

  # jls
  JID     Hostname        Path            IPs
  2       t02.local       /jails/02       10.0.0.3
  1       t01.local       /jails/01       10.0.0.2

  # sysctl jail
  jail.jailed: 0
  jail.list: 2 t02.local /jails/02 10.0.0.3
  1 t01.local /jails/01 10.0.0.2
  jail.defaults.allow_raw_sockets: 0
  jail.defaults.chflags_allowed: 0
  jail.defaults.sysvipc_allowed: 0
  jail.defaults.socket_unixiproute_only: 1
  jail.defaults.set_hostname_allowed: 1
  jail.1.set_hostname_allowed: 1
  jail.1.socket_unixiproute_only: 1
  jail.1.sysvipc_allowed: 0
  jail.1.chflags_allowed: 0
  jail.1.allow_raw_sockets: 0
  jail.2.set_hostname_allowed: 1
  jail.2.socket_unixiproute_only: 1
  jail.2.sysvipc_allowed: 0
  jail.2.chflags_allowed: 0
  jail.2.allow_raw_sockets: 0

  # sysctl jail.2.allow_raw_sockets=1
  jail.2.allow_raw_sockets: 0 -> 1

  # jexec 2 ping -q -c 1 10.0.0.1
  PING 10.0.0.1 (10.0.0.1): 56 data bytes

  --- 10.0.0.1 ping statistics ---
  1 packets transmitted, 1 packets received, 0.0% packet loss
  round-trip min/avg/max/stddev = 0.766/0.766/0.766/0.000 ms

  # jexec 1 ping -q -c 1 10.0.0.1
  ping: socket: Operation not permitted

  # service jail stop
  Stopping jails: t01.local t02.local.

  # sysctl jail
  jail.jailed: 0
  jail.defaults.allow_raw_sockets: 0
  jail.defaults.chflags_allowed: 0
  jail.defaults.sysvipc_allowed: 0
  jail.defaults.socket_unixiproute_only: 1
  jail.defaults.set_hostname_allowed: 1

2 months agodrm: Enable drm_pcie_get_max_link_width()
François Tigeot [Tue, 27 Aug 2019 21:51:51 +0000 (23:51 +0200)]
drm: Enable drm_pcie_get_max_link_width()

Partially obtained from FreeBSD.

2 months agodsynth - Abstract the run-status infrastructure
Matthew Dillon [Tue, 27 Aug 2019 05:31:41 +0000 (22:31 -0700)]
dsynth - Abstract the run-status infrastructure

* Abstract the run-status infrastructure and add skeletons for html
  and a 'dsynth monitor' style monitor.

  Neither is implemented yet but this moves most of the hard work
  out of gui.c (and renames it to ncurses.c) so it doesn't have to
  be replicated for the other two.

2 months agodsynth - Make rebuild-repository work again
Matthew Dillon [Tue, 27 Aug 2019 04:12:55 +0000 (21:12 -0700)]
dsynth - Make rebuild-repository work again

* Provide a meta file for the package format since it is
  different from the default.

* Fixes the rebuild-repository directive.

2 months agodsynth - Fix bug in pty interlock handshake
Matthew Dillon [Mon, 26 Aug 2019 18:42:47 +0000 (11:42 -0700)]
dsynth - Fix bug in pty interlock handshake

* login_tty() closes slavefd so the handshake wasn't working.
  Read from descriptor 0 instead, which login_tty() has set
  up with the slave tty.

2 months agodsynth - Cleanup
Matthew Dillon [Mon, 26 Aug 2019 18:37:46 +0000 (11:37 -0700)]
dsynth - Cleanup

* Fix a minor issue where some Ignored packages were being put in
  the Skip list instead.

* Adjust setproctitle() calls to include the flavor, if any for
  the workers.

* Minor cleanup and code safety.

2 months agodsynth - Implement 'test' and 'force', conditional /usr/src, etc
Matthew Dillon [Mon, 26 Aug 2019 06:40:02 +0000 (23:40 -0700)]
dsynth - Implement 'test' and 'force', conditional /usr/src, etc

* Implement the 'test' and 'force' directives.  Implement
  removal of manually specified packages.  If a generic flavor
  or a meta-port is specified, its direct dependency list will
  also be removed.

* If /usr/src exists under the system directory, mount it in the
  chroot (to support USES=kmod modules).

* Wire up UseCCache but leave disabled and require it to be
  disabled for now.

* Print a build summary at the end.

2 months agodsynth - Add missing env vars for dports scan
Matthew Dillon [Mon, 26 Aug 2019 01:26:39 +0000 (18:26 -0700)]
dsynth - Add missing env vars for dports scan

* PACKAGE_BUILDING was being set in the builder but not in the initial
  dports scan.

* Refactor part of the BuildEnv API to allow the code to set variables
  for the scan vs generally.

2 months agodsynth - Fix master/slave pty race on fork()
Matthew Dillon [Sun, 25 Aug 2019 19:23:37 +0000 (12:23 -0700)]
dsynth - Fix master/slave pty race on fork()

* If we try to re-open the slave in the forked child of the WORKER monitor,
  the worker monitor may race the child when it tries to read from the
  master side fd before the child has opened the slave, causing an error.

* If we re-open the slave in the WORKER monitor then the worker monitor
  must not block when it close()s the slave descriptor after forking a
  child.  But it will if the child has written anything.

  The solution is to re-open the slave in the master but to have the
  master write 1 char to the slave after close()ing the slavefd.  The
  forked slave will read this character before proceeding, thus ensuring
  that there is no output in the buffer when the master close()es
  its slavefd.

2 months agokernel - Fix devfs bitmap races for pty and other devices (2)
Matthew Dillon [Sun, 25 Aug 2019 18:31:40 +0000 (11:31 -0700)]
kernel - Fix devfs bitmap races for pty and other devices (2)

* Fix bug in 1991e949fd5da due to misinterpretation of how
  devfs_clone_bitmap_get() worked in the vn code.

2 months agoPartial revert of "drm: Partially sync drm_ioctl() with Linux 4.7.10"
François Tigeot [Sun, 25 Aug 2019 09:45:33 +0000 (11:45 +0200)]
Partial revert of "drm: Partially sync drm_ioctl() with Linux 4.7.10"

This reverts commit c22b03749c861bc699168784bdafe2e43317465f.

It was causing application hangs with 100% cpu usage.

2 months agokcollect - Remove system calls from graph
Matthew Dillon [Sat, 24 Aug 2019 17:16:01 +0000 (10:16 -0700)]
kcollect - Remove system calls from graph

* System calls make the graph too scratchy.  Remove them for now.

2 months agodsynth - Stabilization, improve compatibility
Matthew Dillon [Sat, 24 Aug 2019 16:56:40 +0000 (09:56 -0700)]
dsynth - Stabilization, improve compatibility

* Disable /etc/make.conf for the bulk scan (__MAKE_CONF=/dev/null)

* Add -D to turn on developer mode (from zrj)

* Add a little infrastructure to cache ports variables, starting
  with _PERL5_FROM_BIN.

2 months agodsynth - Do not count DUMMY nodes in the total
Matthew Dillon [Sat, 24 Aug 2019 15:40:49 +0000 (08:40 -0700)]
dsynth - Do not count DUMMY nodes in the total

* dsynth uses DUMMY nodes to wrap all the flavors for a particular
  package when other packages have a generic (rather than flavor-specific)
  dependency to it.

* Do not count these nodes in the total for display purposes.

2 months agodrm/ttm: Partially sync the vm fault code with Linux
François Tigeot [Sat, 24 Aug 2019 12:17:17 +0000 (14:17 +0200)]
drm/ttm: Partially sync the vm fault code with Linux

Prevent crashes with Mesa-using applications.

2 months agodrm/linux: Move vm_area_struct definition to the right header
François Tigeot [Sat, 24 Aug 2019 12:11:31 +0000 (14:11 +0200)]
drm/linux: Move vm_area_struct definition to the right header

2 months agodrm/radeon: Use mm->mmap_sem
François Tigeot [Sat, 24 Aug 2019 12:10:12 +0000 (14:10 +0200)]
drm/radeon: Use mm->mmap_sem

2 months agodrm - Refactor task_struct and implement mm_struct
Matthew Dillon [Wed, 7 Aug 2019 05:34:17 +0000 (22:34 -0700)]
drm - Refactor task_struct and implement mm_struct

* Change td->td_linux_task from an embedded structure to a pointer.

* Add p->p_linux_mm to support tracking mm_struct's.

* Change the 'current' macro to test td->td_linux_task and call
  a support function, linux_task_alloc(), if it is NULL.

* Implement callbacks from the main kernel for thread exit and
  process exit to support functions that drop the td_linux_task and
  p_linux_mm pointers.

  Initialize and clear these callbacks in the module load/unload
  in drm_drv.c

* Implement required support functions in linux_sched.c

2 months agodrm/radeon: Update to Linux 4.7.10
François Tigeot [Sat, 24 Aug 2019 12:06:54 +0000 (14:06 +0200)]
drm/radeon: Update to Linux 4.7.10

* Various bugfixes, especially related to Displayport and
  vblank handling

* Sea Islands and Southern Islands GPUs support improvements

* Various quirks to fix problems for specific cards, mostly
  Radeon R7 370 and Radeon R9 270X models

2 months agodrm/linux: down_read() acquiress a shared lock
François Tigeot [Sat, 24 Aug 2019 11:21:28 +0000 (13:21 +0200)]
drm/linux: down_read() acquiress a shared lock

2 months agodsynth - Account for extraction size
Matthew Dillon [Sat, 24 Aug 2019 02:47:40 +0000 (19:47 -0700)]
dsynth - Account for extraction size

* Account for the initial size of /construction after the extract
  phase.

  Note that we explicitly are not accounting for space used after this
  phase because they files (typically .o's and such) are added incrementally
  and often not accessed continuously until the ending link phase.  Including
  this space thus might cause dsynth to retard the worker count too much.

2 months agodsynth - More pkg dependency fixes
Matthew Dillon [Sat, 24 Aug 2019 00:57:41 +0000 (17:57 -0700)]
dsynth - More pkg dependency fixes

* Fix the depency check based on the depth when recursing through a
  dummy node.  Dummy nodes do not increment the depth.

* In addition, recursing through a dummy node means that the package
  only depends on the default flavor, which is only the first element
  in the idepon list under that dummy node.  Inform the next layer
  that its scan should only iterate one element.

* In addition, when build_find_leaves() recurses through a dummy node
  also use the same mechanism where only the first sub-node is
  checked, because the dependency is (again) against just the default
  flavor.

  Note that when doing a 'dsynth everything', all the dependencies
  wind up in the root list, so all the flavors get built.  But when
  building a specific subset of packages, this fix will reduce the
  number of flavors that have to be built as dependencies.