zrj [Mon, 11 Nov 2019 15:19:04 +0000 (17:19 +0200)]
<cpu/types.h>: Use basic LP types for vm_offset_t and vm_size_t.
Adjust PRI in biosacpi.c to use natural "%08x" specifier. The
sys/boot/pc32/libi386/biosacpi.c is only used in 32bit loader.
No other functional differences in both kernel and world.
zrj [Mon, 11 Nov 2019 14:46:30 +0000 (16:46 +0200)]
Add <sys/cpumask.h>.
Collect and gather all scatter cpumask bits to correct headers. This
cleans up the namespace and simplifies platform handling in asm macros.
The cpumask_t together with its macros is already non MI feature that is
used in userland utilities, libraries, kernel scheduler and syscalls.
It deserves sys/ header. Adjust syscalls.master and rerun sysent.
While there, fix an issue in ports that set POSIX env, but has
implementation of setting thread names through pthread_set_name_np().
zrj [Mon, 11 Nov 2019 10:10:04 +0000 (12:10 +0200)]
platform/pc64: Remove unused PDESIZE/PTESIZE constants.
Leftover from early x86_64 porting.
zrj [Mon, 11 Nov 2019 09:48:04 +0000 (11:48 +0200)]
cpu/x64_64: Move MMU page table types back to <cpu/pmap.h>.
Reduce namespace pollution. These types are common for both
pc64/vkernel64 and are used in pmap context only.
All userland cases need just VM_MAX_USER_ADDRESS, PS_STRINGS constants
through <machine/vmparam.h> with huge cpp expansion that requires
<machine/pmap.h> header inclusion anyway. Simplify it.
* Hard-code NPTEPG/NPDEPG/NPDPEPG/NPML4EPG constants to properly solve
header inclusion ordering. The SHIFT constants are hard-coded already
(log2() values) so there are no reasons to pretend everything will
adjust automatically.
* Use LU suffixes, debug printf() in vkernel64 use %ld types.
* Optionally reorder includes in libc setproctitle.c.
* Optionally add explicit includes in libkvm where pmap.h is only
coming from <sys/user.h>. The kvm_*_x86_64.c use X86_PG_* constants.
For now keep PDESIZE/PTESIZE (used in pc64 genassym.c).
No intermediates differences observed.
zrj [Mon, 11 Nov 2019 08:47:21 +0000 (10:47 +0200)]
<sys/types.h>: Declare register_t type directly.
It is expected by some of the ports. Use compiler attribute to select
correct word size if supported, else use LP types in for __register_t.
Remove unused u_register_t.
zrj [Mon, 11 Nov 2019 07:48:16 +0000 (09:48 +0200)]
<sys/types.h>: Adjust visibility of segsz_t.
It is a historic BSD type used in "struct vmspace", "struct kinfo_lwp".
Remove no longer needed __ intermediate type.
zrj [Mon, 11 Nov 2019 07:28:11 +0000 (09:28 +0200)]
<sys/sem.h>: Use generic types.
zrj [Sun, 10 Nov 2019 21:00:04 +0000 (23:00 +0200)]
<machine/stdint.h>: Adjust basic types to be more generic.
Use basic LP types for time_t to avoid need to use cast (uintmax_t) in
debug prints. The clock_t could be adjusted too, but previously on i386
DragonFly used int for this type.
The same could be done for vm_offset_t and vm_size_t.
zrj [Sun, 10 Nov 2019 16:37:57 +0000 (18:37 +0200)]
<machine/stdint.h>: Add two basic LP types.
These will be used to derive types that depend on data type models.
On x64_64 is is very simple. Non ILP32/LP64 model usage on UNIX-like
systems is rather exception. For example if we would support LLP64
data type model, we would declare these types as follows:
typedef long long __intlp_t;
typedef unsigned long long __uintlp_t;
zrj [Sun, 10 Nov 2019 20:32:58 +0000 (22:32 +0200)]
Adjust headers for <machine/stdint.h> visibility.
This also reduces namespace pollution a bit. Include <machine/stdint.h>
where <stdint.h> is used too. External compiler under -ffreestanding
(__STDC_HOSTED__ == 0) will use their own <stdint.h> version and will
not include <machine/stdint.h>.
zrj [Sun, 10 Nov 2019 15:03:35 +0000 (17:03 +0200)]
<stdint.h>: Move out ptrdiff_t type.
The ISO C does not specify that <stdint.h> should provide this type,
this type should be declared in <stddef.h> for use by userland.
Since we do not want to create a separate header for this useful type
to be used by kernel, move it to <sys/types.h> under _KERNEL visibility.
Adjust few places to include <stddef.h> with a minor whitespace cleanup.
Tomohiro Kusumi [Fri, 15 Nov 2019 22:23:24 +0000 (07:23 +0900)]
sys/vfs/msdosfs: Allow deupdat() against non root directory
bits from freebsd/freebsd@
c7af094e18c4e4ca2a26a88c488a803472d330ee
Given ondisk layout of root directory in FAT12/16 and FAT32,
don't allow deupdat() or setattr() against root directory,
but allow against other directories.
Sascha Wildner [Thu, 14 Nov 2019 10:13:19 +0000 (11:13 +0100)]
Revert "sys/vfs/msdosfs: Correct _PC_FILESIZEBITS value"
This reverts commit
6a951e106bca493303959d97e688c06f9ec21f3a.
32 bits is not enough because per the standard, it has to be the
minimum number of bits needed to represent, "as a signed integer
value", the maximum size of a regular file allowed in the specified
directory. And 32 is the lower limit of this value.
https://pubs.opengroup.org/onlinepubs/
9699919799/basedefs/limits.h.html
Tomohiro Kusumi [Fri, 15 Nov 2019 15:51:47 +0000 (00:51 +0900)]
sys/vfs/msdosfs: Correct _PC_FILESIZEBITS value
32 is enough (where did 33 come from ?).
Tomohiro Kusumi [Fri, 15 Nov 2019 15:18:08 +0000 (00:18 +0900)]
sys/vfs/msdosfs: Remove seemingly unneeded mbnambuf code
originally from
3435d5778808adf9c89a4f9f0e34010b4dc8888f in 2009.
Sync with what FreeBSD does.
Also sync minor styles with FreeBSD.
Matthew Dillon [Thu, 14 Nov 2019 00:39:26 +0000 (16:39 -0800)]
world - Add support for lwp_getname() and pthread_get_name_np()
* Add support for the new system call lwp_getname()
* Add support for pthread_get_name_np(), rounding out that function
set and improving ports compatibility.
Matthew Dillon [Thu, 14 Nov 2019 00:37:10 +0000 (16:37 -0800)]
kernel - Add lwp_getname() system call
* Add a new system call to support pthread_get_name_np().
Matthew Dillon [Wed, 13 Nov 2019 22:24:52 +0000 (14:24 -0800)]
cpuctl - Implement close() properly for /dev/cpuctl*
* The cpuctl device didn't implement close(). Properly implement
it so close() on cpuctl descriptors succeeds.
Reported-by: zrj
Sascha Wildner [Wed, 13 Nov 2019 21:17:26 +0000 (22:17 +0100)]
Makefile_upgrade.inc: Remove redundant entry.
Matthew Dillon [Wed, 13 Nov 2019 20:15:44 +0000 (12:15 -0800)]
dsynth - Use STRICT_DEPENDS instead of NO_DEPENDS
* Use STRICT_DEPENDS instead of NO_DEPENDS. NO_DEPENDS prevents
source-extraction dependencies, which is not what we want.
STRICT_DEPENDS is intended to ensure that dsynth installed
the proper precursor packages and to fail if it didn't.
Sascha Wildner [Wed, 13 Nov 2019 18:31:21 +0000 (19:31 +0100)]
libc: Remove _nmalloc_thr_init from Symbol.map again.
My fault, it is now internal only.
Pointed-out-by: dillon
Roy Marples [Wed, 13 Nov 2019 17:08:31 +0000 (17:08 +0000)]
contrib/dhcpcd - update README
Roy Marples [Wed, 13 Nov 2019 17:05:41 +0000 (17:05 +0000)]
Merge branch 'vendor/DHCPCD'
Tomohiro Kusumi [Thu, 14 Nov 2019 19:09:07 +0000 (04:09 +0900)]
sys/vfs/msdosfs: Assume up to 8192 bytes sector for BPB
from freebsd/freebsd@
dba17f21d375effcf89349e1d86b34b2f408ad0b
Tomohiro Kusumi [Thu, 14 Nov 2019 17:04:13 +0000 (02:04 +0900)]
sys/vfs/msdosfs: Return EBUSY on lookup on delete/rename of MSDOSFSROOT_OFS
from freebsd/freebsd@
e672feb26e335afc5801c618b8d3e24ee7d29414
Tomohiro Kusumi [Thu, 14 Nov 2019 16:10:04 +0000 (01:10 +0900)]
sys/vfs/msdosfs: Sync minor styles with FreeBSD
Tomohiro Kusumi [Wed, 13 Nov 2019 17:19:16 +0000 (02:19 +0900)]
sys/vfs/msdosfs: Allow B_CLUSTEROK in deupdat()
Since now that VFS clustering is supported, apply remaining bits
from freebsd/freebsd@
3bbdcb77fd843ff34a0054bea92392cee78dd0ec
that was dropped in
8480e7bcdf9ffa9f44f80f9362c6f62424ada748.
Tomohiro Kusumi [Wed, 13 Nov 2019 16:51:52 +0000 (01:51 +0900)]
sys/vfs/msdosfs: Don't use MSDOSFSMNT_WAITONFAT
from freebsd/freebsd@
5e07d49c626dea51d672ea9d9bd1499e0ae8eb29
Tomohiro Kusumi [Wed, 13 Nov 2019 15:33:13 +0000 (00:33 +0900)]
sys/vfs/msdosfs: Include FAT headers via <vfs/msdosfs/...>
Sync order with FreeBSD.
Roy Marples [Wed, 13 Nov 2019 17:01:06 +0000 (17:01 +0000)]
Import dhcpcd-8.1.2
* hooks: STOPPED is now run on timeout and exit
* BSD: Use IP_REVCIF rather than IN_PKTINFO
* DHCP: When rebinding, ensure we have a DHCP ARP state
* RA: Sort routers when reachability changes
* RA: Apply hoplimit, reachable and retrans timer values to kernel
* RA: Warn if advertised MTU > interface MTU
* dhcpcd: Report SSID connection to when we gain carrier
* DHCP: Fix corruption of address flags when renewing
Matthew Dillon [Tue, 12 Nov 2019 22:49:30 +0000 (14:49 -0800)]
kernel - Fix first-lwp access race vs process creation
* It is possible for a process to be looked up before its primary
lwp is installed. Make sure this doesn't crash the kernel.
Matthew Dillon [Tue, 12 Nov 2019 22:45:09 +0000 (14:45 -0800)]
pthreads - Fix incorrect fork assumption
* libthread_xu assumed that the forked child process's TID would be 1,
but that is no longer the case.
* Fix the assumption and correct some comments while we are here.
Reported-by: zrj
Matthew Dillon [Tue, 12 Nov 2019 19:54:57 +0000 (11:54 -0800)]
docs - Add manual page for sigblockall() and sigunblockall()
* Add a nice manual page for sigblockall() and sigunblockall()
Matthew Dillon [Tue, 12 Nov 2019 19:00:42 +0000 (11:00 -0800)]
kernel and libc - Reimplement lwp_setname*() using /dev/lpmap
* Generally speaking we are implementing the features necessary
to allow per-thread titling set via pthread_set_name_np() to
show up in 'ps' output, and to use lpmap to make it fast.
* The lwp_setname() system call now stores the title in
lpmap->thread_title[].
* Implement a libc fast-path for lwp_setname() using lpmap.
If called more than 10 times, libc will use lpmap for any
further calls, which omits the need to make any system calls.
* setproctitle() now stores the title in upmap->proc_title[]
instead of replacing proc->p_args. proc->p_args is now no
longer modified from its original contents.
* The kernel now includes lpmap->thread_title[] in the following
priority order when retrieving the process command line:
lpmap->thread_title[] User-supplied thread title, if not empty
upmap->proc_title[] User-supplied process title, if not empty
proc->p_args Original process arguments (no longer modified)
* Put the TID in /dev/lpmap for convenient access
* Enhance the KERN_PROC_ARGS sysctl to allow the TID to be specified.
The sysctl now accepts { KERN_PROC, KERN_PROC_ARGS, pid, tid }
in addition to the existing { KERN_PROC, KERN_PROC_ARGS, pid }
mechanism.
Enhance libkvm to use the new feature. libkvm will fall-back to
the old version if necessary.
Matthew Dillon [Tue, 12 Nov 2019 18:56:37 +0000 (10:56 -0800)]
libc - Implement sigblockall() and sigunblockall() (3)
* I half expected my reordering of lwp_fork*() to cause problems,
and it did. Fix a panic window due to the new lwp getting added
to the process before its underlying lwkt thread is assigned.
* Document the subtle issues, including the fact that in the
[v]fork() case we must assign the correct TID in lwp_fork1() for
vm_fork() to consume when dealing with /dev/lpmap
Tomohiro Kusumi [Tue, 12 Nov 2019 18:34:55 +0000 (03:34 +0900)]
sys/gnu/vfs/ext2fs: Use IO_SEQSHIFT
0d540a44319db497468b7c5b37893f5328ce7d5e was missing ext2.
Tomohiro Kusumi [Tue, 12 Nov 2019 18:02:39 +0000 (03:02 +0900)]
sys/vfs: Use IO_SEQSHIFT
Tomohiro Kusumi [Tue, 12 Nov 2019 16:05:59 +0000 (01:05 +0900)]
sys/vfs/msdosfs: Fix va_fileid casts
bits from freebsd/freebsd@
ab16560f3305829961b71dbe71233abcd50f0aba
Tomohiro Kusumi [Tue, 12 Nov 2019 15:09:05 +0000 (00:09 +0900)]
sys/vfs/msdosfs: Save/restore fatchain cache in VOP_BMAP()
from freebsd/freebsd@
651827134bd3a0e50aa76f83e6b83d6976b010a6
Prevent VOP_BMAP() from updating FC_LASTMAP fatchain cache
with irrelevant location.
Tomohiro Kusumi [Mon, 11 Nov 2019 20:57:40 +0000 (05:57 +0900)]
sys/vfs/msdosfs: Support vfs clustering
from freebsd/freebsd@
8fdd1a79d0f77863b38e6de503ef08f19bef2e89
fio shows random read/write throughput improvement by 10% or so.
Sascha Wildner [Tue, 12 Nov 2019 10:12:58 +0000 (11:12 +0100)]
Use our standard bool type in a few places.
Sascha Wildner [Tue, 12 Nov 2019 08:37:53 +0000 (09:37 +0100)]
libc: Fix up two Symbol.map's a bit.
* Keep _nmalloc_thr_init, it didn't go away.
* Put _libc_thr_init into DF508.0.
* Reindent like everywhere else.
Matthew Dillon [Tue, 12 Nov 2019 05:38:33 +0000 (21:38 -0800)]
libc - Implement sigblockall() and sigunblockall() (2)
* Cleanup the logic a bit. Store the lwp or proc pointer
in the vm_map_backing structure and make vm_map_fork()
and friends more aware of it.
* Rearrange lwp allocation in [v]fork() to make the pointer(s)
available to vm_fork().
* Put the thread mappings on the lwp's list immediately rather
than waiting for the first fault, which means that per-thread
mappings will be deterministically removed on thread exit
whether any faults happened or not.
* Adjust vmspace_fork*() functions to not propagate 'dead' lwp
mappings for threads that won't exist in the forked process.
Only the lwp mappings for the thread doing the [v]fork() is
retained.
Matthew Dillon [Tue, 12 Nov 2019 03:24:48 +0000 (19:24 -0800)]
kernele - lpmap work - split lwp_fork() into lwp_fork1() and lwp_fork2()
* Split lwp_fork() so we can have the lwp in-hand when issuing the
vm_fork().
Matthew Dillon [Tue, 12 Nov 2019 02:14:07 +0000 (18:14 -0800)]
acpi - Catch infinite parser recursions
* Instrument AcpiPsParseLoop() and limited recursion depth to 5.
Generally speaking this loop can call a very deep stack of
routines and eat up the kernel stack. A depth limit of 5 might
be a bit too low, but it doesn't take much more to blow up
our current 16KB kernel stack.
This prevents the kernel from double-faulting on excessively bad
AML.
* Works around reported boot-time double-faults on some laptops.
Matthew Dillon [Tue, 12 Nov 2019 02:12:57 +0000 (18:12 -0800)]
kernel - Repurpose td_tracker
* Remove td_tracker use from hammer2
* The field is now a general purpose call recursion tracker, base
value 0.
Matthew Dillon [Tue, 12 Nov 2019 02:03:00 +0000 (18:03 -0800)]
vmstat - Increase buffer for vmstat -m
* Increase the buffer from 1024 entries to 16384 entries.
Matthew Dillon [Tue, 12 Nov 2019 01:51:35 +0000 (17:51 -0800)]
libc - make strtok() thread-safe
* Make strtok() thread-safe. Applications are getting too complex
to trust that they will do the right thing.
Matthew Dillon [Tue, 12 Nov 2019 01:35:42 +0000 (17:35 -0800)]
libc - Implement sigblockall() and sigunblockall()
* Signal safety is becoming a defacto requirement for most of libc and
pthreads. In particular, the memory allocator. Given the chances of
teaching tens of thousands of programmers about signal safety, and
just making it work in libc and pthreads, only one of these two
possibilities is actually realizable.
In particular, high-level languages have become so complex, and some
applications (chrome, firefox, etc) have become so complex, that the
code is regularly tripping over signal safety issues.
However, implementing signal safety with current mechanisms is extremely
expensive due to the need for multiple system calls. To whit,
DragonFlyBSD now has a mechanism that does not require system calls
in the critical path.
* Implement sigblockall() and sigunblockall(). These functions
leverage the new /dev/lpmap per-thread shared page mechanism
to provide a way to temporary block the dispatch of all maskable
signals without having to make any system calls.
These are extremely fast routines.
- Reentrant / Recursable
- Temporarily blocks any dispatch of a maskable asynchronous signal
to the calling thread. Other threads are not affected... this is
a per-thread mechanism.
- The last sigunblockall() will immediately dispatch any blocked
signals.
- The normal signal mask is not affected by these routines.
- Does not block signals caused by synchronous traps.
- The current recursion count is retained on [v]fork() to ease
coding and to also allow signals to be temporarily blocked across a
fork until the child process is ready to deal with them, if desired.
* Implement signal safety for most of pthreads. All temporary internal
mutexes are now wrapped with sigblockall() and sigunblockall().
* Implement signal safety for the malloc subsystem. All functions
are wrawpped with sigblockall() and sigunblockall().
These implementations make lang/mono and lang/rust far more reliable
than they were before. Where 9 out of 10 builds used to fail, now
they succeed.
Matthew Dillon [Tue, 12 Nov 2019 01:06:55 +0000 (17:06 -0800)]
kernel - sigblockall()/sigunblockall() support (per thread shared page)
* Implement /dev/lpmap, a per-thread RW shared page between userland
and the kernel. Each thread in the process will receive a unique
shared page for communication with the kernel when memory-mapping
/dev/lpmap and can access varous variables via this map.
* The current thread's TID is retained for both fork() and vfork().
Previously it was only retained for vfork(). This avoids userland
code confusion for any bits and pieces that are indexed based on the
TID.
* Implement support for a per-thread block-all-signals feature that
does not require any system calls (see next commit to libc). The
functions will be called sigblockall() and sigunblockall().
The lpmap->blockallsigs variable prevents normal signals from being
dispatched. They will still be queued to the LWP as per normal.
The behavior is not quite that of a signal mask when dealing with
global signals.
The low 31 bits represents a recursion counter, allowing recursive
use of the functions. The high bit (bit 31) is set by the kernel
if a signal was prevented from being dispatched. When userland decrements
the counter to 0 (the low 31 bits), it can check and clear bit 31 and
if found to be set userland can then make a dummy 'real' system call
to cause pending signals to be delivered.
Synchronous TRAPs (e.g. kernel-generated SIGFPE, SIGSEGV, etc) are not
affected by this feature and will still be dispatched synchronously.
* PThreads is expected to unmap the mapped page upon thread exit.
The kernel will force-unmap the page upon thread exit if pthreads
does not.
XXX needs work - currently if the page has not been faulted in
the kernel has no visbility into the mapping and will not unmap it,
but neither will it get confused if the address is accessed. To
be fixed soon. Because if we don't, programs using LWP primitives
instead of pthreads might not realize that libc has mapped the page.
* The TID is reset to 1 on a successful exec*()
* On [v]fork(), if lpmap exists for the current thread, the kernel will
copy the lpmap->blockallsigs value to the lpmap for the new thread
in the new process. This way sigblock*() state is retained across
the [v]fork().
This feature not only reduces code confusion in userland, it also
allows [v]fork() to be implemented by the userland program in a way
that ensures no signal races in either the parent or the new child
process until it is ready for them.
* The implementation leverages our vm_map_backing extents by having
the per-thread memory mappings indexed within the lwp. This allows
the lwp to remove the mappings when it exits (since not doing so
would result in a wild pmap entry and kernel memory disclosure).
* The implementation currently delays instantiation of the mapped
page(s) and some side structures until the first fault.
XXX this will have to be changed.
Sascha Wildner [Mon, 11 Nov 2019 09:13:46 +0000 (10:13 +0100)]
useful_macros.cocci: Improve a bit.
Submitted-by: Markus Elfring
https://github.com/DragonFlyBSD/DragonFlyBSD/commit/
194bb2afcef86db2c8a0a56b7d8527aa3eb01fb0#commitcomment-
35885096
Sascha Wildner [Mon, 11 Nov 2019 08:15:56 +0000 (09:15 +0100)]
Makefile_upgrade.inc: Sort a bit.
Sascha Wildner [Mon, 11 Nov 2019 08:15:39 +0000 (09:15 +0100)]
Remove OPIE remains.
Tomohiro Kusumi [Sun, 10 Nov 2019 16:27:06 +0000 (01:27 +0900)]
sys/vfs/msdosfs: Need to explicitly set bp to NULL
for several vnops.
Matthew Dillon [Sun, 10 Nov 2019 16:53:09 +0000 (08:53 -0800)]
dsynth - Improve 'debug' target, fix "x\n" in logs
* Improve the 'debug' target. Remove the target packages first,
just like the 'test' target, and include a description for the
'debug' target in dsynth help.
* Change the pty handshake to just a newline, it still shows up in the
logs due to (probably) master-pty echo mode, but it isn't really
noticeable verses the previous "x\n".
Roy Marples [Sun, 10 Nov 2019 15:17:54 +0000 (15:17 +0000)]
inet6: Support the ioctl SIOCSIFINFO_IN6
This allows setting hop limit, reachable and retransmit times,
as well as link mtu for the interface.
It's analogous to the SIOCGIFINFO_IN6 ioctl.
Taken from NetBSD.
Aaron LI [Sun, 10 Nov 2019 09:28:52 +0000 (17:28 +0800)]
if_tap: Handle 'SIOCSIFMTU' ioctl directly to support MTU > 1500
Add the SIOCSIFMTU ioctl handling directly to tap(4) permitting it to
have its MTU set higher than 1500 (ETHERMTU). Its new limit is now
65535 as enforced by 'ifhwioctl()' in 'if.c'.
This allows a tap(4) device to be added to a bridge, which requires all
interface members to have the same MTU, with an interface configured for
jumbo frames. QEMU may now connect to a network via tap(4) without
requiring the real interface to have its MTU set to 1500 or lower.
Also bump __DragonFly_version.
Obtained-from: FreeBSD (revision 189866)
Aaron LI [Thu, 30 Aug 2018 13:09:54 +0000 (21:09 +0800)]
tools/wesside: Update to use /dev/tap directly
Use the autocloner /dev/tap instead of relying upon pre-created (and
hard-coded) /dev/tap3.
Aaron LI [Thu, 30 Aug 2018 13:05:50 +0000 (21:05 +0800)]
nos-tun(8): Directly use /dev/tun and remove option '-t'
Update nos-tun(8) to directly use /dev/tun instead of the pre-created
/dev/tunX devices. Therefore, the option '-t' is no longer used and
removed.
Sascha Wildner [Sun, 10 Nov 2019 10:12:32 +0000 (11:12 +0100)]
#include <sys/cdefs.h> in a number of headers that use macros from it.
All these are public headers and check some kind of __*_VISIBLE macro
with #if but were not making sure that these macros are available and
set correctly.
Sascha Wildner [Sun, 10 Nov 2019 10:26:12 +0000 (11:26 +0100)]
<sys/msgport.h>: Add <sys/types.h> for boolean_t (kernel only).
Aaron LI [Sun, 10 Nov 2019 04:43:14 +0000 (12:43 +0800)]
calendar(1): Define "LANG" for national calendars
Similar to the other national calendars in 'calendars/*.UTF-8'
directories.
Aaron LI [Sun, 10 Nov 2019 04:40:45 +0000 (12:40 +0800)]
calendar(1): Reset locale after parsing each calendar file
This avoids that one calendar file that changed the locale by defining
the "LANG") does not interfere the following calendar files without the
"LANG" definition.
Aaron LI [Sun, 10 Nov 2019 03:54:44 +0000 (11:54 +0800)]
calendar(1): Search calendar file in current directory first
This fixes the regression introduced in commit
f8b849d1082177cbfa11f941feeeced54815dc56.
Aaron LI [Sun, 10 Nov 2019 02:27:24 +0000 (10:27 +0800)]
calendar(1): Refactor mail header composition and sending
* Use 'struct iovec header[]' to hold all mail headers, and then use
writev(2) to write them into the pipe.
* Explicitly set 'LC_TIME=C' when formating the date string for the mail
header.
Obtained-from: OpenBSD
Aaron LI [Sat, 9 Nov 2019 14:56:57 +0000 (22:56 +0800)]
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.
Aaron LI [Sat, 9 Nov 2019 13:49:18 +0000 (21:49 +0800)]
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)'
fail.
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:
https://github.com/freebsd/freebsd/commit/
7ff75f4a5a3d9ada5bd68384fdded357fa4c1105
Aaron LI [Wed, 6 Nov 2019 14:53:38 +0000 (22:53 +0800)]
calendar(1): Remove pointless playing with LC_TIME
Obtained-from: FreeBSD (revision 352115)
https://github.com/freebsd/freebsd/commit/
259fac94399127186906acf0e975dffdb6e48bc7
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
Aaron LI [Wed, 6 Nov 2019 14:19:59 +0000 (22:19 +0800)]
calendar(1): Add '-h' and '-?' to show usage help
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)
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.
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.
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'.
Aaron LI [Mon, 18 Feb 2019 05:30:35 +0000 (13:30 +0800)]
calendar(1): Remove redundant fr_FR.UTF-8/calendar.french
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.
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)
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.
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.
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.
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#.
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.
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
Tomohiro Kusumi [Fri, 8 Nov 2019 19:01:18 +0000 (04:01 +0900)]
sys/vfs/msdosfs: Fix typo
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.
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.
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.
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).
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
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.
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.
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
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.
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
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
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.
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
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
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 ...
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