Commit Graph
100 Commits
Author SHA1 Message Date
waddlesplash 4660bcfbab Revert "ImageRules: do not include catalogs from .so in dependencies"
This reverts commit 368cac3c9d.

Actually excluded catalogs for .so in all cases, not just
dependencies.

Change-Id: I6f8997073c71a6a9fa3fa875e971242bc8487666
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10562
Reviewed-by: waddlesplash <[email protected]>
2026-03-22 02:14:02 +00:00
Augustin Cavalier cafe26877f kernel: Actually fix call_all_cpus to invoke the method with interrupts disabled.
sICIEnabled is never set if sNumCPUs == 1.

Actually fixes #19983.

Change-Id: I3c50d118bb44ba4a2289586d4305d663a3a7900a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10561
Reviewed-by: waddlesplash <[email protected]>
2026-03-22 01:48:40 +00:00
Augustin Cavalier d3c2dd6c14 kernel/vm: Commit changes missed in previous commit. 2026-03-21 13:47:13 -04:00
Augustin Cavalier e13a6e6ec2 kernel/lock: Assert that a write lock isn't held in switch_from_read_lock. 2026-03-21 13:37:13 -04:00
Augustin Cavalier 5811e4bf6f kernel/vm: Pass the kernel parameter down in transfer_area() properly. 2026-03-21 13:18:28 -04:00
Augustin Cavalier 5fffbbfc48 kernel/vm: Minor API changes for consistency in VMCache.
* Insert/Remove can't fail, so drop status_t return values.

 * "TransferAreas" is really "TakeAreasFrom", so rename it. This
   avoids confusion with the "transfer_area" API call, which moves
   an area to another address space (keeping the same cache.)
2026-03-21 12:30:02 -04:00
Augustin Cavalier 05f1182cca kernel/vm: Overhaul protection checks and fixup.
* Give arch_vm_supports_protection a team_id argument (primarily
   to allow the kernel address space to be more restricted than
   user ones.)

 * Move invocation of arch_vm_supports_protection to a static method,
   and also call fix_protection from there.

 * Consolidate protection checks.
2026-03-21 09:26:44 -04:00
Augustin Cavalier a01f1a3da8 usb_asix: Delete.
Now provided by asix88xxx instead.
2026-03-18 13:54:26 -04:00
Augustin Cavalier 231ecae98b kernel/scheduler: Skip setting invoke_scheduler in scheduler_reschedule_ici.
It isn't needed now that it's set before sending the ICI. Saves
a lot (hundreds, in some basic testing of compile jobs) of
unnecessary scheduler invocations.
2026-03-17 20:25:53 -04:00
Augustin Cavalier 87e0daf0a1 kernel: Include <smp.h> in VMTranslationMap.
RISC-V at least doesn't implicitly include it.
2026-03-17 14:49:13 -04:00
Augustin Cavalier 1b6efe284a kernel/smp: Avoid calling cpu_pause() if test-and-set works on first try. 2026-03-17 14:48:53 -04:00
Augustin Cavalier 14b78e205c kernel/smp: call_all_cpus should run with interrupts disabled.
For consistency. And so should call_single_cpu.

Fixes #19983.
2026-03-17 14:23:58 -04:00
Augustin Cavalier 89c81c2ac1 kernel: Fix copy/paste error from previous commit. 2026-03-17 13:37:04 -04:00
Augustin Cavalier cf2179fa35 kernel: Add invalidation utility routines to VMTranslationMap.
These allow us to move a lot of the basic logic out of the
TranslationMaps. In the process, it extends the fix applied
to x86 in the previous commit to all the other maps.
2026-03-17 13:30:11 -04:00
Augustin Cavalier b4546a49f0 kernel/x86: Don't spuriously set the current CPU bit in Flush().
We may be called from the page daemon, which may be running on
a different CPU than the one this map is active on. So don't
bother flushing unnecessarily if we can avoid it.
2026-03-17 13:19:31 -04:00
Augustin Cavalier d4817afe36 kernel/smp: Use a single-CPU ICI if multicasting to only one CPU.
This avoids the broadcast mailbox (and the incrementing of
other CPU's counters) entirely in this case.

As this is used for TLB invalidation, processes that are only
running two threads at once will benefit immensely from this.
It also seems to be triggered by the kernel's "idle_scan_active_pages"
logic, which sometimes sends invalidations to CPUs besides its own.

On the VM setup, this path was hit around 200 times during boot,
around 600 times during a rebuild of HaikuDepot + mime_db, and
50,000+ times while running Iceweasel (Firefox). On bare metal,
it was hit around 300 times during boot, 300 times during a rebuild,
and 90,000+ times while running Iceweasel (over a different length
of time, though.)
2026-03-17 13:06:35 -04:00
Augustin Cavalier 9c08c836bf kernel/smp: Use read spinlocks when prepending broadcast messages.
Some brief testing shows that concurrency is unlikely here, but
we might as well.
2026-03-17 12:08:59 -04:00
Augustin Cavalier b6447046fc kernel/smp: De-indent smp_send_ici.
No functional change intended.
2026-03-17 11:54:27 -04:00
Augustin Cavalier 19bcb3be0a kernel/scheduler: Make invoke_scheduler atomic to skip unnecessary ICIs.
Following upon a KDL reported by atomozero, on wait-for-free-SMP-messages
on an unblock occurring with interrupts disabled.

In changing cpu_ent, move disabled to the beginning to avoid
enlarging the structure unncessarily.

On a 4-core VM, this skips around 200 sends during boot, and
over 3000 during a rebuild of HaikuDepot + mime_db (cold). On
bare metal (i3, 2x2), it skips around 150 during boot, and a bit
below 3000 during a rebuild of HaikuDepot + mime_db (over a much
longer time than in the VM, as the hardware is slower.)

Performance in the VM doesn't look much different. But this might
help in VirtualBox, or other situations where ICI latency is far
above what it should be.
2026-03-17 11:25:36 -04:00
Augustin Cavalier d5a5f22579 pegasus: Replace with the upstream FreeBSD version.
Fixes #19745.

Change-Id: Ie540beecbf9f0a998f016f015357a38d1fa95bfd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9599
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2026-03-16 21:30:32 +00:00
Augustin Cavalier 924599c310 L2CAP: Change from SOCK_STREAM to SOCK_SEQPACKET.
This is the same as what FreeBSD does.
2026-03-16 13:21:46 -04:00
Augustin Cavalier 7512053757 kernel/smp: Refactor ICI broadcast/multicast to invoke the current CPU too.
Since the methods now don't just "send", the names are changed
also (which is fitting since they're now API-incompatible.)

The changes in the TranslationMaps to adopt this fixes a correctness
issue: previously TLB invalidations would be done either with or
without interrupts enabled depending on how they were invoked.
Now, they'll always be done with interrupts disabled. (This is
the same fix that was recently done to x86.)

The idea with processing the ICIs on the current CPU too is
that presumably the other CPUs will take just as much, if not
more, time processing the ICI than the sending CPU. So, we might
as well do the processing while we wait, rather than before or after.

Testing shows this to indeed be the case. On a bare metal i3, kernel
map invalidations (with global invalidations always forced) across
a boot-to-desktop go from around ~60.8ms cumulative before,
to ~51.8ms cumulative after this change.

Change-Id: Icd0343d462de7cf11043e6438f47b02f6b88bb8b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10472
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2026-03-16 13:41:00 +00:00
Augustin Cavalier 000c32a568 asix88xxx: Import drivers from FreeBSD to replace usb_asix.
The homegrown usb_asix was partially based on the upstream FreeBSD
driver anyway, and hasn't seen much maintenance in recent years.
We might as well replace it with the FreeBSD version. In the process,
also add the "axge" driver, supporting the Gigabit version of this
hardware.

Tested by smrobtzz with the AX88179A: "it seems to work perfectly".

Change-Id: I37fdfc2cef6100916d6034817f117286f7f443b2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9600
Reviewed-by: waddlesplash <[email protected]>
2026-03-16 13:17:57 +00:00
Augustin Cavalier 9936387223 freebsd_network: Add everything needed for USB ethernet drivers.
Change-Id: I152d3fcdb50b9473f06c2164b9abb38b7c9d7e40
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9598
Reviewed-by: waddlesplash <[email protected]>
2026-03-16 13:17:57 +00:00
Augustin Cavalier d59105d001 freebsd_network: Synchronize some mbuf routines with upstream FreeBSD.
Also delete an OpenBSD compatibility section that isn't used.

This includes a fix to mbufq_full (made in 2019 in FreeBSD)
to allow for mbufqs of unlimited size, apparently needed by
some drivers, found by @smrobtzz while testing USB ethernet
drivers.
2026-03-16 08:50:43 -04:00
Augustin Cavalier 913f501fbd kernel: Use uint64 for seconds in datetime conversion routines. 2026-03-16 08:35:51 -04:00
Augustin Cavalier a2e4f9f75f kernel/x86: Use call_single_cpu_sync in get_cpuid.
Sends a more targeted ICI than a broadcast.
2026-03-10 17:55:12 -04:00
Augustin Cavalier 1d740a6700 kernel/smp: find_free_message expects interrupts enabled.
Use thread_pin instead of disable_interrupts in the call_*
methods.
2026-03-10 17:54:33 -04:00
Augustin Cavalier e867e95538 kernel/smp: Deduplicate call_*_cpu.
* Rename call_single_cpu for consistency.

 * Combine call_all_cpus implementations into one, like call_single_cpu.
2026-03-10 15:33:33 -04:00
Augustin Cavalier 334e90a2ac kernel/smp: Just return free messages using a write spinlock.
There isn't much value in using extra atomics here.
2026-03-10 15:21:27 -04:00
Augustin Cavalier 3c28d298f7 kernel: Don't fail if the private string.h is included under GCC2. 2026-03-10 13:10:25 -04:00
Augustin Cavalier 918b2dfaab BMessage: Eliminate UsePrivateHeaders kernel. 2026-03-10 13:10:25 -04:00
Augustin Cavalier b350405e06 kernel/smp: Refactor smp_msg structure allocation.
The SMP_MAX_CPUS * 4 fixed pool size apparently goes all the way
back to NewOS, which supported only 4 CPUs max. As ours is now
64, this means the fixed pool size was very large even on systems
with only a few cores. So, instead, allocate 4 messages per CPU
(though often more, due to rounding up to the page size; e.g.
on x86_64, 1 page fits 56 smp_msgs.)

Also, put them a dedicated area, to keep them a bit more segmented
from the kernel heap, in case of problems.
2026-03-10 13:04:46 -04:00
Augustin Cavalier 10d0685a9e EFI: Fix some more instances of memcpy on other architectures. 2026-03-10 12:20:00 -04:00
Augustin Cavalier 69499b0e00 kernel: Use compiler-builtin memset, memcpy, memmove, memcmp.
Since the kernel is built with -ffreestanding, and thus -fno-builtin,
the compiler ignores the function names and doesn't perform optimizations
(e.g. inlining for small values) that it otherwise could. So, here,
we add a string.h that supplements the default, and uses #define to
reinstate the builtins, and thus the optimizations.

Linux and FreeBSD at least apparently do the same. A quick compile
benchmark in a VM doesn't show much difference, maybe a slight
decrease in sys time.
2026-03-10 12:00:59 -04:00
Augustin Cavalier ff861e0ea3 kernel, lib, drivers: Prepare for use of builtin string.h operations.
This fixes various -Werror=class-memaccess that are triggered
when using the builtins.
2026-03-10 12:00:59 -04:00
Augustin Cavalier 2adbc5705a Eliminate "UsePrivateHeaders kernel" from most of userland.
Now that the DoublyLinkedList and other classes are in a "util"
directory, this isn't needed.
2026-03-10 12:00:58 -04:00
Augustin Cavalier 103ca61228 bluetooth: Eliminate the need for kernel headers in userland. 2026-03-10 12:00:57 -04:00
Augustin Cavalier 18c93b9569 PPP: Eliminate the need for kernel headers in userland.
Also fix some -Werrors.
2026-03-10 12:00:57 -04:00
Augustin Cavalier dd2eeb7dff kernel/smp: Style fixes.
No functional change intended.
2026-03-09 21:08:52 -04:00
Augustin Cavalier dd24eecac1 kernel/smp: Distinguish CPUSet::GetBit from GetBitAtomic.
I checked all invocations of GetBit; as far as I can tell,
only the two adjusted here in smp.cpp are done while the Set
may be concurrently modified, and even then I don't know
that they really need to be atomics, anyway.
2026-03-09 20:58:54 -04:00
Augustin Cavalier 97a65a027d kernel/smp: Use rw_spinlocks for ICI locks.
This allows read spinlocks to be used in check_for_message
and return_free_message.

On a 4-core VM, there don't seem to often be concurrent readers
(a counter I setup got only about 400-500 hits for booting up
and starting a web browser, at most.) But on bare metal (i3,
2 cores x 2 hyperthreads) we get it a lot more: 30,000+ times
during boot alone.

Kernel map invalidation (with a hack to invalidate all every time)
across boot-to-desktop takes a cumulative ~68.0ms before this change,
and ~61.0ms after, on the bare metal system. (On the VM it's also lower
after this change.)

Presumably on systems with more CPUs it will get hit even more
often still. So this optimization seems worth it.
2026-03-09 20:58:54 -04:00
Augustin Cavalier de74304510 kernel/x86: Always call arch_cpu_global_tlb_invalidate with interrupts disabled.
Fixes a race. Discovered by SED4906.

Change-Id: I2b267312e9f3ff32bafa2ac2784f5d4a9905e24e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10416
Reviewed-by: waddlesplash <[email protected]>
2026-03-09 17:37:05 +00:00
Augustin Cavalier 767d7cf9fa libroot & kernel: Replace strchr, strcpy with musl's versions.
They call out to other library functions, which are better optimized
than the old naive implementations.

Add -fno-builtin to the musl strings Jamfile, otherwise GCC
generates infinite recursion in strcpy, apparently.
2026-03-05 17:31:30 -05:00
Augustin Cavalier fb0556ae2b BFS: Remove the inode from the Removed list with the transaction lock held.
Fixes #19953.
2026-03-05 15:58:28 -05:00
Augustin Cavalier 26f8f18b1c BFS: Assert in RemovedInodes(), don't just have a comment.
This would've caught the cause of #19953.
2026-03-05 15:56:48 -05:00
Augustin Cavalier 11280e1b51 kernel/device_manager: Remove unnecessary includes of Locker.h. 2026-03-05 13:35:14 -05:00
Augustin Cavalier a3fe30c940 kernel/fs: Rename create_vnode to file_create_vnode.
Matches dir_create_vnode. As discussed on the review
for the previous commit.
2026-03-05 13:00:18 -05:00
Augustin Cavalier 585ac6895e kernel/user_mutex: Let single-threaded applications sleep on mutexes.
It seems some single-threaded applications do use them, which doesn't
result in a deadlock because they use timeouts (or maybe wait on
signals, too.)
2026-03-05 12:46:31 -05:00
Augustin Cavalier 7ef695df5c kernel: Allocate user_mutex_contexts when adding the second thread to a team.
This allows us to gracefully fail if memory allocation fails,
rather than panic()ing. If a single-threaded application tries
to wait on a non-shared user_mutex in single-threaded mode, it
will now be dropped into the debugger.
2026-03-04 21:42:03 -05:00
Augustin Cavalier e6569ec320 kernel: Add an AssertLocked() to Team.
The mutex member is private, so this is necessary for other methods
to assert the team mutex is locked.
2026-03-04 21:38:43 -05:00
Augustin Cavalier f1425c9e61 freebsd_network: Include <thread.h> first, to avoid ASSERT incompatibilities. 2026-03-04 21:35:11 -05:00
Augustin Cavalier ff0cd4274c SoftwareUpdater: Move "complete" logic to ProgressApplyingChangesDone.
This is more like how pkgman does it. Behaviorally, users should
not notice a difference.
2026-03-03 17:45:42 -05:00
Augustin Cavalier 61c7d7e4ee Package Kit: Move a number of headers into the source directory.
These classe aren't used, and probably shouldn't be used, outside
Package Kit itself.

Also drop some files from libpackage_build that are not needed.
2026-03-03 17:45:28 -05:00
Augustin Cavalier 5f0f0b02b4 Package Kit, pkgman, SoftwareUpdater: Offer to delete old state directories.
This adds a new job to the Package Kit, and an invocation
in pkgman after changes are applied. The job takes a time_t before,
and an int32 minToKeep, and (after confirmation) deletes all state
directories which were last modified before that time, but also
keeps at least the minimum specified.

pkgman defaults to calling it with (now - 30 days, minimum 10).
SoftwareUpdater does the same, but without bothering the user
and just defaults to doing the cleanup.

Change-Id: I15f5232b11daba5955e7fa07f696ad7785507931
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10404
Reviewed-by: waddlesplash <[email protected]>
2026-03-03 22:14:57 +00:00
Augustin Cavalier 79ab5081b2 Package Kit: Rename InstallationLocationInfo::OldState to ActiveState.
It doesn't refer to some random old state, but the currently active
one. (If the currently active state is the default one, then it will
return nothing.) So, this should make things clearer.

Change-Id: Ib3fe842f5fb51eaf2ef2f31bad8b292b47a3fb36
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10403
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2026-03-03 22:14:57 +00:00
Augustin Cavalier 418769d64b BResources: Mark deprecated methods _DEPRECATED. 2026-03-02 21:11:39 -05:00
Augustin Cavalier dc4a606f5e Clock: Use BResources::LoadResource instead of FindResource.
The latter is deprecated.
2026-03-02 21:11:23 -05:00
Augustin Cavalier f071ee419d BMimeType: Use the new _DEPRECATED to mark SetType deprecated.
This is the first use of this new macro.
2026-03-02 21:03:25 -05:00
Augustin Cavalier a3be73a455 BTokenSpace: Add cast to appease GCC2. 2026-03-02 20:35:01 -05:00
Augustin Cavalier 9e3e304057 BLocale: Name the BLocker. 2026-03-02 20:22:14 -05:00
Augustin Cavalier b6441edfac BLooperList: Use rw_lock.
Improves efficiency, as some functions can use a read lock
instead of a write lock.

Eliminates another statically-created BLocker.
2026-03-02 20:17:51 -05:00
Augustin Cavalier 5eef2f1d00 BTokenSpace: Use pthread_mutex instead of BLocker.
This header gets included in the build platform, so we can't use
the private recursive_lock.

Eliminates another statically created BLocker, due to gDefaultTokens.
2026-03-02 20:16:32 -05:00
Augustin Cavalier f9850b561c kernel/user_mutex: Panic instead of failing due to OOM.
This is not an expected failure condition for most applications,
so try to avoid propagating it to userspace.

(If necessary, it should be possible to avoid even the possibility
of this by just allocating necessary datastructures upfront
instead of "lazily". But that seems unnecessary at the moment.)
2026-03-02 19:38:26 -05:00
Augustin Cavalier ae70142168 BBlockCache: Use a pthread_mutex instead of BLocker.
The lighter "struct mutex" is in a private header, so we can't
inline it in a public one, so just use pthread_mutex here.

By adjusting padding, the class size stays the same (72 bytes
on 32-bit, 96 bytes on 64-bit; confirmed via static_assert.)

A quick benchmark running "new/delete BMessage" in a loop on 4
threads at once goes from 30-36 seconds before this commit
to around 13-17 seconds, sometimes as low as 3 seconds, afterwards,
so clearly this is a significant improvement.

This also eliminates another BLocker allocated on application startup.
2026-03-02 19:37:13 -05:00
Augustin Cavalier 184b57aa71 BBlockCache: Rewrite header for style. 2026-03-02 18:01:56 -05:00
Augustin Cavalier 8cc48bf580 QueryParser: Don't divide by zero on empty attributes.
Fixes a KDL.
2026-02-28 22:16:43 -05:00
Augustin Cavalier f3fd885731 Game & Media Kits: Avoid some usages of static BLockers.
Saves some semaphores.
2026-02-28 22:16:15 -05:00
Augustin Cavalier 4d055d982a BGameSoundDevice: Cleanup.
* Use new-style header comments.

 * Put globals inside class or make static, instead of exporting
   unnecessarily.
2026-02-28 21:52:05 -05:00
Augustin Cavalier 6a4a02907a EHCI: Disable the physical buffers logic, at least for now.
It seems it may have caused serious regressions on some hardware,
see #19949 and #19945.
2026-02-28 20:34:12 -05:00
Augustin Cavalier 4d9bb0a399 LaunchBox: Style cleanup after previous change. 2026-02-28 20:31:30 -05:00
Augustin Cavalier aa939503b6 AppServerLink: Use the correct static initializer for recursive_lock.
Interestingly, the modern GCC accepted the "wrong" one, only GCC 2 didn't.
2026-02-27 10:26:25 -05:00
Augustin Cavalier 66d85d702b Terminal & Expander: Replace exit() with _exit() in fork+exec failure path.
This is necessary to avoid destructors being called in the child,
potentially messing up parent state.
2026-02-27 10:17:40 -05:00
Augustin Cavalier 1380d03a42 time_stats: Replace fork+exec with posix_spawn. 2026-02-27 10:16:51 -05:00
Augustin Cavalier 8cf5bd97a2 launch_daemon: Replace fork+exec with posix_spawn. 2026-02-27 10:16:35 -05:00
Augustin Cavalier 23ef8b89c6 net_server: Replace fork+exec with posix_spawn.
Uses POSIX_SPAWN_SETSID, so needs the previous commit to work.
2026-02-27 10:16:21 -05:00
Augustin Cavalier 27e95c346a posix_spawn: Fix implementation of POSIX_SPAWN_SETSID.
setsid() returns -1 in case of error, and a pid_t in case of success.
2026-02-27 10:13:46 -05:00
Augustin Cavalier 9b5a7d7612 AppServerLink: Switch to a recursive lock.
It seems in some applications (though not most of the ones I
initially tested) this can get used recursively, so we need
a recursive_lock in order to not deadlock.

Also commit a missed change from the previous commit.
2026-02-27 09:22:21 -05:00
Augustin Cavalier fb543b61ba AppServerLink: Use a mutex.
X512 pointed out that ServerLink is inherited by PortLink which is
used by all windows, so the original change had the unintended effect
of allocating another semaphore for every window, which isn't wanted.
So, just use a static mutex here also.
2026-02-27 09:15:48 -05:00
Augustin Cavalier 91eb43cfc0 libbe.so: Prevent (re)using BApplication after fork.
The case where no BApplication has been created at the time of fork
is not blocked by this change (as it might be useful in fork-to-background
before creating a BApplication.)

Reinitializing or recreating a BApplication where one already exists,
though, is not supported by the kits, and just leads to problems.
And when the global destructors are invoked after a fork, such as by
exit(), then the parent team's state may be corrupted due to the
deletion of BLocker semaphores or other global state.

So, we thus set be_app to an invalid pointer, and if terminate_after()
is called with this pointer, we invoke debugger().

(We should really just prevent semaphores from being used across
processes unless explicitly specified, but that would be an
API compatibility break from BeOS, so we'll need to do it carefully,
or not until after R1.)

Would have clearly caught the problem in #18576 and the linked thread.
2026-02-26 17:26:08 -05:00
Augustin Cavalier 9cada02ee0 libbe.so: Avoid static BLockers.
They don't work properly after a fork, and if exit() is called
from the forked child, the parent won't be able to use them
anymore.

In BBitmap and BPicture, replace them with mutexes. For AppServerLink,
make the private ServerLink inherit from BLocker, and then use
that one directly.

This also is a slight efficiency gain, as we don't need to create
multiple semaphores from the static initializers now, which is
just a waste of time in the case of applications that don't
even need these locks but link to libbe.so (e.g. CLI tools.)

Part of #18576.
2026-02-26 17:15:53 -05:00
Augustin Cavalier b43289d544 ramfs: Rework NodeMTimeUpdater into NodeStatChangeNotifier.
This now does what notify_if_stat_changed used to, fixing a
race: if some thread was modifying a file, and some other thread
(or the same thread, in some other mtime-updating operation)
updated that file and this called MarkUnmodified() before the
first thread close()d it, then when the first thread called close(),
no node monitor notification would've been sent, as fModified
would've already been unset.

So, now every time we are to mark a file "unmodified", we also
send the node monitor notification at the same time.

Fixes the remainder of #19910.
2026-02-26 16:11:50 -05:00
Augustin Cavalier 0c5895120d ramfs: Send separate node monitor events for each Entry of a Node.
This way, the node monitor system can send events to applications
with B_WATCH_ALL set on parent directories, like Tracker.

Part of #19910.
2026-02-26 16:11:50 -05:00
Augustin Cavalier c271a5e7f9 ramfs: Consolidate attribute notifications logic. 2026-02-26 16:11:49 -05:00
Augustin Cavalier de2ec4a8c3 ramfs: Rehabilitate AllocationInfo support.
At least we won't double-count files now.
2026-02-26 16:11:49 -05:00
waddlesplash 8f3276e838 Revert "netresolv: Add support for AI_V4MAPPED in ai_flags in getaddrinfo"
This reverts commit 902921a554.

This broke resolution of CNAMEs, including the Haiku package repos.
Since pkgman uses our own HTTP implementation, which doesn't set
AI_V4MAPPED at all, this shouldn't have been a behavioral change for
it at all, much less having broken it.

Change-Id: If38b6a81c1144101ddea7d1f8d401326675479e3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10388
Reviewed-by: waddlesplash <[email protected]>
2026-02-26 20:54:16 +00:00
Augustin Cavalier 3214eedc80 kernel/x86: Avoid unnecessary TLB invalidations.
If a context switch happened between the messsage being
sent and received, we don't need to invalidate.

Brief testing on a 4-core VM shows this happens relatively
rarely during compile jobs (expected, most processes are
single-threaded), but very often while running multiprocess
web browsers. Some INVALIDATE_PAGES are skipped, but mostly
INVALIDATE_PAGE_LIST is (by the thousands.)

Change-Id: If32ed95139e0db3770054f6ef3f72c9aecb9394d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10350
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2026-02-26 17:17:06 +00:00
Augustin Cavalier 3e1ccaf329 kernel: Refactor arch_cpu_invalidate* methods to take a context parameter.
This will be useful on architectures that support ASIDs, and on
ones that don't, it can be used to avoid a race between invalidation
messages being sent and context switches occurring on other CPUs.

In this commit, no behavioral change intended on any architecture.

Change-Id: I6d2ee4b69150f9ff8503329761266ddbdb550eab
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10349
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2026-02-26 17:17:06 +00:00
Augustin Cavalier 763cfd171b pthread_barrier: Utilize B_USER_MUTEX_DISABLED for efficiency.
This way we don't need to call barrier_unlock() in every thread
after exiting the wait loop, some syscalls. We can also avoid
spinning on the barrier mutex in "ensure_idle" (which is renamed
"ensure_none_exiting" for clarity), and instead lock it once and wait
for some thread to unblock all.

Overall, this strategy appears to be as much as 25% faster
than the previous, testing with pthread_barrier_test.

It seems the old design had at least one possible but very narrow
race in the "last one out" logic: if that thread was suspended
between the atomic_add() and the assignment of barrier->lock, and
all three other threads then ran past the add() in the next run,
then when the last-one-out woke up, it would clear the WAITING
flag spuriously.

This may help with #19876.
2026-02-25 14:47:29 -05:00
Augustin Cavalier a2443366d9 BFS: Propagate errors from CachedNode::InternalSetTo properly.
Otherwise, SetTo() might return B_OK when fNode is really NULL,
leading to crashes later when something tries to use the block.

Fixes #14762.
2026-02-24 21:05:21 -05:00
Augustin Cavalier 6084727f52 openbsd_wlan: Synchronize net80211, idualwifi7260, iaxwifi200 with upstream. 2026-02-24 20:21:36 -05:00
Augustin Cavalier 07dd1db8ff openbsd_network: Additions needed by newer WiFi drivers and stack. 2026-02-24 20:15:16 -05:00
Augustin Cavalier 2dc2df952c build: Disable virtio_block for now.
It just causes system instability, crashes, and disk corruptions;
see #18717.
2026-02-13 12:07:01 -05:00
Augustin Cavalier f19676f1c0 kernel/vm: Add a fast way out in VMAnonymousCache::StoreHasPage.
If we have no allocated swap space, then we don't need to even
bother doing a lookup in the hash table (which requires a read-lock,
anyway.)

This function is now called often even if swap isn't actively
being used, so any gains here are helpful.
2026-02-04 17:54:10 -05:00
Augustin Cavalier 64a26f88bf Jamfile: Drop expat, make gzip architecture-dependent. 2026-02-04 17:42:41 -05:00
Augustin Cavalier 310f75e043 docs: Move fs_query documentation to the Haiku Book.
Also add a missing include in QueryPoseView.
2026-02-04 17:41:53 -05:00
Augustin Cavalier 379c8aebab fs_shell: Add the new B_QUERY_WATCH_ALL. 2026-02-04 17:21:25 -05:00
Augustin Cavalier fe444bc3cb libroot/glibc: Reinstate long-double printf_fphex code.
Fixes #19925.
2026-02-04 17:09:50 -05:00
Augustin Cavalier 53ee2648fb fs_query: Make B_QUERY_WATCH_ALL part of the public API.
It seems to work well enough at this point, and is used in Tracker,
so why not?

Also update live_query to demonstrate the functionality.
2026-02-04 17:09:50 -05:00
Augustin Cavalier c32328567c NTFS: Move some initialization to the struct volume constructor.
May fix #19926.
2026-02-04 16:41:37 -05:00