DragonFlyBSD/src 8b411d2sys/kern sys_process.c, sys/vfs/procfs procfs_subr.c procfs_vnops.c

kernel - Fix first-lwp access race vs process creation

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

DragonFlyBSD/src 4cc8110lib/libthread_xu/thread thr_mutex.c thr_umtx.c

pthreads - Fix incorrect fork assumption

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

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

Reported-by: zrj

DragonFlyBSD/src ea59862lib/libc/sys sigprocmask.2, lib/libc/upmap sigblockall.3 Makefile.inc

docs - Add manual page for sigblockall() and sigunblockall()

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

DragonFlyBSD/src e7126f0lib/libc/upmap ukp_setname.c, lib/libkvm kvm_proc.c

kernel and libc - Reimplement lwp_setname*() using /dev/lpmap

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

* The lwp_setname() system call now stores the title in

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

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

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

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

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

    [8 lines not shown]

DragonFlyBSD/src c52f518sys/kern kern_fork.c

libc - Implement sigblockall() and sigunblockall() (3)

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

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

DragonFlyBSD/src 1e7d860sys/gnu/vfs/ext2fs ext2_readwrite.c

sys/gnu/vfs/ext2fs: Use IO_SEQSHIFT

0d540a44319db497468b7c5b37893f5328ce7d5e was missing ext2.

DragonFlyBSD/src 17b2436sys/vfs/msdosfs msdosfs_vnops.c

sys/vfs/msdosfs: Support vfs clustering

from freebsd/freebsd at 8fdd1a79d0f77863b38e6de503ef08f19bef2e89

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

DragonFlyBSD/src 6147089sys/vfs/msdosfs msdosfs_vnops.c

sys/vfs/msdosfs: Fix va_fileid casts

bits from freebsd/freebsd at ab16560f3305829961b71dbe71233abcd50f0aba

DragonFlyBSD/src f3796bcsys/vfs/msdosfs msdosfs_vnops.c

sys/vfs/msdosfs: Save/restore fatchain cache in VOP_BMAP()

from freebsd/freebsd at 651827134bd3a0e50aa76f83e6b83d6976b010a6

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

DragonFlyBSD/src 0d540a4sys/vfs/hammer hammer_vnops.c, sys/vfs/hammer2 hammer2_vnops.c

sys/vfs: Use IO_SEQSHIFT

DragonFlyBSD/src 0ee0dafsbin/rcorder rcorder.c, usr.bin/msgs msgs.c

Use our standard bool type in a few places.

DragonFlyBSD/src 1a43169lib/libc/stdlib Symbol.map, lib/libc/upmap Symbol.map

libc: Fix up two Symbol.map's a bit.

* Keep _nmalloc_thr_init, it didn't go away.

* Put _libc_thr_init into DF508.0.

* Reindent like everywhere else.

DragonFlyBSD/src 4aa6d05sys/kern kern_memio.c kern_fork.c, sys/platform/pc64/vmm vmx.c

libc - Implement sigblockall() and sigunblockall() (2)

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

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

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

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

DragonFlyBSD/src 8e99ae4sys/kern kern_fork.c

kernele - lpmap work - split lwp_fork() into lwp_fork1() and lwp_fork2()

* Split lwp_fork() so we can have the lwp in-hand when issuing the
+94-841 files

DragonFlyBSD/src d9bb5dfsys/contrib/dev/acpica/source/components/parser psloop.c

acpi - Catch infinite parser recursions

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

  This prevents the kernel from double-faulting on excessively bad

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

DragonFlyBSD/src 6d3084esys/sys thread.h, sys/vfs/hammer2 hammer2_chain.c

kernel - Repurpose td_tracker

* Remove td_tracker use from hammer2

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

DragonFlyBSD/src 8b123e3usr.bin/vmstat vmstat.c

vmstat - Increase buffer for vmstat -m

* Increase the buffer from 1024 entries to 16384 entries.

DragonFlyBSD/src b8efa4blib/libc/string strtok.c

libc - make strtok() thread-safe

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

DragonFlyBSD/src 721505dlib/libc/gen _thread_init.c, lib/libc/stdlib nmalloc.c

libc - Implement sigblockall() and sigunblockall()

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

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

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

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

  These are extremely fast routines.

  - Reentrant / Recursable

    [25 lines not shown]

DragonFlyBSD/src 64b5a8asys/kern kern_memio.c kern_proc.c, sys/sys signal2.h upmap.h

kernel - sigblockall()/sigunblockall() support (per thread shared page)

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

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

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

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

  The low 31 bits represents a recursion counter, allowing recursive
  use of the functions.  The high bit (bit 31) is set by the kernel
  if a signal was prevented from being dispatched.  When userland decrements
  the counter to 0 (the low 31 bits), it can check and clear bit 31 and

    [37 lines not shown]

DragonFlyBSD/src 722c3b8test/cocci useful_macros.cocci

DragonFlyBSD/src c4ef74elibexec/ftpd ftpd.c, usr.bin/telnet commands.c telnet.1

Remove OPIE remains.

DragonFlyBSD/src 52fbd10. Makefile_upgrade.inc

Makefile_upgrade.inc: Sort a bit.

DragonFlyBSD/src 45e5feesys/vfs/msdosfs msdosfs_vnops.c

sys/vfs/msdosfs: Need to explicitly set bp to NULL

for several vnops.

DragonFlyBSD/src 9bb2c59usr.bin/dsynth dsynth.c build.c

dsynth - Improve 'debug' target, fix "x\n" in logs

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

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

DragonFlyBSD/src 2886f92sys/netinet6 nd6.c in6.c

inet6: Support the ioctl SIOCSIFINFO_IN6

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

Taken from NetBSD.

DragonFlyBSD/src 437a3batools/tools/net80211/wesside/wesside wesside.c

tools/wesside: Update to use /dev/tap directly

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

DragonFlyBSD/src 4bbbd8esys/net/tap if_tap.c, sys/sys param.h

if_tap: Handle 'SIOCSIFMTU' ioctl directly to support MTU > 1500

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

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

Also bump __DragonFly_version.

Obtained-from: FreeBSD (revision 189866)

DragonFlyBSD/src d60b57asbin/nos-tun nos-tun.c nos-tun.8

nos-tun(8): Directly use /dev/tun and remove option '-t'

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

DragonFlyBSD/src b2e7ce7sys/cpu/x86_64/include signal.h, sys/net if_clone.h

#include <sys/cdefs.h> in a number of headers that use macros from it.

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

DragonFlyBSD/src 92e9936sys/sys msgport.h

<sys/msgport.h>: Add <sys/types.h> for boolean_t (kernel only).
+2-01 files

DragonFlyBSD/src 68268a1usr.bin/calendar/calendars calendar.australia calendar.canada

calendar(1): Define "LANG" for national calendars

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

DragonFlyBSD/src 008d3e6usr.bin/calendar io.c

calendar(1): Reset locale after parsing each calendar file

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

DragonFlyBSD/src c22cba4usr.bin/calendar io.c calendar.c

calendar(1): Search calendar file in current directory first

This fixes the regression introduced in commit

DragonFlyBSD/src f8b849dusr.bin/calendar io.c calendar.c

calendar(1): Use login caps for 'calendar -a'

* Use 'fork()' and 'setusercontext(LOGIN_SETALL)' for every user.  With
  this change, the complex function 'cal()' that parses user-owned
  calendars is now executed with appropriate user privileges.

  Previously it was run with privileges dropped only temporary for
  execution of 'cal()', and fully dropped only before invoking 'sendmail'.

* In 'calendar -a' mode, the 'getenv("HOME")' in 'cal_fopen()' function
  always returns the root's home directory instead of the current user's
  home (after fork() and setusercontext()), which makes 'chdir(home)'

  Fix this issue by moving the 'chdir(home)' to the 'main()' function in
  'calendar.c'.  In the meantime, back to home directory in
  'cal_fopen()' function after opening the calendar file.

Partially based on FreeBSD's commit:

DragonFlyBSD/src effe59fusr.bin/calendar io.c day.c

calendar(1): Refactor mail header composition and sending

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

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

Obtained-from: OpenBSD

DragonFlyBSD/src 144b9c4usr.bin/calendar pathnames.h io.c

calendar(1): Merge 'pathnames.h' into 'io.c'

The '_PATH_INCLUDE' is no longer an appropriate name for the system
calendars at '/usr/share/calendar', because we no longer use 'cpp' to
parse the user's calendar file.

DragonFlyBSD/src f824736usr.bin/calendar day.c

calendar(1): Remove pointless playing with LC_TIME

Obtained-from: FreeBSD (revision 352115)

DragonFlyBSD/src 64f6dfcusr.bin/calendar/calendars calendar.australia calendar.holiday

calendar(1): Merge two fixes to calendars from FreeBSD

* Change the date of 'Canberra Day'

* Correct spelling for 'King Chulalongkorn Day in Thailand'

DragonFlyBSD/src ec2ffd9usr.bin/calendar calendar.1 calendar.c

calendar(1): Add '-h' and '-?' to show usage help

DragonFlyBSD/src 3a34e56usr.bin/calendar io.c calendar.c

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

DragonFlyBSD/src ce2bfbausr.bin/calendar/calendars calendar.music calendar.discord, usr.bin/calendar/calendars/ru_RU.UTF-8 calendar.primety calendar.history

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.

DragonFlyBSD/src 65d7c1d. Makefile_upgrade.inc, usr.bin/calendar Makefile

calendar(1): Remove redundant fr_FR.UTF-8/calendar.french

DragonFlyBSD/src cd0cff3usr.bin/calendar io.c parsedata.c

calendar(1): Various cleanups

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

DragonFlyBSD/src 04c7804usr.bin/calendar calendar.c calendar.1

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.

DragonFlyBSD/src 675224dusr.bin/calendar Makefile

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)

DragonFlyBSD/src 54dbcd5usr.bin/calendar/calendars calendar.judaic calendar.dutch, usr.bin/calendar/calendars/pt_BR.ISO8859-1 calendar.commemorative

calendar(1): Sync calendars from FreeBSD

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

DragonFlyBSD/src 148ae05usr.bin/calendar parsedata.c io.c

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.

    [2 lines not shown]

DragonFlyBSD/src 50c4303usr.bin/calendar/calendars/fr_FR.ISO8859-1 calendar.fetes calendar.proverbes, usr.bin/calendar/calendars/fr_FR.UTF-8 calendar.fetes calendar.proverbes

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.

DragonFlyBSD/src cb33f13sys/vfs/msdosfs msdosfs_vnops.c

sys/vfs/msdosfs: Cleanup before implementing vfs clustering

from freebsd/freebsd at b2bdcce9e10d5055a3afbfebf98e0e05fcd67113

Sync with a cleanup commit before FreeBSD added clustering support.