Commit Graph

872 Commits

Author SHA1 Message Date
martin c6630d5f97 Pull up following revision(s) (requested by riastradh in ticket #383):
external/cddl/osnet/sys/kern/kmem.c: revision 1.4

solaris: Use pool_cache_reclaim, not pool_cache_invalidate.

pool_cache_invalidate invalidates cached objects, but doesn't return
any backing pages to the underlying page allocator.
pool_cache_reclaim does pool_cache_invalidate _and_ reutrns backing
pages to the underlying page alloator, so it is actually useful for
the page daemon to do when trying to free memory.

PR kern/57558
2023-10-02 13:29:59 +00:00
martin ec57a52dac Pull up following revision(s) (requested by riastradh in ticket #364):
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_ioctl.c: revision 1.26

Revert "Teach zfs bdevsw to do b_psize."

This is used only by dump and swap, which won't work safely on zvols
anyway.  We should make swap work eventually, but right now it's
leading unwary ussers into deadlock scenarios, so let's make it fail
early instead.
2023-09-11 13:38:42 +00:00
martin debe39be64 Pull up following revision(s) (requested by maya in ticket #316):
sys/arch/m68k/include/mutex.h: revision 1.13
	sys/arch/arm/include/cpu.h: revision 1.125
	sys/arch/sun68k/include/intr.h: revision 1.21
	sys/arch/arm/include/mutex.h: revision 1.28
	sys/sys/rwlock.h: revision 1.18
	sys/arch/powerpc/include/mutex.h: revision 1.7
	sys/arch/arm/include/mutex.h: revision 1.29
	sys/arch/powerpc/include/mutex.h: revision 1.8
	sys/uvm/uvm_param.h: revision 1.42
	sys/sys/ksem.h: revision 1.16
	sys/arch/x86/include/mutex.h: revision 1.10
	sys/sys/proc.h: revision 1.372
	sys/sys/ksem.h: revision 1.17
	sys/arch/ia64/include/mutex.h: revision 1.8
	sys/arch/evbarm/include/intr.h: revision 1.29
	sys/sys/lua.h: revision 1.9
	sys/arch/next68k/include/intr.h: revision 1.23
	sys/arch/ia64/include/mutex.h: revision 1.9
	sys/arch/hp300/include/intr.h: revision 1.35
	sys/arch/hp300/include/intr.h: revision 1.36
	sys/arch/sparc/include/cpu.h: revision 1.111
	sys/arch/hppa/include/mutex.h: revision 1.16
	sys/arch/vax/include/intr.h: revision 1.31
	sys/arch/hppa/include/mutex.h: revision 1.17
	sys/arch/news68k/include/intr.h: revision 1.28
	sys/arch/hppa/include/mutex.h: revision 1.18
	sys/arch/hppa/include/intr.h: revision 1.3
	sys/arch/hppa/include/mutex.h: revision 1.19
	sys/arch/hppa/include/intr.h: revision 1.4
	sys/sys/sched.h: revision 1.92
	sys/opencrypto/cryptodev.h: revision 1.51
	sys/arch/vax/include/mutex.h: revision 1.20
	sys/arch/sparc64/include/mutex.h: revision 1.10
	sys/arch/ia64/include/sapicvar.h: revision 1.2
	sys/arch/riscv/include/mutex.h: revision 1.5
	sys/arch/amiga/dev/grfabs_cc.c: revision 1.39
	sys/external/bsd/drm2/include/linux/idr.h: revision 1.11
	sys/arch/riscv/include/mutex.h: revision 1.6
	sys/ddb/files.ddb: revision 1.16
	sys/arch/mac68k/include/intr.h: revision 1.32
	share/man/man4/ddb.4: revision 1.203
	sys/ddb/db_command.c: revision 1.183
	sys/arch/mips/include/mutex.h: revision 1.10
	sys/ddb/db_command.c: revision 1.184
	sys/arch/x68k/include/intr.h: revision 1.22
	sys/arch/sparc/include/psl.h: revision 1.51
	sys/arch/or1k/include/mutex.h: revision 1.4
	sys/arch/mips/include/mutex.h: revision 1.11
	sys/arch/arm/xscale/pxa2x0_intr.h: revision 1.16
	sys/arch/sparc64/include/cpu.h: revision 1.134
	sys/arch/sparc/include/psl.h: revision 1.52
	sys/arch/or1k/include/mutex.h: revision 1.5
	sys/arch/mvme68k/include/intr.h: revision 1.22
	sys/arch/luna68k/include/intr.h: revision 1.16
	external/cddl/osnet/sys/sys/kcondvar.h: revision 1.6
	sys/arch/sparc/include/mutex.h: revision 1.12
	sys/arch/sparc/include/mutex.h: revision 1.13
	sys/arch/usermode/include/mutex.h: revision 1.5
	sys/arch/usermode/include/mutex.h: revision 1.6
	sys/kern/kern_core.c: revision 1.38
	usr.sbin/crash/Makefile: revision 1.49
	sys/arch/amiga/include/intr.h: revision 1.23
	sys/arch/alpha/include/mutex.h: revision 1.12
	sys/arch/alpha/include/mutex.h: revision 1.13
	sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.16
	sys/ddb/ddb.h: revision 1.6
	sys/arch/sparc64/include/mutex.h: revision 1.8
	sys/arch/sh3/include/mutex.h: revision 1.12
	sys/arch/evbarm/lubbock/sacc_obio.c: revision 1.17
	sys/ddb/db_syncobj.c: revision 1.1
	sys/arch/vax/include/mutex.h: revision 1.18
	sys/arch/sparc64/include/psl.h: revision 1.63
	sys/arch/sparc64/include/mutex.h: revision 1.9
	sys/arch/sh3/include/mutex.h: revision 1.13
	sys/arch/evbarm/lubbock/obio.c: revision 1.13
	sys/arch/atari/include/intr.h: revision 1.23
	sys/ddb/db_syncobj.c: revision 1.2
	sys/arch/vax/include/mutex.h: revision 1.19
	sys/arch/evbarm/g42xxeb/obio.c: revision 1.14
	sys/arch/evbarm/g42xxeb/obio.c: revision 1.15
	sys/arch/cesfic/include/intr.h: revision 1.14
	sys/ddb/db_syncobj.h: revision 1.1
	sys/arch/x86/include/cpu.h: revision 1.134
	sys/arch/evbarm/g42xxeb/obio.c: revision 1.16
	sys/arch/cesfic/include/intr.h: revision 1.15
	sys/arch/arm/xscale/pxa2x0_intr.c: revision 1.26
	sys/sys/cpu_data.h: revision 1.54
	sys/arch/m68k/include/mutex.h: revision 1.12
	sys/arch/ia64/acpi/madt.c: revision 1.6

sys/rwlock.h: Make this more self-contained for bool.

machine/mutex.h: Sprinkle includes so this can be used by crash(8).

ddb: New `show all tstiles' command.
Shows who's waiting for which locks and what the owner is up to.

Include psl.h for ipl_cookie_t if __MUTEX_PRIVATE

sys: Rip <sys/resourcevar.h> out of <uvm/uvm_param.h>.

And thus out of <sys/param.h>, which is exceedingly overused and
fragile and delenda est.

Should fix (some) issues with the recent inclusion of machine/lock.h
in various machine/mutex.h files.

arm/mutex.h: Need machine/intr.h, machine/lock.h.

For ipl_cookie_t and __cpu_simple_lock_t.
evbarm/intr.h: Define ipl_cookie_t before including ARM_INTR_IMPL.

Otherwise arm/mutex.h doesn't work, due to a cyclic dependency which
should really be fixed.
opencrypto/cryptodev.h: Fix includes.
- Move sys/condvar.h under #ifdef _KERNEL.
- Add some other necessary includes and forward declarations.
- Sort.

hp300/intr.h: Fix missing includes.
linux/idr.h: Need <sys/mutex.h> for kmutex_t.
amiga/intr.h: Don't define spl*() functions if !_KERNEL.

This is used by crash(8) now, and what's important is ipl_cookie_t.
cesfic/intr.h: Expose ipl_cookie_t to userland for crash(8).
cesfic/intr.h: Expose ipl_cookie_t to userland only with _KMEMUSER.

Probably not necessary but let's be a little more cautious about
this.

atari/intr.h: Expose ipl_cookie_t with _KMEMUSER for crash(8).

arm/cpu.h: Need sys/param.h for COHERENCY_UNIT.

Nix machine/param.h -- not meant to be used directly, pulled in by
sys/param.h.

Move the definition of ipl_cookie_t out of the kernel-only sections,
some _KMEMUSER applications need it.

ddb: Cast pointer to uintptr_t first before db_expr_t.

hppa/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

luna68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

mvme68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

news68k/intr.h: Fix includes.  Put some definitions under _KERNEL.

next68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

sys/ksem.h: Hack around fstat(8) abuse of _KERNEL.

sun68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

vax/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).

x68k/intr.h: Put functions under _KERNEL so crash(8) can use this.

Make ipl_cookie_t visible for _KMEMUSER userland applications.

fix editor mishap in previous

Explicitly include <sys/mutex.h> for kmutex_t.

Replace kmutex_t * (which may be undefined here) with struct kmutex *,
suggested by Taylor.

hp300/intr.h: Put most of this under #ifdef _KERNEL.
Only ipl_cookie_t really needs to be exposed now, for crash(8).

mac68k/intr.h: Expose ipl_cookie_t to _KMEMUSER for crash(8).
Make inclusion of sys/intr.h explicit for spl*.

fix hppa and vax builds.

machine/lock.h isn't necessary for __cpu_simple_lock_t, it's in
sys/types.h.  avoids cpu_data.h vs sched.h include order issues.

move the hppa ipl_t typedef with the moved usage of it.
machine/mutex.h: Sprinkle sys/types.h, omit machine/lock.h.

Turns out machine/lock.h is not needed for __cpu_simple_lock_t, which
always comes from sys/types.h.  And, really, sys/types.h (or at least
sys/stdint.h) is needed for uintN_t and uintptr_t.

ddb: Cast pointer to uintptr_t, then to db_expr_t.
Avoids warnings about conversion between pointer and integer of
different size on some architectures.

re-fix hppa builds.

this file uses __cpu_simple_lock(), not just the underlying type,
so it does need machine/lock.h.

Break cycle by using `struct kmutex *' instead of `kmutex_t *'.
sys/sched.h included sys/mutex.h
which includes sys/intr.h
which includes machine/intr.h
which on cats includes arm/footbridge/footbridge_intr.h
which includes arm/cpu.h
which includes sys/cpu_data.h
which includes sys/sched.h

But there was never any real need for sys/mutex.h in sys/sched.h,
because it only uses pointers to the opaque struct kmutex.  Cycle
broken by using `struct kmutex *' instead of pulling in sys/mutex.h
for the definition of kmutex_t.

Side effect: This revealed that sys/cpu_data.h needed sys/intr.h
(which was pulled in accidentally by sys/mutex.h via sys/sched.h) for
SOFTINT_COUNT.  Also revealed some other machine/cpu.h header files
were missing includes of sys/mutex.h for kmutex_t.

ia64: Need sys/types.h for u_int, vaddr_t; sys/mutex.h for kmutex_t.

explicitly include no longer implicitly included sys/mutex.h.

arm/xscale: Use sys/bitops.h fls32 - 1 instead of 31 - __builtin_clz.
Sidesteps namespace collision with `#define bits ...' in net/zlib.c.

complete the previous - there were two calls to find_first_bit() to fix.

arm/xscale: Missed a spot with previous find_first_bit commit.

evbarm/g42xxeb: Fix off-by-one in previous.

The original find_first_bit(x) was 31 - __builtin_clz((uint32_t)x),
which is equivalent to fls32(x) - 1, not to fls32(x).

Note that fls32 is 1-based and returns 0 for x=0.
2023-08-09 17:42:01 +00:00
martin 56c0141f25 Pull up following revision(s) (requested by riastradh in ticket #221):
external/cddl/osnet/dist/tools/ctf/cvt/ctfmerge.c: revision 1.18
	external/cddl/osnet/sys/sys/opentypes.h: revision 1.7
	tools/compat/configure: revision 1.100
	external/cddl/osnet/dist/tools/ctf/cvt/barrier.c: revision 1.6
	external/cddl/osnet/dist/tools/ctf/cvt/barrier.h: revision 1.4
	external/cddl/osnet/dist/tools/ctf/cvt/barrier.c: revision 1.7
	external/cddl/osnet/dist/tools/ctf/cvt/barrier.c: revision 1.8
	tools/compat/configure.ac: revision 1.100
	external/cddl/osnet/dist/tools/ctf/cvt/tdata.c: revision 1.10
	tools/compat/nbtool_config.h.in: revision 1.54

ctfmerge: error check sem_*() and pthread_*() APIs

terminate() if sem_*() returns -1 or pthread_*() returns != 0.
(Set errno from pthread_*() so terminate() prints the strerror message).

Note: Failing on errors instead of ignoring them helps identify
reasons for intermittent failures, such as those on macOS host builds:

  ERROR: nbctfmerge: barrier_init: sem_init(bar_sem): Function not implemented

ctfmerge: fix macOS semaphore implementation

Use dispatch_semaphore_create() if present instead of sem_init().
macOS doesn't actually implement sem_init() (et al)
(even though it provides the prototypes as deprecated).

This was detected by the previous commit to ctfmerge
that added error handling.

Implement ctfmerge's barrier operations in terms of
dispatch(3) APIs such as dispatch_semaphore_create() (et al).

Update tools/compat/configure.ac to find dispatch_semaphore_create().
Fixes ctfmerge on macOS hosts.

Inspired by https://stackoverflow.com/a/27847103

tools/compat: regen for dispatch_semaphore_create

ctfmerge: fix macOS semaphore implementation, part 2
dispatch_semaphore_signal() doesn't return an error, just an
indicator of whether a thread was woken or not, so there's
no need to fail on non-zero return.

osnet: on macOS, use <mach/boolean.h> for boolean_t
macOS/x86_64 defines boolean_t as 'unsigned int' not 'int',
which causes a build issue with tools/ctfmerge on that host
after my recent fixes for macOS semaphores.

So use the <mach/boolean.h> instead of a local typedef ifdef __APPLE__.
May fix a macOS/x86_64 build issue reported by cjep@.
Builds fine on NetBSD/amd64 or macOS/arm.

Note: this compat stuff is clunky, and based on the commit log,
annoyingly error prone. A newer sync of osnet from upstream /may/
improve a lot of these compat typedef workarounds for solaris types...
2023-06-30 17:13:50 +00:00
martin 5cd6b8e6ba Pull up following revision(s) (requested by hannken in ticket #110):
external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vnops.c: revision 1.81

Adapt zfs_netbsd_access() to ACL support.  As ZFS itself only
handles VREAD, VWRITE, VEXEC and VAPPEND we use kauth_authorize_vnode()
to handle VADMIN.

From FreeBSD.
2023-03-05 14:32:41 +00:00
martin 72874c33a2 Pull up following revision(s) (requested by chs in ticket #74):
external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c: revision 1.16

dtrace: remove unnecessary fflush()

Apply this commit from FreeBSD:

  commit f339a3ef6369b368f3a2455792a7a3a4c28f92c4
  Author: Chuck Silvers <chs@FreeBSD.org>
  Date:   Wed Feb 9 17:09:26 2022 -0800

      dtrace: remove unnecessary fflush()

      This call was added back in the early days of dtrace porting and
      no one knows why anymore.  The extra flushing causes lots of
      unnecessary CPU overhead when a script produces lots of output,
      as well as easily losing output because the command can't keep up.

      Sponsored by:	Netflix
      Reviewed by:	imp, markj
      Differential Revision:	https://reviews.freebsd.org/D34216
2023-02-08 17:25:56 +00:00
martin cf249b79f9 Pull up following revision(s) (requested by chs in ticket #69):
external/cddl/osnet/dist/lib/libdtrace/common/dt_subr.c: revision 1.15

dtrace: re-fix aggregations to report from all online CPUs

Reapply the fix to dt_status() from rev 1.10
("Don't return success when the target CPU is offline")
which was lost in rev 1.12 ("sync with FreeBSD").

The FreeBSD version that we have been using since then does run on NetBSD
but always reports that CPU 0 is online and all other CPUs are offline,
because the sysctl that it uses does not exist on NetBSD.
2023-02-08 14:40:23 +00:00
hannken cfe3f2c399 Add a helper to set or clear lower mount and use it.
Always add a reference to the lower mount.

Ride 9.99.105
2022-11-04 11:20:39 +00:00
simonb 6abe31b74d Provide an empty ASSERT macro ifdef _STANDALONE. 2022-10-31 10:44:29 +00:00
simonb 424b4ac256 Whitespace nit. 2022-10-31 10:32:28 +00:00
simonb b132f31296 Only need TIMESPEC_OVERFLOW() to check against INT32_{MIN,MAX} on FreeBSD. 2022-10-31 04:50:12 +00:00
nia 06871316e9 Remove references to GEOM from zpool(8). 2022-10-24 14:22:53 +00:00
kardel 2b1d295dd5 Revert. Spotted by hannken@ - fix needs to be in zfs_ctldir.c it is missing
VOP_PATHCONF.
2022-10-03 16:04:19 +00:00
kardel 4c598b636f for unsupported names return EINVAL as per TOG
https://pubs.opengroup.org/onlinepubs/9699919799/functions/fpathconf.html
discussed with christos@
2022-09-27 10:33:21 +00:00
mlelstv 75ded7d598 Reference kernel-wide hz constant instead of using a private but possibly
different value.
2022-09-19 22:30:19 +00:00
riastradh 37d4d19175 dtrace_fbt: Allow tracing names that start with `__'.
This was never relevant on FreeBSD and I don't think it is relevant on
NetBSD either.  The FreeBSD change to lift this restriction had the
following comment:

    r306570 | markj | 2016-10-02 00:35:00 +0000 (Sun, 02 Oct 2016) | 7 lines

    Allow tracing of functions prefixed by "__".

    This restriction was inherited from upstream but is not relevant on FreeBSD.
    Furthermore, it hindered the tracing of locking primitive subroutines.
2022-09-02 11:03:50 +00:00
riastradh c5301d0824 dtrace_sdt: Fix bug in builtin module reference counting.
Don't module_hold(NULL)!  This mistake was introduced in my attempt
to get dtrace working for sdt probes defined in non-builtin modules
like zfs.
2022-08-31 12:34:04 +00:00
riastradh 72797797ee dtrace/i386: Need machine/cpufunc.h for x86_read_flags and rcr2. 2022-08-21 18:58:45 +00:00
riastradh dead83d64a bsd.kmodule.mk: Build modules with KDTRACE_HOOKS if MKDTRACE=yes. 2022-08-07 23:42:09 +00:00
riastradh 81efaf9e90 dtrace_sdt: Register sdt providers and probes in loaded modules too. 2022-08-07 20:47:05 +00:00
chs 02f91ef077 change the ARC reclaim code to use the pagedaemon's free page target
rather than having a separate target.
2022-08-03 01:53:06 +00:00
riastradh e3c82a0cc6 solaris: Give threads less bad names. 2022-07-30 13:09:19 +00:00
riastradh d3d72cee9c osnet: Stop disabling dtrace probes. 2022-07-30 13:03:05 +00:00
riastradh c24f208cc5 zfs: Give condvars more meaningful names.
These will be truncated to 16 characters, but hey, better'n `zfscv'.
2022-07-30 12:59:31 +00:00
chs 28cd7476b4 fix ARC checks for available memory:
there's an extra check that we inherited from FreeBSD that tries to
detect KVA exhaustion on platforms with limited KVA, but the condition
that decided whether to use the extra check was using a FreeBSDism
that doesn't exist on NetBSD, resulting in this check being used on
all platforms.  on amd64 systems with lots of memory, this extra check
would result in the ARC thinking that it constantly needed to reclaim memory,
resulting in all the xcall threads running all the time but not doing
anything useful.  change this condition so that this extra check for
KVA exhaustion is only used on 32-bit platforms.  fixes PR 55707.
2022-05-04 15:49:55 +00:00
jkoshy fde05ead87 Minor: fix a typo. 2022-05-03 12:09:19 +00:00
jkoshy 9df6d2eefa Follow FreeBSD revision <0e15d9fbeba4> and simplify #ifdef'ed code.
This change avoids redefining 'SHN_SUNW_IGNORE' if the symbol is already
present.
2022-05-02 20:09:48 +00:00
hannken 89ddb8af18 Unlock vnode for VOP_IOCTL(). 2022-04-16 07:56:45 +00:00
christos 41fac1e5ad Add link our policy. 2022-03-30 16:34:27 +00:00
riastradh e7bed28911 driver(9): devsw_detach never fails. Make it return void.
Prune a whole lotta dead branches as a result of this.  (Some logic
calling this is also wrong for other reasons; devsw_detach is final
-- you should never have any reason to decide to roll it back.  To be
cleaned up in subsequent commits...)

XXX kernel ABI change to devsw_detach signature requires bump
2022-03-28 12:33:20 +00:00
christos 884c22fa28 add a kauth vnode check for adding links 2022-03-27 16:26:26 +00:00
riastradh 4e7bd1dfb2 osnet: Delete dead #if 0 code using hardclock_ticks. 2022-03-18 23:32:14 +00:00
riastradh e468962b6a lockstat(4): KNF. No functional change intended. 2022-02-27 14:16:32 +00:00
riastradh d3ab1269bf lockstat(4): Membar audit.
- Serialize updates to lockstat_enabled, lockstat_dev_enabled, and
  lockstat_dtrace_enabled with a new __cpu_simple_lock.

- Use xc_barrier to obviate any need for additional membars in
  lockstat_event.

- Use atomic_load/store_* for access that might not be serialized by
  lockstat_lock or lockstat_enabled_lock.
2022-02-27 14:16:12 +00:00
riastradh 11ba2468a1 zfs: Expose hostid to zfs, as in gethostid/sethostid(3).
If set to nonzero, the hostid is recorded in the metadata of a zpool,
and checked by `zpool import' when the pool has not been explicitly
exported.  After reboot, zpool import will not need `-f' to reimport
the pool.

Setting the hostid must be done explicitly through sysctl (or the
sethostid(3) library call) on all ports except acorn32, amiga,
mvme68k, newsmips, sparc, sparc64, sun2, and sun3.  So for most users
this change will have no immediate effect.  But you can obviate the
need for `zpool import -f' by adding `kern.hostid=123456789' to
/etc/sysctl.conf and importing the pool one last time with `-f'.
2021-12-28 17:51:23 +00:00
simonb 8ac21e5a89 In zfs_setattr() don't recheck the auth policy for a "nodump" flags
change. zfs_netbsd_setattr() has already checked if this request is
authorised, and our secpolicy_xvattr() doesn't check kauth chflags.

XXX: Fix this propery when we migrate to openzfs.

riastradh@: Seems reasonable.
2021-12-22 14:04:10 +00:00
hauke 5ab0766754 Default files to BSD group ownership in line with ffs, after the lead
of FreeBSD <https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=139076>
(patch by hannken@)
2021-12-21 15:08:14 +00:00
simonb 674cec8ef5 In vattr_init_mask() check for va_flags and if set add to the mask of
to the things that setattr is interested in.
Fixes chflags(2) on ZFS.

Thanks riastradh@ for fix.
2021-12-17 08:07:12 +00:00
simonb 45fbb8e465 In zfs_statvfs(), set f_bresvd and f_fresvd to 0. Fixes random kernel
accounting suspend/resumes with erroneous values leaking out.

Note: no userland leakage as statvfs(2) handler memset 0's the buffer.

XXX: Should be fixed with a memset in VFS_STATVFS().
2021-11-30 12:37:38 +00:00
simonb 2dab5a2679 Hacks to get zdb working on NetBSD:
- Force accessing raw device but we're passed the block device.
 - Deal with wedges not returning their size on a stat(2) and use
   the DIOCGMEDIASIZE ioctl instead.

Ok chs@.
2021-10-27 11:35:23 +00:00
thorpej 982ae832c3 Overhaul of the EVFILT_VNODE kevent(2) filter:
- Centralize vnode kevent handling in the VOP_*() wrappers, rather than
  forcing each individual file system to deal with it (except VOP_RENAME(),
  because VOP_RENAME() is a mess and we currently have 2 different ways
  of handling it; at least it's reasonably well-centralized in the "new"
  way).
- Add support for NOTE_OPEN, NOTE_CLOSE, NOTE_CLOSE_WRITE, and NOTE_READ,
  compatible with the same events in FreeBSD.
- Track which kevent notifications clients are interested in receiving
  to avoid doing work for events no one cares about (avoiding, e.g.
  taking locks and traversing the klist to send a NOTE_WRITE when
  someone is merely watching for a file to be deleted, for example).

In support of the above:

- Add support in vnode_if.sh for specifying PRE- and POST-op handlers,
  to be invoked before and after vop_pre() and vop_post(), respectively.
  Basic idea from FreeBSD, but implemented differently.
- Add support in vnode_if.sh for specifying CONTEXT fields in the
  vop_*_args structures.  These context fields are used to convey information
  between the file system VOP function and the VOP wrapper, but do not
  occupy an argument slot in the VOP_*() call itself.  These context fields
  are initialized and subsequently interpreted by PRE- and POST-op handlers.
- Version VOP_REMOVE(), uses the a context field for the file system to report
  back the resulting link count of the target vnode.  Return this in tmpfs,
  udf, nfs, chfs, ext2fs, lfs, and ufs.

NetBSD 9.99.92.
2021-10-20 03:08:16 +00:00
simonb 9642c2c8a1 Clamp zfs nlinks at UINT32_MAX (nlink_t max) instead of (much) smaller
16-bit LINK_MAX until we bump LINK_MAX.  Fixes fts(3) problems with
"rm -rf" on zfs directories with > 32766 subdirectories.

Thanks mlelstv@ and mrg@ for helping debug this.
2021-09-06 08:37:43 +00:00
mlelstv 5746ce6090 Don't use __FBSDID, similar to kern/kobj.c, kern/misc.c, kern/sysevent.c 2021-09-05 11:43:22 +00:00
rillig 825116fea2 osnet: fix lint warning about empty declaration
proc_bkpt.c(32): warning: empty declaration [0]

Use the same definition as in libarchive.
2021-09-05 10:18:31 +00:00
christos 07a5a803ce Include <time.h> for all GNU systems (hurd). From Damien Zammit 2021-08-29 08:43:12 +00:00
riastradh 549613bcf6 libzfs: Zero DIOCLWEDGES input before ioctl.
Otherwise we ask the kernel to write over whatever random pointer was
in the stack garbage here, when all we wanted was to learn whether
dkwl_nwedges is zero or nonzero.

XXX pullup-9
2021-08-28 10:47:45 +00:00
riastradh 45ada0c008 PR/56355: Exclude the symbol trap, not all symbols other than trap. 2021-08-18 11:26:17 +00:00
christos cb485a28ce PR/56355: Taylor Campbell: restore strcmp() over strncmp() 2021-08-15 16:33:57 +00:00
christos fd6562d6eb PR/56355: Brad Harder: dtrace triggers double-fault in supervisor mode 2021-08-11 11:16:49 +00:00
skrll 7f8c58afc7 KNF 2021-07-25 06:07:42 +00:00