14 months agoMerge branch 'vendor/DHCPCD'
Roy Marples [Fri, 20 Dec 2019 12:14:18 +0000 (12:14 +0000)]
Merge branch 'vendor/DHCPCD'

14 months agoImport dhcpcd-8.1.3 with the following changes:
Roy Marples [Fri, 20 Dec 2019 12:09:22 +0000 (12:09 +0000)]
Import dhcpcd-8.1.3 with the following changes:

 * dhcpcd: Only report SSID when we have a carrier
 * IPv6ND: Fix reachable test
 * DHCP6: Work better with infinite addresses
 * DHCP6: Suboption 3 of NTP Server is a FQDN
 * DHCP6: Fix deprecating a delegated prefix
 * DHCP: Ensure we have a lease to extract options from

14 months agolibkvm - Minor fix to debugging code
Matthew Dillon [Thu, 19 Dec 2019 07:10:10 +0000 (23:10 -0800)]
libkvm - Minor fix to debugging code

* Fix mask generation in dump_blist() -> scanradix().

* No affect during normal operation of the library.

Submitted-by: swildner
14 months agoinet: Add support for IPv4 /31 prefixes, as described in RFC 3021.
Roy Marples [Wed, 18 Dec 2019 16:30:12 +0000 (16:30 +0000)]
inet: Add support for IPv4 /31 prefixes, as described in RFC 3021.

To run a /31 network, participating hosts MUST drop support
for directed broadcasts, and treat the first and last addresses
on subnet as unicast. The broadcast address for the prefix
should be the link local broadcast address, INADDR_BROADCAST.

Taken from FreeBSD, r226402.

14 months agokernel - Fix rman_make_alignment_flags()
Matthew Dillon [Wed, 18 Dec 2019 16:27:23 +0000 (08:27 -0800)]
kernel - Fix rman_make_alignment_flags()

* Fix rman_make_alignment_flags() to work properly up to 2^63.
  Remove assumption about being able to shift a 32-bit integer
  by 32, this is not hardware-portable.

* Note that this function is only used by ancient pccard code

Reported-by: swildner
14 months agortld - Remove 'register' keyword
Matthew Dillon [Wed, 18 Dec 2019 16:20:08 +0000 (08:20 -0800)]
rtld - Remove 'register' keyword

* Remove use of 'register'.

14 months agortld-elf - Fix ancient C code
Matthew Dillon [Wed, 18 Dec 2019 16:18:32 +0000 (08:18 -0800)]
rtld-elf - Fix ancient C code

* Adjust malloc() (used only by rtld-elf) to use size_t and fix
  a number of shift operations.

Submitted-by: swildner
14 months agosys/dev/disk/dm: Fix argc test for striped target
Tomohiro Kusumi [Wed, 18 Dec 2019 15:04:11 +0000 (00:04 +0900)]
sys/dev/disk/dm: Fix argc test for striped target

Should be 2 since stripe # could be 0.
taken-from: NetBSD

14 months agoleave - Allow up to 99 in the minutes field in + mode
Matthew Dillon [Wed, 18 Dec 2019 06:57:31 +0000 (22:57 -0800)]
leave - Allow up to 99 in the minutes field in + mode

* Allow the minutes field to specify up to the value 99 in
  + mode, just like microwaves and oven timers have for decades.

* Takes the app out of the dark ages and into... well, actually,
  its still in the dark ages.

Requested-by: zach
14 months agodrm: Improve sysfs implementation
François Tigeot [Tue, 17 Dec 2019 20:09:14 +0000 (21:09 +0100)]
drm: Improve sysfs implementation

* Add necessary code to really allocate or free Linux
  device structs associated with connectors.

* This prevents panics in DRM_DEBUG statements

Reported-by: Peeter Must
14 months agousr.sbin/fstyp: Fix copyright
Tomohiro Kusumi [Tue, 17 Dec 2019 16:19:16 +0000 (01:19 +0900)]
usr.sbin/fstyp: Fix copyright

hammer.c and hammer2.c aren't ported from FreeBSD.

14 months agousr.sbin/fstyp: Fix copying unterminated ondisk string
Tomohiro Kusumi [Tue, 17 Dec 2019 15:01:00 +0000 (00:01 +0900)]
usr.sbin/fstyp: Fix copying unterminated ondisk string

14 months agousr.sbin/fstyp: Expand LABEL_LEN to 512
Tomohiro Kusumi [Tue, 17 Dec 2019 14:43:03 +0000 (23:43 +0900)]
usr.sbin/fstyp: Expand LABEL_LEN to 512

In theory 256 could be too small for HAMMER2 especially since

14 months agokernel - Clean up minor kernel memory leak
Matthew Dillon [Tue, 17 Dec 2019 07:05:24 +0000 (23:05 -0800)]
kernel - Clean up minor kernel memory leak

* The ifconfig sysctl code was not filling every last byte of the
  returned buffer, creating a small memory leak.  Zero the buffer
  prior to filling it in to guarantee that no garbage is left in
  these spots.

14 months agokernel - Optimize nlookup() a bit more
Matthew Dillon [Tue, 17 Dec 2019 07:03:52 +0000 (23:03 -0800)]
kernel - Optimize nlookup() a bit more

* Optimize the fast-path for nlookup() for non-modifying
  operations (i.e. open() without O_CREAT, stat(), etc).  In
  such cases special directory modes need not be considered
  as long as world-execute permissions are present.

Suggested-by: mjg
14 months agokernel - Refactor malloc_type to reduce static data in image
Matthew Dillon [Tue, 17 Dec 2019 06:58:26 +0000 (22:58 -0800)]
kernel - Refactor malloc_type to reduce static data in image

* malloc_type was embedding a SMP_MAXCPU array of kmalloc_use
  structures, which winds up being 16KB a pop x 400+ MALLOC_DEFINE()

  This was over 6MB of static data in the kernel binary, and it
  wasn't BSS because the declaration is initialized with some defaults.
  So this reduction is significant and directly impacts both memory
  use and kernel boot times.

* Change malloc_type->ks_use from an array to a pointer.  Embed
  a single kmalloc_use structure (ks_use0) as the default.

  When ncpus is probed, the kernel now goes through all malloc_type
  structures and dynamically allocates a properly-sized ks_use
  array.  Any new malloc hoppers after that point will also dynamically
  allocate ks_use.

14 months agokern.pre.mk: Remove obsolete comment.
Sascha Wildner [Mon, 16 Dec 2019 16:26:04 +0000 (17:26 +0100)]
kern.pre.mk: Remove obsolete comment.

14 months agokern.pre.mk: Add back some Makefile code to fix VKERNEL64 (2)
Matthew Dillon [Mon, 16 Dec 2019 04:42:14 +0000 (20:42 -0800)]
kern.pre.mk: Add back some Makefile code to fix VKERNEL64 (2)

* Conditionalize the last commit so it only occurs
  for vkernel64 builds.

14 months ago<sys/types.h>: Add some *_T_DECLARED guards for upcoming work.
Sascha Wildner [Sun, 15 Dec 2019 22:40:33 +0000 (23:40 +0100)]
<sys/types.h>: Add some *_T_DECLARED guards for upcoming work.

These will be used when we clean up <sys/stat.h> and <dirent.h> in the
near future.

14 months agokern.pre.mk: Add back some Makefile code to fix VKERNEL64.
Sascha Wildner [Sun, 15 Dec 2019 22:38:47 +0000 (23:38 +0100)]
kern.pre.mk: Add back some Makefile code to fix VKERNEL64.

I removed this by mistake in c47c81dbc5495f8c4fa01a238784813eb56a239e.

Seems this is still needed, even though we inherited it from FreeBSD
before we had the vkernel.

Reported-by: tuxillo
14 months agodrm/linux: Fix io_mapping() functions
François Tigeot [Sun, 15 Dec 2019 22:13:04 +0000 (23:13 +0100)]
drm/linux: Fix io_mapping() functions

These functions were mostly stubs and did not properly set memory
cache attributes causing some operations like framebuffer access
to be excessively slow.

Use ioremap() variants internally to fix that.

Spotted-by: peeter, dillon
14 months agokernel - Test pending ints in more crit_exit*() paths
Matthew Dillon [Sun, 15 Dec 2019 20:24:02 +0000 (12:24 -0800)]
kernel - Test pending ints in more crit_exit*() paths

* A number of crit_exit*() paths, primarily in the mutex and
  spinlock code, were not testing for interrupts made pending
  on the last unwind of the critical section.

  This was originally intended to improve performance, but it
  can lead to non-deterministic latencies for processing interrupts.

* Process these pending events in such cases.  We will see if it
  affects performance but I don't think it will be noticeable.

14 months agokernel - Improve pmap_change_attr() when used on the DMAP
Matthew Dillon [Sun, 15 Dec 2019 20:18:44 +0000 (12:18 -0800)]
kernel - Improve pmap_change_attr() when used on the DMAP

* When used on the DMAP's 1GB or 2MB pages pmap_change_attr()
  basically didn't work because it tries to access terminal PTEs
  (and there aren't any), instead accidently accessing the
  underlying physical memory and causing corruption.

* Fix this by (1) Forcing the DMAP to use 2MB pages and
  (2) special-casing DMAP addresses in pmap_change_attr()
  to act on the PDEs.

* This is not a complete fix because the granularity for
  any DMAP VAs will still be ~2MB and not 4K.  Its use by
  the DRM subsystem requires more investigation.  But the
  changes should improve some of the reported GPU corruption

Reported-by: peeter
Testing-by: multiple
14 months agokern.{post,pre}.mk: Clean up a bit.
Sascha Wildner [Sat, 14 Dec 2019 19:06:46 +0000 (20:06 +0100)]
kern.{post,pre}.mk: Clean up a bit.

* eddep is not used in kernel context.

* linterrs and the lint target should have been removed when I removed
  xlint back in 84f800532904979799aaeb8123487026f76a6640.

* setdef[01].c and setdefs.h should have been removed when gensetdefs
  was removed in 5e0107f67f7c659007103f791401be27957081cf.

* Remove some old FreeBSD inherited code that we don't need to build
  a kernel without /usr/src.

* While here, Remove unneeded quotation marks around two include

14 months agophantasia(6): Fix monters file permissions.
zrj [Sat, 14 Dec 2019 10:24:14 +0000 (12:24 +0200)]
phantasia(6): Fix monters file permissions.

 Allow games group to write too.

Reported-by: zach
14 months agokernel: Remove various (mostly commented out) references to vnode_if.[ch].
Sascha Wildner [Sat, 14 Dec 2019 08:30:25 +0000 (09:30 +0100)]
kernel: Remove various (mostly commented out) references to vnode_if.[ch].

14 months agodrm/i915: Fix VGA_SWITCHEROO option handling
François Tigeot [Sat, 14 Dec 2019 07:08:31 +0000 (08:08 +0100)]
drm/i915: Fix VGA_SWITCHEROO option handling

Reported-by: Peeter Must
14 months agodu - Add an option to generate results based on file size
Matthew Dillon [Fri, 13 Dec 2019 19:06:34 +0000 (11:06 -0800)]
du - Add an option to generate results based on file size

* By default du generates results based on st_blkcnt, the actual
  number of blocks used on-media.  This value might be smaller than
  the file size due to filesystem-level compression, or possibly
  larger due to the filesystem also counting overhead for indirect

* Add the -t option.  This option generates results based simply
  on the file size (st_size), and assumes a 512-byte media

  This option gives you an idea of the transmittable bytes if you
  were to copy the file elsewhere.

14 months agosio - Refactor some of the sio code
Matthew Dillon [Fri, 13 Dec 2019 01:36:56 +0000 (17:36 -0800)]
sio - Refactor some of the sio code

* Refactor some of the sio serial port code to reduce the amount of
  time the com_lock() is held and to allow the siointr*() receive
  buffer in the softc to pipeline.

14 months agodocs - Add note about powerd and serial port operation
Matthew Dillon [Fri, 13 Dec 2019 01:32:53 +0000 (17:32 -0800)]
docs - Add note about powerd and serial port operation

* Serial port operation at high baud rates such as 115200 may
  lose characters if powerd is allowed to reduce the CPU
  frequency below 1500 MHz.

* Document this fact and include a suggestion for powerd_flags
  if this is not desired.

14 months agodsynth - Improve compatibility with newer pkg's
Matthew Dillon [Thu, 12 Dec 2019 20:35:30 +0000 (12:35 -0800)]
dsynth - Improve compatibility with newer pkg's

* pkg is going through a bit of an evolution in its support for
  suffixes other than .txz, causing some issues with the generation
  of the database and meta file that 'pkg install' fetches.

* In versions before 1.12 pkg always generated .txz database and
  meta files, but pkg install looked for the suffix specified in
  meta.txz for the database files.

  In this case the database files have to be recompressed to
  the requested suffix.

* In versions >= 1.12 (up until the next fix), pkg generates
  the requested suffix, but unfortunately also for the meta file
  too whereas pkg install still looks for 'meta.txz'.

  In this case the meta.<suffix> file has to be recompressed
  using xz to a .txz.

* At some future point pkg repo and pkg install will match up,
  and dsynth may need another commit then.

  In this case no recompression will be needed to make pkg repo
  and pkg install play nicely with each other.

14 months agokernel/acpi: Fix debug.acpi.allow_method_calls functionality.
Sascha Wildner [Thu, 12 Dec 2019 12:06:46 +0000 (13:06 +0100)]
kernel/acpi: Fix debug.acpi.allow_method_calls functionality.

Adding SMAP (Supervisor Mode Access Protection) support back in May
(see 48c77f2b85f9ed807532e99b7187e6f5b5aa2975) caused it to (correctly)
panic on certain machines, such as the Dell XPS 9560, due to trying to
use a userspace pointer from the kernel.

FreeBSD has since fixed this in their sysutils/acpi_call port. This
commit pulls in these changes.

See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230993 for the

Submitted-by: Khamba Staring <qdk at quickdekay.net>
14 months agodrm/i915: Revert unintended changes in i915_params.c
François Tigeot [Thu, 12 Dec 2019 11:08:07 +0000 (12:08 +0100)]
drm/i915: Revert unintended changes in i915_params.c

They were introduced in 1487f78699db6b645ec307a207e4611f50a7cc53

14 months agousr.sbin/fstyp: Add device name to HAMMER2 label for autofs -media mount
Tomohiro Kusumi [Tue, 10 Dec 2019 20:02:26 +0000 (05:02 +0900)]
usr.sbin/fstyp: Add device name to HAMMER2 label for autofs -media mount

This helps autofs -media mount support multiple HAMMER2 mounts
if not perfect solution. The format may change in future.

Add minor fix to HAMMER1 label algorithm to sync with this commit.

14 months agopsm - Add Elantech touchpad IC type 15 found on Thinkpad L480 laptops
Matthew Dillon [Wed, 11 Dec 2019 01:30:53 +0000 (17:30 -0800)]
psm - Add Elantech touchpad IC type 15 found on Thinkpad L480 laptops

* Add support for thinkpad L480 laptops.

Suggested-by: aly
Taken-from: FreeBSD

14 months agodrm/i915: Update PCI IDs from Linux 5.4
François Tigeot [Tue, 10 Dec 2019 19:39:43 +0000 (20:39 +0100)]
drm/i915: Update PCI IDs from Linux 5.4

This brings in support for previously unknown models of Skylake,
Coffelake, Amber Lake, Whiskey Lake and Comet Lake GPUs.

14 months agodrm/i915: Update to Linux commit 1f15b76f1ec973d1eb5d21b6d98b21aebb9025f1
François Tigeot [Tue, 10 Dec 2019 19:32:08 +0000 (20:32 +0100)]
drm/i915: Update to Linux commit 1f15b76f1ec973d1eb5d21b6d98b21aebb9025f1

"Separate GPU hang waitqueue from advance"

14 months agodrm: Stop using an embedded struct drm_device in driver softcs
François Tigeot [Tue, 10 Dec 2019 17:45:22 +0000 (18:45 +0100)]
drm: Stop using an embedded struct drm_device in driver softcs

* All drm drivers use a struct drm_device record but are free to
  allocate it by themselves in different ways or let the generic
  drm subsystem code do it.

* This drm_device record can even be part of another data structure,
  dynamically or statically allocated.

* We cannot just assume the length of a drm_device structure in the
  softc memory block will be enough to store all driver private data.

* Make the drm softc the equivalent of a void* pointer and let the
  upstream code behave as expected on Linux

14 months agousr.sbin/fstyp: Add device name to HAMMER1 label for autofs -media mount
Tomohiro Kusumi [Tue, 10 Dec 2019 14:38:07 +0000 (23:38 +0900)]
usr.sbin/fstyp: Add device name to HAMMER1 label for autofs -media mount

This helps autofs -media mount support multiple HAMMER1 mounts
if not perfect solution. The format may change in future.

Note that this doesn't support HAMMER1 with multiple devices.

14 months agodrm/linux: Stop using driver softcs for dev_set/get_drvdata()
François Tigeot [Tue, 10 Dec 2019 08:51:04 +0000 (09:51 +0100)]
drm/linux: Stop using driver softcs for dev_set/get_drvdata()

15 months agoRemove wrong getvfsbytype.3 MLINK. The manpage doesn't document it.
Sascha Wildner [Sun, 8 Dec 2019 13:27:54 +0000 (14:27 +0100)]
Remove wrong getvfsbytype.3 MLINK. The manpage doesn't document it.

15 months agodrm: Add linux/smp.h
François Tigeot [Sun, 8 Dec 2019 09:33:39 +0000 (10:33 +0100)]
drm: Add linux/smp.h

15 months agosys/vfs/msdosfs: Minor msdosfs_readdir() sync up with FreeBSD
Tomohiro Kusumi [Sun, 8 Dec 2019 02:26:09 +0000 (11:26 +0900)]
sys/vfs/msdosfs: Minor msdosfs_readdir() sync up with FreeBSD

bits from freebsd/freebsd@d08f717585ab19a81dfc5bd8aed1ac4edcb2b157

DragonFly doesn't need dirent_terminate(), but it also doesn't need
to use strcpy() for dirent name given how vop_write_dirent() works.

15 months agohammer2 - Fix chain->error case in hammer2_chain_lookup()
Matthew Dillon [Sun, 8 Dec 2019 02:00:47 +0000 (18:00 -0800)]
hammer2 - Fix chain->error case in hammer2_chain_lookup()

* The chain->error case was not being properly handled in
  hammer2_chain_lookup(), resulting in either a panic or a
  permanent "xxx" stall.

* Fix the case so upper levels can properly process EIO and
  related issues.

15 months agohammer2 - Rename 'bcopy' variable to 'bsave'
Matthew Dillon [Fri, 6 Dec 2019 19:23:40 +0000 (11:23 -0800)]
hammer2 - Rename 'bcopy' variable to 'bsave'

* Rename variable to reduce confusion

15 months agogetconf(1): Support NPROCESSORS_* too in addition to _NPROCESSORS_*.
Sascha Wildner [Sun, 8 Dec 2019 01:40:12 +0000 (02:40 +0100)]
getconf(1): Support NPROCESSORS_* too in addition to _NPROCESSORS_*.

Improves compatibility with software that is used to a Linux environment.
Linux uses leading underscores in these variable names.

Pointed-out-by: zrj
15 months ago<cpu/ieeefp.h>: Just include <sys/cdefs.h> instead of complaining.
Sascha Wildner [Sat, 7 Dec 2019 11:51:06 +0000 (12:51 +0100)]
<cpu/ieeefp.h>: Just include <sys/cdefs.h> instead of complaining.

15 months ago<sys/cdefs.h>: Ensure that __{BSD,EXT1}_VISIBLE are never undefined.
Sascha Wildner [Sat, 7 Dec 2019 11:28:25 +0000 (12:28 +0100)]
<sys/cdefs.h>: Ensure that __{BSD,EXT1}_VISIBLE are never undefined.

This is to fix -Wundef warnings that might occur if the environment is
restricted to POSIX or X/Open.

Thanks to zrj for testing with a dports bulk build.

15 months ago<sys/stdarg.h>: Check if __cplusplus is defined before checking its value.
Sascha Wildner [Sat, 7 Dec 2019 11:25:14 +0000 (12:25 +0100)]
<sys/stdarg.h>: Check if __cplusplus is defined before checking its value.

15 months agodrm/linux: Add pci_map_rom() and pci_unmap_rom()
François Tigeot [Sat, 7 Dec 2019 08:07:48 +0000 (09:07 +0100)]
drm/linux: Add pci_map_rom() and pci_unmap_rom()

15 months agodrm/linux: pfn_to_page() returns a struct page*
François Tigeot [Sat, 7 Dec 2019 08:06:44 +0000 (09:06 +0100)]
drm/linux: pfn_to_page() returns a struct page*

15 months agokernel/getsockaddr: Remove a COMPAT_43 removal leftover.
Sascha Wildner [Sat, 7 Dec 2019 00:07:11 +0000 (01:07 +0100)]
kernel/getsockaddr: Remove a COMPAT_43 removal leftover.

It was overlooked in d6e8ab2d2508bde32ad7b7daaf86d44ec7330986.

Discussed-with: sephe

15 months agolibc: Fix some -Wmissing-prototypes warnings.
Sascha Wildner [Fri, 6 Dec 2019 21:51:35 +0000 (22:51 +0100)]
libc: Fix some -Wmissing-prototypes warnings.

15 months agodsynth - Conditionalize .txz -> other_compression_fmt for pkg repo
Matthew Dillon [Wed, 4 Dec 2019 18:40:25 +0000 (10:40 -0800)]
dsynth - Conditionalize .txz -> other_compression_fmt for pkg repo

* pkg version 1.12 or later properly uses the compression
  suffix when generating the repo database, the results do
  not need to be recompressed.

  Versions prior to 1.12 needed to be recompressed for
  compression formats other than .txz.

* Conditionalize based on pkg -v output.

Reported-by: zrj
15 months agomount_devfs.8: Adjust fstab example to include the mount type.
Antonio Huete Jimenez [Wed, 4 Dec 2019 11:32:28 +0000 (12:32 +0100)]
mount_devfs.8: Adjust fstab example to include the mount type.

 - Mount type (rw, ro, ...) is required in fstab, otherwise getfsent() will fail
   with EFTYPE.

15 months agojail: Use M_PRISON for sysctl allocation
Antonio Huete Jimenez [Tue, 3 Dec 2019 23:21:17 +0000 (00:21 +0100)]
jail: Use M_PRISON for sysctl allocation

15 months agojail: Allow jails to mount nullfs(5) and tmpfs(5)
Antonio Huete Jimenez [Tue, 3 Dec 2019 17:59:25 +0000 (17:59 +0000)]
jail: Allow jails to mount nullfs(5) and tmpfs(5)

 - The code is structured in a way that it should be easy to add more
   filesystems in the future.
 - User mounts are disabled in jails for now.
 - It is not allowed for jails to unmount filesystems that were not mounted
   within the jail itself.

Reviewed by: dillon, mjg

15 months ago<sys/jail.h>: Add nullfs, devfs and tmpfs filesystem privs
Antonio Huete Jimenez [Tue, 3 Dec 2019 15:33:37 +0000 (15:33 +0000)]
<sys/jail.h>: Add nullfs, devfs and tmpfs filesystem privs

15 months ago<sys/mount.h>: Add mnt_cred field
Antonio Huete Jimenez [Tue, 3 Dec 2019 00:04:19 +0000 (00:04 +0000)]
<sys/mount.h>: Add mnt_cred field

  - For now it can will be used to retrieve cr_prison which
    which indicate the prison that mountpoint belongs to.

15 months ago<sys/priv.h>: Add filesystem specific constants
Antonio Huete Jimenez [Mon, 2 Dec 2019 23:30:11 +0000 (23:30 +0000)]
<sys/priv.h>: Add filesystem specific constants

15 months agolibutil: Bring in a fparseln() bugfix from NetBSD.
Sascha Wildner [Mon, 2 Dec 2019 21:13:50 +0000 (22:13 +0100)]
libutil: Bring in a fparseln() bugfix from NetBSD.

Prevents fparseln() from reporting spurious empty lines when it shouldn't:


While here, optimize to prevent pointless realloc()s:


Reported-by: zrj
15 months agokernel - Warn on duplicate physical addresses passed from BIOS
Matthew Dillon [Mon, 2 Dec 2019 21:03:30 +0000 (13:03 -0800)]
kernel - Warn on duplicate physical addresses passed from BIOS

* Warn on duplicate PA free ranges passed from the BIOS instead
  of panicing.

* Try to fix buggy threadripper BIOSes.

15 months agodevfs - Ensure lock held around devfs_cdev_terminate() (2)
Matthew Dillon [Mon, 2 Dec 2019 20:53:55 +0000 (12:53 -0800)]
devfs - Ensure lock held around devfs_cdev_terminate() (2)

* Fix deadlock due to synchronous message sent via
  devfs_clone_bitmap_put() -> devfs_config().

15 months agosort.1: Mention that -o's argument can be one of the input files.
Sascha Wildner [Mon, 2 Dec 2019 20:25:03 +0000 (21:25 +0100)]
sort.1: Mention that -o's argument can be one of the input files.

15 months agodevfs - Ensure lock held around devfs_cdev_terminate()
Matthew Dillon [Mon, 2 Dec 2019 20:12:22 +0000 (12:12 -0800)]
devfs - Ensure lock held around devfs_cdev_terminate()

* Ensure that a lock is held around devfs_cdev_terminate() on
  sysref release (which can occur from any thread, not just the
  devfs thread).

15 months agojail: Simplify a bit by using the new BIT64 sysctl functions
Antonio Huete Jimenez [Mon, 2 Dec 2019 11:53:21 +0000 (12:53 +0100)]
jail: Simplify a bit by using the new BIT64 sysctl functions

  - No functional changes.
  - The per-jail settings have been renamed to match the new capability
    constants. The default settings will be renamed soon too.
  - Fix a missing prison chflags check in ufs_settattr() and

15 months agosysctl.9: Document the new BIT32/BIT64 functionality.
Antonio Huete Jimenez [Mon, 2 Dec 2019 01:11:39 +0000 (02:11 +0100)]
sysctl.9: Document the new BIT32/BIT64 functionality.

15 months ago<sys/sysctl.h>: Add runtime interface macros for BIT32/BIT64
Antonio Huete Jimenez [Mon, 2 Dec 2019 00:48:52 +0000 (01:48 +0100)]
<sys/sysctl.h>: Add runtime interface macros for BIT32/BIT64

  - Add SYSCTL_ADD_BIT32() and SYSCTL_ADD_BIT64() macros which allow using a
    sysctl context.

15 months agolibc: Change getlogin_r()'s second argument to size_t, as POSIX likes it.
Sascha Wildner [Sun, 1 Dec 2019 15:25:01 +0000 (16:25 +0100)]
libc: Change getlogin_r()'s second argument to size_t, as POSIX likes it.


Also adjust the getconf syscall, aka _getconf() in userland, which is
called by getconf(3) and getconf_r(3).

Approved-by: dillon
Tested-by: zrj
15 months ago<sys/stat.h>: Add S_TYPEISSEM() and S_TYPEISSHM() definitions.
Sascha Wildner [Sun, 1 Dec 2019 11:55:00 +0000 (12:55 +0100)]
<sys/stat.h>: Add S_TYPEISSEM() and S_TYPEISSHM() definitions.

15 months ago<sys/stat.h>: Fix odd indentation.
Sascha Wildner [Sun, 1 Dec 2019 11:32:40 +0000 (12:32 +0100)]
<sys/stat.h>: Fix odd indentation.

15 months agoRename some functions to better names.
Sascha Wildner [Sun, 1 Dec 2019 11:03:21 +0000 (12:03 +0100)]
Rename some functions to better names.

devfs_find_device_by_udev() -> devfs_find_device_by_devid()
dev2udev()                  -> devid_from_dev()
udev2dev()                  -> dev_from_devid()

This fits with the rest of the code. 'dev' usually means a cdev_t,
such as in make_dev(), etc. Instead of 'udev', use 'devid', since
that's what dev_t is, a "Device ID".

15 months ago<sys/types.h>: Get rid of udev_t.
Sascha Wildner [Sun, 1 Dec 2019 10:59:08 +0000 (11:59 +0100)]
<sys/types.h>: Get rid of udev_t.

In a time long long ago, dev_t was a pointer, which later became cdev_t
during the great cleanups, until it ended up being a uint32_t, just like
udev_t. See for example the definitions of __dev_t in <sys/stat.h>.

This commit cleans up further by removing the udev_t type, leaving just
the POSIX dev_t type for both kernel and userland. Put it inside a
_DEV_T_DECLARED to prepare for further cleanups in <sys/stat.h>.

15 months agotools - Generate valid embedded newlines in strings
Matthew Dillon [Sat, 30 Nov 2019 20:06:29 +0000 (12:06 -0800)]
tools - Generate valid embedded newlines in strings

* Use the posix string concat instead of actually escaping
  a hard newline inside the string.

  This is not legal in C any more (it used to be, ages ago):


  Instead we have to use:


* Fixes the awk scripts to generate valid C strings.

Reported-by: zrj
15 months agotar(1): Fix -Wundef.
Sascha Wildner [Sat, 30 Nov 2019 13:46:40 +0000 (14:46 +0100)]
tar(1): Fix -Wundef.

15 months agom4(1): Fix -Wundef.
Sascha Wildner [Sat, 30 Nov 2019 06:08:54 +0000 (07:08 +0100)]
m4(1): Fix -Wundef.

15 months agolarn(6): Fix -Wundef.
Sascha Wildner [Sat, 30 Nov 2019 06:07:29 +0000 (07:07 +0100)]
larn(6): Fix -Wundef.

15 months agoFix -Wundef in bzip2, libpcap, mdocml, and ncurses.
Sascha Wildner [Sat, 30 Nov 2019 06:06:26 +0000 (07:06 +0100)]
Fix -Wundef in bzip2, libpcap, mdocml, and ncurses.

15 months agokernel: debug_64bit must be uint64_t
Antonio Huete Jimenez [Fri, 29 Nov 2019 19:08:20 +0000 (20:08 +0100)]
kernel: debug_64bit must be uint64_t

15 months ago<stdlib.h>: Check if __cplusplus is defined before checking its value.
Sascha Wildner [Fri, 29 Nov 2019 15:13:06 +0000 (16:13 +0100)]
<stdlib.h>: Check if __cplusplus is defined before checking its value.

15 months agosshd(8): Fix -Wundef.
Sascha Wildner [Fri, 29 Nov 2019 14:21:15 +0000 (15:21 +0100)]
sshd(8): Fix -Wundef.

15 months agobthcid(8): Fix -Wundef.
Sascha Wildner [Fri, 29 Nov 2019 06:35:15 +0000 (07:35 +0100)]
bthcid(8): Fix -Wundef.

15 months agoboot1/edk2: Fix -Wundef.
Sascha Wildner [Fri, 29 Nov 2019 06:18:34 +0000 (07:18 +0100)]
boot1/edk2: Fix -Wundef.

15 months agorwhod(8): Fix -Wundef.
Sascha Wildner [Fri, 29 Nov 2019 05:56:22 +0000 (06:56 +0100)]
rwhod(8): Fix -Wundef.

15 months agokernel: Don't use atomic for cr_ref in crget()
Antonio Huete Jimenez [Fri, 29 Nov 2019 00:33:31 +0000 (01:33 +0100)]
kernel: Don't use atomic for cr_ref in crget()

Suggested-by: mjg
15 months agokernel: Merge crinit() into crget()
Antonio Huete Jimenez [Thu, 28 Nov 2019 16:33:20 +0000 (17:33 +0100)]
kernel: Merge crinit() into crget()

 * Remove crinit() which was unused and merge _crinit() into
   crget() which is its only user.

15 months agoldconfig(8): Fix -Wundef.
Sascha Wildner [Thu, 28 Nov 2019 20:16:29 +0000 (21:16 +0100)]
ldconfig(8): Fix -Wundef.

15 months agotruss(1): Fix -Wundef.
Sascha Wildner [Thu, 28 Nov 2019 20:15:36 +0000 (21:15 +0100)]
truss(1): Fix -Wundef.

15 months agoadventure(6): Fix -Wundef.
Sascha Wildner [Thu, 28 Nov 2019 20:13:47 +0000 (21:13 +0100)]
adventure(6): Fix -Wundef.

15 months agodhcpcd(8): Fix -Wundef.
Sascha Wildner [Thu, 28 Nov 2019 20:04:36 +0000 (21:04 +0100)]
dhcpcd(8): Fix -Wundef.

Approved-by: rsmarples
15 months agoinstall(1): Fix -Wundef.
Sascha Wildner [Thu, 28 Nov 2019 20:03:39 +0000 (21:03 +0100)]
install(1): Fix -Wundef.

15 months agomtree(8): Fix -Wundef.
Sascha Wildner [Thu, 28 Nov 2019 19:31:27 +0000 (20:31 +0100)]
mtree(8): Fix -Wundef.

15 months agofrom(1): Fix -Wundef.
Sascha Wildner [Thu, 28 Nov 2019 10:24:25 +0000 (11:24 +0100)]
from(1): Fix -Wundef.

15 months agostat(1): Fix -Wundef.
Sascha Wildner [Thu, 28 Nov 2019 08:47:31 +0000 (09:47 +0100)]
stat(1): Fix -Wundef.

15 months agomined(1): Fix -Wundef.
Sascha Wildner [Thu, 28 Nov 2019 20:01:36 +0000 (21:01 +0100)]
mined(1): Fix -Wundef.

15 months agousr.sbin/fstyp: Remove XXX comment on HAMMER2
Tomohiro Kusumi [Thu, 28 Nov 2019 16:23:07 +0000 (01:23 +0900)]
usr.sbin/fstyp: Remove XXX comment on HAMMER2

This sholdn't be XXX.
Unlike HAMMER1, HAMMER2 itself doesn't support multiple devices.

15 months agosysctl - Add support for CTLTYPE_BIT32 and BIT64
Matthew Dillon [Wed, 27 Nov 2019 23:54:42 +0000 (15:54 -0800)]
sysctl - Add support for CTLTYPE_BIT32 and BIT64

* Add support for CTLTYPE_BIT32 and CTLTYPE_BIT64.

* In the switch() when you mask against CTLTYPE, the case statements should
  use CTLTYPE_BIT32(0) and CTLTYPE_BIT64(0).

  When generating the 'kind' field etc, use CTLTYPE_BIT32(bitno) or

15 months agokernel - Add SYSCTL_BIT32(n) and BIT64(n) support
Matthew Dillon [Wed, 27 Nov 2019 23:53:44 +0000 (15:53 -0800)]
kernel - Add SYSCTL_BIT32(n) and BIT64(n) support

* Add sysctl support capable of diving bits in a flags field.
  This sysctl passes and returns an int (0 or 1) to userland.

* 32-bit and 64-bit flags fields supported.

15 months agousr.sbin/fstyp: Rename HAMMER1/2 functions
Tomohiro Kusumi [Wed, 27 Nov 2019 16:12:38 +0000 (01:12 +0900)]
usr.sbin/fstyp: Rename HAMMER1/2 functions

Rename functions that look like Linux kernel functions when
double underscores aren't really necessary.

15 months ago<time.h>: Fix C++17 visibility of timespec_get().
Sascha Wildner [Wed, 27 Nov 2019 16:09:51 +0000 (17:09 +0100)]
<time.h>: Fix C++17 visibility of timespec_get().

While here, pull all related bits together under one check.

Reported-by: marino