dragonfly.git
4 years agocalendar(1): Merge two fixes to calendars from FreeBSD
Aaron LI [Wed, 6 Nov 2019 14:48:11 +0000 (22:48 +0800)]
calendar(1): Merge two fixes to calendars from FreeBSD

* Change the date of 'Canberra Day'
  https://github.com/freebsd/freebsd/commit/8b17fbc25c73dce357de0a309ade8bfa4b7674b0

* Correct spelling for 'King Chulalongkorn Day in Thailand'
  https://github.com/freebsd/freebsd/commit/6bc988a89b2d13e66a4b80e0f8503ea9175c72b0

4 years agocalendar(1): Add '-h' and '-?' to show usage help
Aaron LI [Wed, 6 Nov 2019 14:19:59 +0000 (22:19 +0800)]
calendar(1): Add '-h' and '-?' to show usage help

4 years agocalendar(1): Do not ignore errors of setuid/setgid in '-a' mode
Aaron LI [Sun, 3 Nov 2019 03:30:27 +0000 (11:30 +0800)]
calendar(1): Do not ignore errors of setuid/setgid in '-a' mode

Also clear the supplementary groups list up front when becoming another
user, to avoid leaking any extra group privileges that we might have.

In addition, introduce the 'changeuser()' function to make the
'closecal()' function a bit cleaner.

Obtained-from: NetBSD
(https://github.com/NetBSD/src/commit/d23503416735cd0ca069bbd4e59c9c5b93278d8b)

4 years agocalendar(1): Significant update to calendars from OpenBSD
Aaron LI [Thu, 31 Oct 2019 15:44:04 +0000 (23:44 +0800)]
calendar(1): Significant update to calendars from OpenBSD

* The calendars were obtained from OpenBSD as of 2019-02-19
* Generally, OpenBSD has more entries and more accurate, but FreeBSD has
  also updated some entries and fixed some mistakes.
* I cross-checked most mismatching entries by searching the Internet and
  also fixed several mistakes.
* NOTE: there can certainly exist quite some mistakes because I cannot
  thoroughly check all of them.

4 years agocalendar(1): Improve UTC offset and longitude handling
Aaron LI [Tue, 5 Nov 2019 15:24:10 +0000 (23:24 +0800)]
calendar(1): Improve UTC offset and longitude handling

Refactor the code that deals with the UTC offset into a separate
function 'get_utcoffset()'.

Meanwhile, allow the '-l' option to accept a float number instead of
an integer only.  This makes more sense.

4 years agocalendar(1): Various cleanups
Aaron LI [Tue, 5 Nov 2019 15:23:06 +0000 (23:23 +0800)]
calendar(1): Various cleanups

* Mostly style cleanups.
* Use 'bool' when more appropriate.
* Staticize several functions and variables to clean up 'calendar.h'.

4 years agocalendar(1): Remove redundant fr_FR.UTF-8/calendar.french
Aaron LI [Mon, 18 Feb 2019 05:30:35 +0000 (13:30 +0800)]
calendar(1): Remove redundant fr_FR.UTF-8/calendar.french

4 years agocalendar(1): Use UTF-8 for all calendars
Aaron LI [Mon, 18 Feb 2019 05:12:52 +0000 (13:12 +0800)]
calendar(1): Use UTF-8 for all calendars

Remove 'pt_BR.ISO8859-1' and 'ru_RU.KOI8-R' since their UTF-8 version
already exist.

Convert the following calendars to UTF-8:
* de_AT.ISO8859-15
* de_DE.ISO8859-1
* fr_FR.ISO8859-1
* hr_HR.ISO8859-2
* hu_HU.ISO8859-2
* uk_UA.KOI8-U

Update Makefile, Makefile_upgrade.inc and mtree(8) entries accordingly.

4 years agocalendar(1): Rework calendar files installation
Aaron LI [Mon, 18 Feb 2019 01:17:31 +0000 (09:17 +0800)]
calendar(1): Rework calendar files installation

Switch the installation of calendar files to use FILES and SYMLINKS
instead of bare install(1).  Also explicitly list each file to install
so we don't silently add or miss some.

Obtained-from: FreeBSD (revision 334102)

4 years agocalendar(1): Sync with FreeBSD
Aaron LI [Sun, 17 Feb 2019 15:44:21 +0000 (23:44 +0800)]
calendar(1): Sync with FreeBSD

New features:
* Support events that span multiple years, because of '-A', '-B' or just
  the three days before the end of the year.
* Support for lunar events (full moon, new moon), solar events (equinox,
  solstice), and Chinese new year.  Because of this, the options '-U'
  (UTC offset) and '-l' (longitude) are available to compensate if
  reality doesn't match the calculated values.
* Implement an internal 'cpp'-like parser to parse the calendars, so no
  longer require the external cpp(1).

Changed behavior:
DragonFly's calendar(1) switched to use the 'calendar.all' file by
default in 9abdd9620822cc1232dc702a76d95ebf133733b5.  This calendar file
always exists.  However, it makes calendar(1) print too much entries,
which I think most users would not need.  So switch to the original
default calendar file, i.e., 'calendar', the same as other BSDs.

The following minor changes were made:
1. In 'calendar.c' and 'io.c', delete the unused 'copyright' variable
   to suppress the compilation warnings.
2. In 'sunpos.c', rename the macro 'MIN(h)' to 'MINUTE(h)' to avoid the
   conflict; meanwhile rename the macro 'SMIN(h)' to 'SMINUTE(h)' for
   better consistency.

More cleanups and improvements to follow.

4 years agocalendar(1): Sync calendars from FreeBSD
Aaron LI [Sun, 17 Feb 2019 11:20:25 +0000 (19:20 +0800)]
calendar(1): Sync calendars from FreeBSD

Update the mtree(8) entries and the man page accordingly.

4 years agosys/vfs/msdosfs: Cleanup before implementing vfs clustering
Tomohiro Kusumi [Sat, 9 Nov 2019 15:17:20 +0000 (00:17 +0900)]
sys/vfs/msdosfs: Cleanup before implementing vfs clustering

from freebsd/freebsd@b2bdcce9e10d5055a3afbfebf98e0e05fcd67113

Sync with a cleanup commit before FreeBSD added clustering support.

4 years agosys/vfs/msdosfs: Fix regression from cleanup commit 20241ea208
Tomohiro Kusumi [Sat, 9 Nov 2019 15:17:06 +0000 (00:17 +0900)]
sys/vfs/msdosfs: Fix regression from cleanup commit 20241ea208

rablock needs to be a cluster#.

4 years agosys/vfs/msdosfs: Remove BPB_TotSec16 test for FAT32 on mount(2)
Tomohiro Kusumi [Fri, 8 Nov 2019 20:44:52 +0000 (05:44 +0900)]
sys/vfs/msdosfs: Remove BPB_TotSec16 test for FAT32 on mount(2)

from freebsd/freebsd@ad92b9afc4f7ec122f9438ac64b58c2926a6a6a4

Looks like BSD implementation of FAT wants to not test
BPB_TotSec16 == 0 even for FAT32. Read above for details.

4 years agosys/vfs/msdosfs: Fix comments on corrupted fs
Tomohiro Kusumi [Fri, 8 Nov 2019 19:41:29 +0000 (04:41 +0900)]
sys/vfs/msdosfs: Fix comments on corrupted fs

from freebsd/freebsd@54e5c67329366d24de694633c94a8d2640534095

4 years agosys/vfs/msdosfs: Fix typo
Tomohiro Kusumi [Fri, 8 Nov 2019 19:01:18 +0000 (04:01 +0900)]
sys/vfs/msdosfs: Fix typo

4 years agovirtio - SI_ORDER_FIRST -> SI_ORDER_EARLIER
Matthew Dillon [Fri, 8 Nov 2019 16:38:21 +0000 (08:38 -0800)]
virtio - SI_ORDER_FIRST -> SI_ORDER_EARLIER

* Virtio should not assume that it can initialize first in the
  attach order, but we do want it to initialize earlier rather
  than later.

4 years agokernel - Use SI_ORDER_THIRD for CAM peripheral modules.
Matthew Dillon [Fri, 8 Nov 2019 16:36:50 +0000 (08:36 -0800)]
kernel - Use SI_ORDER_THIRD for CAM peripheral modules.

* Use SI_ORDER_THIRD for CAM peripheral modules so we get a
  more deterministic placement for the attach order.

4 years agokernel - Add additional SI_ORDER_* flags
Matthew Dillon [Fri, 8 Nov 2019 16:35:09 +0000 (08:35 -0800)]
kernel - Add additional SI_ORDER_* flags

* Add SI_ORDER_FORTH

* Add SI_ORDER_EARLIER (before MIDDLE) and SI_ORDER_LATER
  (after MIDDLE).  This is to allow certain devices to
  attach earlier rather than later, without having to make
  assumptions about being able to use FIRST, SECOND, etc.

4 years agovirtio - Fix LUN scan issue w/ Google Cloud
Matthew Dillon [Fri, 8 Nov 2019 16:31:51 +0000 (08:31 -0800)]
virtio - Fix LUN scan issue w/ Google Cloud

* Use CAM_DEV_NOT_THERE instead of CAM_SEL_TIMEOUT when
  translating VIRTIO_SCSI_S_BAD_TARGET.

* Fixes a LUN scan issue on google cloud VMs that
  causes the entire device to be dropped.

  CAM_SEL_TIMEOUT on specific LUN -> cam_periph_error() ->
  AC_LOST_DEVICE on wildcard (whole device).

4 years agokernel - Deal with obsolete/misused SID_Sync flag in CAM
Matthew Dillon [Fri, 8 Nov 2019 16:30:43 +0000 (08:30 -0800)]
kernel - Deal with obsolete/misused SID_Sync flag in CAM

* The SID_Sync flag is obsolete or misused in some situations
  (some virtio block devices), ignore it.

Reported-by: tuxillo
Testing-by: tuxillo
4 years agosys/vfs/msdosfs: Add/use DOINGASYNC()
Tomohiro Kusumi [Fri, 8 Nov 2019 12:24:05 +0000 (21:24 +0900)]
sys/vfs/msdosfs: Add/use DOINGASYNC()

from freebsd/freebsd@311bc737d859452ad0514fe48c005bcefcbc3eda

Note that in FreeBSD DOINGASYNC() macro isn't specific to FAT.

4 years agosys/vfs/msdosfs: Support async mount (delayed write)
Tomohiro Kusumi [Fri, 8 Nov 2019 12:03:05 +0000 (21:03 +0900)]
sys/vfs/msdosfs: Support async mount (delayed write)

from freebsd/freebsd@c590272b42e93312c35e2c65311528e435564f7c

Basically don't use this.

4 years agosys/vfs/msdosfs: Avoid "." corruption on rename(2)
Tomohiro Kusumi [Fri, 8 Nov 2019 15:12:05 +0000 (00:12 +0900)]
sys/vfs/msdosfs: Avoid "." corruption on rename(2)

from freebsd/freebsd@42829c17958177a094b3b521ea5870e19928263f

4 years agosys/vfs/msdosfs: Improve fsync(2) behavior
Tomohiro Kusumi [Thu, 7 Nov 2019 15:21:06 +0000 (00:21 +0900)]
sys/vfs/msdosfs: Improve fsync(2) behavior

from freebsd/freebsd@3bbdcb77fd843ff34a0054bea92392cee78dd0ec

Do sloppy sync of metadata by syncing the entire FAT on fsync(2).
Also improve deupdat(). Read above for details.

4 years agodsynth - Change default compression from .tgz to .txz
Matthew Dillon [Wed, 6 Nov 2019 17:31:26 +0000 (09:31 -0800)]
dsynth - Change default compression from .tgz to .txz

* Change default compression from .tgz to .txz, just so the
  results are space-efficient, even though this will slow down
  bulk builds.

* Anyone can change the compression algo via Package_suffix,
  see 'man dsynth'.  .tgz is recommended if reducing bulk build
  time is critical for you.

Requested-by: zrj
4 years agosys/vfs/msdosfs: Remove seemingly unneeded unlock/relock of dvp
Tomohiro Kusumi [Wed, 6 Nov 2019 16:35:02 +0000 (01:35 +0900)]
sys/vfs/msdosfs: Remove seemingly unneeded unlock/relock of dvp

from freebsd/freebsd@21f579c3fb6b782ee610255d7f5bbb22e326b66c

4 years agosys/vfs/msdosfs: Remove unrelated comment on rmdir
Tomohiro Kusumi [Wed, 6 Nov 2019 13:34:04 +0000 (22:34 +0900)]
sys/vfs/msdosfs: Remove unrelated comment on rmdir

FreeBSD explicitly calls cache_purge() here.

4 years agodsynth - Add ARCH make var to bulk scan
Matthew Dillon [Tue, 5 Nov 2019 21:47:48 +0000 (13:47 -0800)]
dsynth - Add ARCH make var to bulk scan

* Add the ARCH make variable and env variable to bulk scan operations.

Reported-by: tuxillo
4 years agosys/vfs/msdosfs: Sync debug prints with FreeBSD
Tomohiro Kusumi [Tue, 5 Nov 2019 13:18:35 +0000 (22:18 +0900)]
sys/vfs/msdosfs: Sync debug prints with FreeBSD

from freebsd/freebsd@2531d8deb3ae1fe51c43a46f528fda3fdf1806e2

4 years agodsynth - Conditionalize use of check-plist stage
Matthew Dillon [Mon, 4 Nov 2019 19:48:21 +0000 (11:48 -0800)]
dsynth - Conditionalize use of check-plist stage

* Only run the check-plist stage for:

  dsynth -P <anything>
  dsynth -D everything
  dsynth test ...

4 years agodevfs: Add a vnode pointer argument to dev_dopen()
François Tigeot [Sun, 3 Nov 2019 21:00:19 +0000 (22:00 +0100)]
devfs: Add a vnode pointer argument to dev_dopen()

* Initialize fp->f_data with it when possible

* drm drivers expect to be able to access vnode information in
  their open() function

Reviewed-by: dillon
4 years agodrm/linux: Rework wait_event_xxx() macros
François Tigeot [Sun, 3 Nov 2019 20:31:43 +0000 (21:31 +0100)]
drm/linux: Rework wait_event_xxx() macros

The wait queue lock must not be held permanently.

This commit should fix issue #3200, reported-by Peeter.

4 years agodsynth - Enhance FAILURE log message
Matthew Dillon [Sun, 3 Nov 2019 20:06:54 +0000 (12:06 -0800)]
dsynth - Enhance FAILURE log message

* Enhance the 02_failure_list.log messages to also print the number of
  other packages being skipped due to the failure.

Requested-by: zrj
4 years agofile(1): Fix CVE-2019-18218.
Sascha Wildner [Sun, 3 Nov 2019 12:31:12 +0000 (13:31 +0100)]
file(1): Fix CVE-2019-18218.

For further details see:

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-18218
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16780

Reported-by: zrj
4 years agosbin/hammer2: Add /dev/ad* and /dev/vn* to "info"/"mountall" targets
Tomohiro Kusumi [Sun, 3 Nov 2019 09:12:05 +0000 (18:12 +0900)]
sbin/hammer2: Add /dev/ad* and /dev/vn* to "info"/"mountall" targets

4 years agodrm/linux: Only define GFP_KERNEL once
François Tigeot [Sun, 3 Nov 2019 09:50:21 +0000 (10:50 +0100)]
drm/linux: Only define GFP_KERNEL once

4 years agodrm: Remove most system headers from linux/list.h
François Tigeot [Sun, 3 Nov 2019 09:35:50 +0000 (10:35 +0100)]
drm: Remove most system headers from linux/list.h

They do not serve any useful purpose there.

Suggested-by: zrj
4 years ago<wchar.h>: Remove limits pollution.
zrj [Sat, 2 Nov 2019 20:16:51 +0000 (22:16 +0200)]
<wchar.h>: Remove limits pollution.

 The <wchar.h> now should properly only define WCHAR_MIN/WCHAR_MAX as per
 opengroups.  Fix fallout in col(1) that makes use of INT_MIN/INT_MAX.

 No binary differences for buildworld.

 While there, add comment why <ctype.h> is in <wchar.h>.

4 years ago<stdint.h>: Remove C99 constant/limits guards for c++.
zrj [Sat, 2 Nov 2019 18:39:19 +0000 (20:39 +0200)]
<stdint.h>: Remove C99 constant/limits guards for c++.

 It seems that in C11 problematic clauses where removed.  This removes
 the inconsistency for -std=c++98 between base and DPorts c++ compilers
 (that have #include_next <stdint.h> wrapper for this particular issue).
 For now keep guard defines in <sys/cdefs.h> because of those wrappers.

 No functional change in buildworld.

4 years ago<wchar.h>: Implement correct limits for different wchar_t flavors.
zrj [Sat, 2 Nov 2019 17:02:41 +0000 (19:02 +0200)]
<wchar.h>: Implement correct limits for different wchar_t flavors.

 Try best to select correct limits while always using handpicked standard
 C wchar_t bounds that match internal rune_t and standard wint_t types.
 It might be worth to switch to using compiler provided limits for all.
 The <stdint.h> header should provide limits for all types in standard
 headers, so provide wint_t (<wchar.h>, <wctype.h>) limits too.
 The <machine/wchar_limits.h> idea taken from NetBSD.

4 years ago<ctype.h>: Internalize __ct_rune_t type.
zrj [Sat, 2 Nov 2019 14:47:58 +0000 (16:47 +0200)]
<ctype.h>: Internalize __ct_rune_t type.

 Kernel does not use rune_t types, this change essentially removes rune_t
 types from kernel namespace (rune_t types were intended to be used only
 internally in libc/locale/ scope).

 ANSI requires that ctype types should be of type 'int' so it is
 debatable if such custom type is needed at all.  Provide declaration in
 <runetype.h> as well to allow header be self sufficient.

4 years ago<wchar.h>: Refactor wchar_t/wint_t/mb_state setup.
zrj [Sat, 2 Nov 2019 11:26:14 +0000 (13:26 +0200)]
<wchar.h>: Refactor wchar_t/wint_t/mb_state setup.

 Kernel has no wchar support functions (except for VKERNEL64).

 * Extract wide-character types setup to common <machine/wchar.h>.
 * Avoid using __wchar_t for clang -fms-extensions issue.
 * Add more handling for c++ and -fshort-wchar (not supported in libc).

 This essentially removes these types from kernel namespace and paves
 the way for further both userland/kernelland visibility cleanup by
 making <sys/stdint.h> clean.
 The WCHAR_MAX/WCHAR_MIN limits will be addressed in separate commit.

4 years agopthread: Fix simple hello world c++ statically linked use cases.
zrj [Sat, 2 Nov 2019 10:39:06 +0000 (12:39 +0200)]
pthread: Fix simple hello world c++ statically linked use cases.

 Can happen if locale setup is called before pthread_create() and c++
 program is linked with -static -pthread.  Check initialization status
 in mutex and once related calls.

4 years agovkernel64: Reduce <pthread.h> exposure to generic kernel sources.
zrj [Sat, 2 Nov 2019 09:35:26 +0000 (11:35 +0200)]
vkernel64: Reduce <pthread.h> exposure to generic kernel sources.

 Implement vkernel_yield() wrapper and use it where needed.

4 years agokernel/drm: Yeet drm_free() inline.
zrj [Sat, 2 Nov 2019 06:41:56 +0000 (08:41 +0200)]
kernel/drm: Yeet drm_free() inline.

 Last consumers removed in 6af927c246477a611cb86e64d0fc460000a39284

4 years ago<sys/malloc.h>: Avoid self referencing macros.
zrj [Fri, 25 Oct 2019 18:05:10 +0000 (21:05 +0300)]
<sys/malloc.h>: Avoid self referencing macros.

 It was reported that previous kmalloc() implementation at header level
 is breaking tools like Coccinelle and likely others.  Since this header
 now has implicit requirement on other headers only for using the
 MALLOC_DEFINE() macro (<sys/kernel.h> must be included before), it is
 possible to safely use inline functions.  Inline function does not have
 flexibility limitations like preprocessor macro and expands to much
 nicer line in compiler intermediates while allowing to easily make
 future adjustments when needed.  Also we should be able to no longer
 avoid using kmalloc*() calls directly in other kernel headers.

 The LINT64 builds with SLAB_DEBUG option enabled are not affected by
 this change, but for consistency add alias for _kmalloc() too.

 Move in the "#if 1" into the _kmalloc() body, this allows compiler to
 perform additional optimizations for non __builtin_constant_p() cases.
 As a benefit if during compilation the -O0 is used, compiler disables
 optimized paths in inline functions.

 Compared with -save-temps on GENERIC without debug enabled.

4 years agolibthread_xu: Remove local versions of 3 parameter timespec{add,sub}().
Sascha Wildner [Sat, 2 Nov 2019 19:07:49 +0000 (20:07 +0100)]
libthread_xu: Remove local versions of 3 parameter timespec{add,sub}().

Adjust the parameter order. Comparison of preprocessed code before and
after this commit looks good.

4 years agosbin/hammer2: Test /dev/mampper for "info"/"mountall" targets
Tomohiro Kusumi [Fri, 1 Nov 2019 16:36:34 +0000 (01:36 +0900)]
sbin/hammer2: Test /dev/mampper for "info"/"mountall" targets

Try dirents under /dev/mapper in addition to /dev/serno.
Also ignore ".", ".." for both serno/dm, and "control" for dm.

4 years agotermios.4: Add a bit more info about TABDLY, TAB0, and TAB3.
Sascha Wildner [Fri, 1 Nov 2019 22:35:29 +0000 (23:35 +0100)]
termios.4: Add a bit more info about TABDLY, TAB0, and TAB3.

Also add a SEE ALSO section.

Taken-from: FreeBSD

4 years ago<sys/malloc.h>: Reduce kmalloc() implicit requirements on <sys/systm.h>.
zrj [Fri, 25 Oct 2019 10:54:32 +0000 (13:54 +0300)]
<sys/malloc.h>: Reduce kmalloc() implicit requirements on <sys/systm.h>.

 Use __builtin_memset() directly.  Use of __DEQUALIFY() not needed here.

 The "#if 1" case already makes use of __builtin_constant_p() compiler
 extension that we do not have feature check in <sys/cdefs.h> (using
 "#if __GNUC_PREREQ__(2, 0)" should be good enough).

 This finally decouples <sys/malloc.h> from <sys/systm.h> bzero() macro
 visibility (also in "#if 1" block).

4 years ago<sys/malloc.h>: Reduce kmalloc() implicit requirements for NULL.
zrj [Fri, 25 Oct 2019 09:57:33 +0000 (12:57 +0300)]
<sys/malloc.h>: Reduce kmalloc() implicit requirements for NULL.

 Make sure it is available for ease of use.  This potentially allows to
 not to add <sys/param.h> in kernel sources just for NULL when kmalloc()
 is used in source code.

4 years agokernel/hammer2: Make C_HASHTABLE static.
zrj [Fri, 25 Oct 2019 09:56:00 +0000 (12:56 +0300)]
kernel/hammer2: Make C_HASHTABLE static.

 Only used in lz4.c locally.  Include hammer2.h first to include common
 headers first.

4 years agokernel/dm: Include <sys/param.h> first.
zrj [Fri, 25 Oct 2019 09:54:48 +0000 (12:54 +0300)]
kernel/dm: Include <sys/param.h> first.

 Allow the <dev/disk/dm/dm.h> to include common headers first.

4 years agokernel/pc64: Move up include order in vmx.c.
zrj [Fri, 25 Oct 2019 08:35:06 +0000 (11:35 +0300)]
kernel/pc64: Move up include order in vmx.c.

 Include <sys/param.h> first and remove not necessary <sys/types.h>.

 No functional change for generated code.

4 years agovmstat(8): Remove no longer needed <sys/malloc.h> include.
zrj [Wed, 23 Oct 2019 13:52:13 +0000 (16:52 +0300)]
vmstat(8): Remove no longer needed <sys/malloc.h> include.

 The <sys/objcache.h> now provides the "struct malloc_type" definition.
 This leaves only two utilities in base userland that reference kernel
 kmalloc() header:
 * sbin/vinum through <dev/raid/vinum/vinumhdr.h>
 * usr.bin/fstat through various <vfs/FS/FS.h> headers.

4 years agofwcontrol(8): Remove <sys/malloc.h> include.
zrj [Tue, 22 Oct 2019 14:59:33 +0000 (17:59 +0300)]
fwcontrol(8): Remove <sys/malloc.h> include.

 After previous patches there should not be a case where this header in
 userland visibility would be needed anymore.

4 years ago<net/if_var.h>: Remove last explicit dependency on <sys/malloc.h>.
zrj [Tue, 22 Oct 2019 16:42:52 +0000 (19:42 +0300)]
<net/if_var.h>: Remove last explicit dependency on <sys/malloc.h>.

 These kernel sources pass M_NOWAIT flag to m_copym() and friends.
 Mark that it was for M_NOWAIT visibility.

4 years ago<sys/malloc.h>: Add comment about assumption in drm layer.
zrj [Tue, 22 Oct 2019 16:31:21 +0000 (19:31 +0300)]
<sys/malloc.h>: Add comment about assumption in drm layer.

4 years agokernel/drm: Decouple from network headers.
zrj [Tue, 22 Oct 2019 16:18:56 +0000 (19:18 +0300)]
kernel/drm: Decouple from network headers.

 This removes all <net*/*.h> headers (including <sys/mbuf.h>) from
 dependency chain in all drm devices.  There is no need to use network
 headers in drm compat layer.  Previously drm was using <net/if_var.h>
 as a fallback to get <sys/malloc.h>.  Use kmalloc/kfree and M_* flags
 in linux/gfp.h.  At this point no system headers should be including
 <sys/malloc.h> except for disk and vfs headers for obvious reasons.

 Later on even M_* flags could be moved into <sys/_malloc.h> for better
 separation to linux/slab.h.

4 years ago<sys/idr.h>: Move implementation details to Linux compat layer.
zrj [Tue, 22 Oct 2019 14:27:16 +0000 (17:27 +0300)]
<sys/idr.h>: Move implementation details to Linux compat layer.

 Nothing is needed here, linux_idr.c already includes <sys/malloc.h>,
 while drm layer still needs malloc prototypes.  So move it there.

4 years agoRemove nextboot remains.
Sascha Wildner [Fri, 1 Nov 2019 11:39:29 +0000 (12:39 +0100)]
Remove nextboot remains.

While here, staticize reboot(8) a bit.

4 years agoRemove checknr(1) which stopped being useful a long time ago.
Sascha Wildner [Fri, 1 Nov 2019 10:24:18 +0000 (11:24 +0100)]
Remove checknr(1) which stopped being useful a long time ago.

It reports a ton of errors on pretty much any manual page, regardless
of macro dialect.

mandoc(1) (and groff) have much better checking capabilities.

4 years agolibtelnet: Use NULL for a pointer.
Sascha Wildner [Fri, 1 Nov 2019 10:06:41 +0000 (11:06 +0100)]
libtelnet: Use NULL for a pointer.

4 years agolibipfw3: Use NULL for a pointer.
Sascha Wildner [Fri, 1 Nov 2019 10:06:32 +0000 (11:06 +0100)]
libipfw3: Use NULL for a pointer.

4 years agorouted(8): Use NULL for a pointer.
Sascha Wildner [Fri, 1 Nov 2019 10:06:28 +0000 (11:06 +0100)]
routed(8): Use NULL for a pointer.

4 years agousr.sbin/fstyp: Fix warning on Linux distros
Tomohiro Kusumi [Thu, 31 Oct 2019 23:47:02 +0000 (08:47 +0900)]
usr.sbin/fstyp: Fix warning on Linux distros

hammer2.c:134: warning: pointer targets in passing argument 1 of 'strcmp' differ in signedness
/usr/include/string.h:143: note: expected 'const char *' but argument is of type 'unsigned char *'

4 years agonrelease: Support to use binary packages
Aaron LI [Sun, 3 Mar 2019 13:19:11 +0000 (21:19 +0800)]
nrelease: Support to use binary packages

Add the new optional target "binpkgs" to allow to use binary packages,
i.e., installing them with pkg(8), instead of building them from
dports(7).  This can be handy for end users who want to quickly build
a custom image with custom packages.

As pointed out by Sascha Wildner, one port may have multiple binary
packages (e.g., Python flavors) or have a different name that may not be
found by pkg(8).  Therefore, allow to specify the exact binary package
name for a port by setting 'PKG_<port>=<pkg-name>'.

This feature is disabled by default, as suggested by Sascha Wildner,
because the release process should be self-contained as much as possible.

Update the help text and man page accordingly.

4 years ago<termios.h>: #define MDMBUF as an alias for CCAR_OFLOW.
Sascha Wildner [Thu, 31 Oct 2019 21:38:41 +0000 (22:38 +0100)]
<termios.h>: #define MDMBUF as an alias for CCAR_OFLOW.

4 years ago<sys/posix4.h>: Remove single use macros.
zrj [Tue, 22 Oct 2019 14:44:26 +0000 (17:44 +0300)]
<sys/posix4.h>: Remove single use macros.

 Use kmalloc()/kfree() directly.

4 years agokernel/vfs: Consistently check if MALLOC_DECLARE was defined.
zrj [Sun, 20 Oct 2019 19:12:48 +0000 (22:12 +0300)]
kernel/vfs: Consistently check if MALLOC_DECLARE was defined.

 Keep these checks even in _KERNEL context and even if <sys/malloc.h>
 is included before.  Helps a lot for userland testing.

4 years agokernel: Remove explicit dependencies on <sys/malloc.h> in headers.
zrj [Sun, 20 Oct 2019 18:15:20 +0000 (21:15 +0300)]
kernel: Remove explicit dependencies on <sys/malloc.h> in headers.

 All except <net/if_var.h> for now, it needs decoupling in drm first.
 * Include <sys/malloc.h> in foo.c if they have kmalloc()/kfree() calls.
 * Consistently check if MALLOC_DECLARE was declared before.
 * <sys/mountctl.h>: include <sys/thread.h> for _KERNEL_STRUCTURES too
   since the "struct journal" embeds "struct thread".
 * <sys/tty.h>: Only two kernel sources makes use of M_TTYS.
 * <sys/socketvar2.h>: Make it kernel only header.

4 years agokernel: Minor whitespace cleanup in few sources (part 2).
zrj [Sun, 20 Oct 2019 18:13:22 +0000 (21:13 +0300)]
kernel: Minor whitespace cleanup in few sources (part 2).

 Separated from next.

4 years ago<sys/sysref.h>: Switch to lighter <sys/_malloc.h> header.
zrj [Sun, 20 Oct 2019 18:05:43 +0000 (21:05 +0300)]
<sys/sysref.h>: Switch to lighter <sys/_malloc.h> header.

 * Make <sys/sysref2.h> a kernel only header.
 * Remove sys/types.h includes that follow <sys/param.h> in devfs(5).
 * Add sys/malloc.h includes where it is actually used in sources.

 While there, minor whitespace cleanup.

4 years ago<sys/objcache.h>: Switch to lighter <sys/_malloc.h> header.
zrj [Sun, 20 Oct 2019 17:45:00 +0000 (20:45 +0300)]
<sys/objcache.h>: Switch to lighter <sys/_malloc.h> header.

 Exposing "struct malloc_type" internals is useful even under kernel
 structures namespace. In vmstat(8) this will allow to drop dependency
 on the <sys/malloc.h> header.

4 years agokernel: Remove not needed header includes in AIO stub.
zrj [Fri, 18 Oct 2019 14:43:47 +0000 (17:43 +0300)]
kernel: Remove not needed header includes in AIO stub.

 AIO not available since 91bcbcd6bef430dfa09526e0af9e24fa8319ae50.

4 years ago<sys/slaballoc.h>: Switch to lighter <sys/_malloc.h> header.
zrj [Fri, 18 Oct 2019 14:40:32 +0000 (17:40 +0300)]
<sys/slaballoc.h>: Switch to lighter <sys/_malloc.h> header.

 The <sys/globaldata.h> embeds SLGlobalData that in turn embeds the
 "struct malloc_type".  Adjust several kernel sources for missing
 includes where memory allocation is performed.  Try to use alphabetical
 include order.

 Now (in most cases) <sys/malloc.h> is included after <sys/objcache.h>.
 Once it gets cleaned up, the <sys/malloc.h> inclusion could be moved
 out of <sys/idr.h> to drm Linux compat layer linux/slab.h without side
 effects.

4 years agokernel: Minor whitespace cleanup in few sources.
zrj [Fri, 18 Oct 2019 14:36:39 +0000 (17:36 +0300)]
kernel: Minor whitespace cleanup in few sources.

4 years ago<sys/malloc.h>: Separate basic typedefs to _malloc.h hearder.
zrj [Fri, 18 Oct 2019 13:43:12 +0000 (16:43 +0300)]
<sys/malloc.h>: Separate basic typedefs to _malloc.h hearder.

 This will be used to reduce <sys/globaldata.h> pollution through the
 <sys/slaballoc.h> and will allow not to include <sys/malloc.h> for
 almost every kernel source even if no memory allocations are done.

 While there move MALLOC_DECLARE() macro too, it would help with malloc
 type visibility from headers that define it and will allow finally to
 sort most of the header includes alphabetically without side effects.

4 years ago<termios.h>: Add TABDLY, TAB0 and TAB3 to satisfy POSIX a bit better.
Sascha Wildner [Thu, 31 Oct 2019 21:01:09 +0000 (22:01 +0100)]
<termios.h>: Add TABDLY, TAB0 and TAB3 to satisfy POSIX a bit better.

* TAB3 is what we already have as OXTABS. Make the latter an alias of
  the former in <sys/_termios.h>.

* Add 'tab0' and 'tab3' operands to stty(1) too.

Most other output flags from the POSIX spec deal with actual time delays
'to allow for mechanical or other movement when certain characters are
sent to the terminal'. Blast from the past.

Taken-from: FreeBSD (with some adjustments)

4 years ago<sys/mpipe.h>: Mark as kernel only header.
zrj [Fri, 18 Oct 2019 13:24:43 +0000 (16:24 +0300)]
<sys/mpipe.h>: Mark as kernel only header.

 Not used in any of the kernel headers and should not be included by the
 userland and especially DPorts.  Adjust kern_mpipe.c too.

 While there, minor whitespace cleanup.

4 years ago<sys/event.h>: Make M_KQUEUE static.
zrj [Fri, 18 Oct 2019 12:54:18 +0000 (15:54 +0300)]
<sys/event.h>: Make M_KQUEUE static.

 Used in a single kernel source only.

 While there, minor whitespace cleanup.

4 years ago<sys/dmsg.h>: Reduce userspace pollution a bit.
zrj [Fri, 18 Oct 2019 12:39:40 +0000 (15:39 +0300)]
<sys/dmsg.h>: Reduce userspace pollution a bit.

 Kernel only prototypes where exposed after buildworld fixup in
  840d1679a5091e5e53566251299413a8e90f4cb9
 The 'struct kdmsg_iocom' is embedded in 'struct disk' (sys/disk.h).
 Also forward declare few structs to reduce dependencies.

 While there, remove kdmsg_icrc32*() prototypes that where added in:
  3a5aa68f9b693d86f3b5d5ac9191035f09d18b3e

4 years ago<pthread.h>: Fix typo: __restict -> __restrict.
Sascha Wildner [Thu, 31 Oct 2019 20:24:42 +0000 (21:24 +0100)]
<pthread.h>: Fix typo: __restict -> __restrict.

Reported-by: zrj
4 years agosbin/fsck_hammer2: Remove redundant hammer2_blockref_t in delta stats
Tomohiro Kusumi [Thu, 31 Oct 2019 15:14:08 +0000 (00:14 +0900)]
sbin/fsck_hammer2: Remove redundant hammer2_blockref_t in delta stats

4 years ago<sys/_termios.h>: FWIW, add 460800 and 921600 baud rate defines.
Sascha Wildner [Wed, 30 Oct 2019 21:18:59 +0000 (22:18 +0100)]
<sys/_termios.h>: FWIW, add 460800 and 921600 baud rate defines.

4 years agosbin/fsck_hammer2: Add -c to cache subtree blockref stats for speed
Tomohiro Kusumi [Tue, 29 Oct 2019 17:30:31 +0000 (02:30 +0900)]
sbin/fsck_hammer2: Add -c to cache subtree blockref stats for speed

If blockref scan succeeds and subtree blockref count exceeds a -c
value, cache subtree blockref stats and blockref itself.

This greatly improves speed when multiple PFSes share large parts
of blockrefs via snapshots. If blockrefs were somehow corrupted in
a weird way that exact same copies of blockref appear more than once,
this doesn't work, but should generally be useful.

Note that using a too small -c value may eat memory without much
performance improvement. Also note that using a too large -c value
saves memory but blockrefs may not be cached or used.

A suitable -c value depends on blockref tree structure since it's
a threshold for blockref count. A fs with more than a few GB of
consumption, should use a few thousand or more.

4 years agopthreads - Bypass third-party allocators for internal allocations
Matthew Dillon [Tue, 29 Oct 2019 23:09:33 +0000 (16:09 -0700)]
pthreads - Bypass third-party allocators for internal allocations

* Adjust libthread_xu to always use libc's malloc/free (__malloc,
  __free), bypassing third party allocators.

* Fixes interactions between third party alocators and pthreads
  which often cause deadlocks or other chicken-and-egg issues,
  or require serious hacks to work around.

4 years agotest/cocci: Improve a bit.
Sascha Wildner [Tue, 29 Oct 2019 19:46:08 +0000 (20:46 +0100)]
test/cocci: Improve a bit.

* Remove NELEM.cocci and put its contents into useful_macros.cocci, along
  with more macros (so far only from <sys/param.h).

* Mention in comma.cocci that the devel/ocaml-findlib port is needed for
  that patch.

4 years agoUse NULL for pointers in tools/usbtest too (forgotten in last commit).
Sascha Wildner [Tue, 29 Oct 2019 19:28:34 +0000 (20:28 +0100)]
Use NULL for pointers in tools/usbtest too (forgotten in last commit).

4 years agousb: Use NULL for pointers.
Sascha Wildner [Tue, 29 Oct 2019 19:26:18 +0000 (20:26 +0100)]
usb: Use NULL for pointers.

4 years agoboot/efi: Use NULL for a pointer.
Sascha Wildner [Tue, 29 Oct 2019 19:13:49 +0000 (20:13 +0100)]
boot/efi: Use NULL for a pointer.

4 years agodsynth - Allow empty env variable assignment
Matthew Dillon [Tue, 29 Oct 2019 17:27:27 +0000 (10:27 -0700)]
dsynth - Allow empty env variable assignment

* The parser was improperly complaining about empty env variable
  assignments.  Allow the case.

* Allows e.g. STRIP=

Reported-by: yellowrabbit2010
4 years agocpdup(1): Check the return value of asprintf() and exit if fails
Aaron LI [Tue, 29 Oct 2019 14:52:48 +0000 (22:52 +0800)]
cpdup(1): Check the return value of asprintf() and exit if fails

See also: https://github.com/DragonFlyBSD/cpdup/commit/90aee43e060104e974f623924c3dfc0a4359ceb5

Reported by GCC 9.x on Arch Linux.

4 years agocpdup(1): Add '-h' option and sort options in help and code
Aaron LI [Tue, 29 Oct 2019 14:49:41 +0000 (22:49 +0800)]
cpdup(1): Add '-h' option and sort options in help and code

* Add the '-h' option to show the help text
* Sort options in both code and help text
* Remove the redundant '-p' option from the source file
* The '-n' and '-S' options are missing from the help text, so add them.

See also: https://github.com/DragonFlyBSD/cpdup/commit/d87b2a60a95d0382135609bb17a014c8a0b61031

4 years agocpdup(1): Improve the help text a bit
Aaron LI [Tue, 29 Oct 2019 14:43:47 +0000 (22:43 +0800)]
cpdup(1): Improve the help text a bit

* Better format the help text to be clearer.
* The 'dest' argument is mandatory.

See also: https://github.com/DragonFlyBSD/cpdup/commit/22ef5685c8dd2ec770f7f2ee62f54b6e2b5f5f23

4 years agocpdup(1): Minor cleanups
Aaron LI [Tue, 29 Oct 2019 14:39:22 +0000 (22:39 +0800)]
cpdup(1): Minor cleanups

* In 'cpdup.h', remove an inaccurate comment about <strings.h>
  inclusion.
* Change predefined macro '__linux' to '__linux__', meanwhile add an
  empty define of '__dead2' under '__linux__' scope.
* In 'hcproto.c', put static variable 'chflags_warning' inside
  '_ST_FLAGS_PRESENT_' macro scrope.

Referred to the changes I made in the standalone 'cpdup' repo:
https://github.com/DragonFlyBSD/cpdup

4 years agonrelease: Fix 'make restartpkgs'
Aaron LI [Mon, 28 Oct 2019 15:39:29 +0000 (23:39 +0800)]
nrelease: Fix 'make restartpkgs'

'make restartpkgs' is broken because 'make install' would fail if the
port is alreay installed.  Fix this issue by executing 'make deinstall'
first, which would exit cleanly even if the port is not installed yet.

4 years agorelease.7: Sync environment variables with nrelease/Makefile
Aaron LI [Sun, 3 Mar 2019 13:37:28 +0000 (21:37 +0800)]
release.7: Sync environment variables with nrelease/Makefile

Remove obsolete "PKGBIN_MKISOFS" and "IMGUSBDEV".

Add "GITURL_SRC", "GITURL_DPORTS", "LABEL", "IMGSIZE" and "MAKE_JOBS".

Order these variables.

4 years agonrelease: Minor style improvements to the Makefile
Aaron LI [Sun, 3 Mar 2019 13:45:28 +0000 (21:45 +0800)]
nrelease: Minor style improvements to the Makefile