Commit Graph

67029 Commits

Author SHA1 Message Date
Augustin Cavalier
37d1274f24 Tracker: Some cleanups to menu management.
* Get rid of GetNumberOfVolumes(), keep track of volume items
   count instead.

 * Get rid of ClearMenu(), use BMenu::RemoveItems() instead.
2024-10-18 15:48:57 -04:00
Augustin Cavalier
abaac74f80 Tracker: Remove duplicated logic to check for temporary queries.
It wasn't used anyway.
2024-10-18 14:53:21 -04:00
Augustin Cavalier
4f83537025 Tracker: Remove "Clear history" and instead add a way to open the Queries directory.
According to humdinger, if automatic deletion of old queries
is working (which it should be), then "Clear history" isn't needed.

Instead, turn the "Recent queries" menu into an item that can open
the queries folder, where users can then delete or otherwise modify
the recent queries directly.
2024-10-18 14:45:39 -04:00
Augustin Cavalier
1ffd5a3665 Tracker: Delete temporary/transient queries only in ~/queries.
Otherwise we would delete them even if they'd been copied somewhere
else on the filesystem, which sounds like a terrible idea and
not at all what I (and I expect other users) would expect.
2024-10-18 13:35:45 -04:00
Augustin Cavalier
430609181e Tracker: Use queries to find transient queries to delete.
Walking the entire filesystem is slow and wastes cache memory.
Instead, just use a TQueryWalker to find and iterate over queries.
2024-10-18 13:30:20 -04:00
Augustin Cavalier
6dbe7db0da Tracker: Remove overcomplicated last-query-change logic.
We don't need to write a message with a single entry, that's
just silly. And writing a message into this attribute breaks
the kAttrQueryLastChange BFS index, anyway.

(This reverts part of 9e875c1998b4123d18a647ff8809d36d8cc7f171.)
2024-10-18 13:27:06 -04:00
Augustin Cavalier
91f94b828f network/stack: Add assertion that interface is not UP when deleting. 2024-10-17 16:55:46 -04:00
Augustin Cavalier
c8958f4e0c network/arp: Add assertion that the cache is empty upon uninit.
May help with diagnosing #19185.
2024-10-17 16:49:20 -04:00
Augustin Cavalier
5f4e982ea8 kernel/cache: Acquire store references in PrecacheIO.
If the file in question is deleted while we are performing asynchronous
I/O, and there is nothing else left with a reference to it, then the
underlying vnode could wind up getting deleted from under us, since
the cache does not maintain a reference to the store unless there
are active mappings (areas) associated with the cache.

Should fix #19122. At least, I couldn't find any other places
that performed asynchronous I/O without properly acquiring and
releasing references to the underlying vnode besides this one.
2024-10-17 16:27:53 -04:00
Michael Lotz
6260a00f00 kernel/debug: Add CTRL-D shortcut to exit KDL.
Change-Id: I9438f6c3f9a095ea860bca2bd3ddb769e1a6bebe
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8465
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-10-17 20:06:23 +00:00
Augustin Cavalier
8e300ef227 USB: Destroy the default pipe last, and put our ID before it.
If we don't, then new transfers could still be queued even after
we've put its USB ID, since it's usually accessed via Device.

May further help with #19180.
2024-10-17 16:04:52 -04:00
CodeforEvolution
e3dc9757d2 Terminal: Implement clearing scrollback with ANSI control sequence
This adds support for a defacto standard mode for the Erase Display (CSI J) ANSI control sequence.
The mode is specified as "ESC 3J", and will clear the scrollback buffer of the terminal.
This will allow the "clear" and "tput clear" commands to behave the same as in other terminals,
such as XTerm and Konsole.

Change-Id: I2b1a3a005e430d4b8fe5220af26526b6400dfc7f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8464
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
2024-10-17 18:59:24 +00:00
Augustin Cavalier
46e4cc614f kernel/condition_variable: Use cpu_wait in one of the spin-loops.
The other spin-loop in this file is over a pointer, and cpu_wait
takes only 32-bit values at the moment. I'm not sure about the
semantics of running cpu_wait on only half a 64-bit value, so
leave that loop alone for the moment.
2024-10-17 14:57:33 -04:00
Augustin Cavalier
aa49539d5f x86_cstates: Call arch_cpu_pause() if wait is disabled.
This wait() routine is called by cpu_wait(), which is what spinlocks
use in their critical loops. If there is no CPU idle module, then
cpu_wait() just calls arch_cpu_pause(). As "wait" is only enabled in
power-saving mode, we should do the same here to retain the same
behavior (and potentially save some power even in "high-performance" mode.)

Tested on bare metal; performance difference for a compile job
(while on battery) may be 5% lower, or that could just be noise.
2024-10-17 14:56:31 -04:00
Augustin Cavalier
724227e017 intel_cstates: Rename to x86_cstates.
It works just fine on modern AMD CPUs, too.
2024-10-17 13:55:33 -04:00
Augustin Cavalier
9c0dced16e kernel/low_resource_manager: Don't decrease the low-resource state in low_resource().
This facility is used by the kernel to notify the low_resource manager
that it failed to allocate something. But if we are in (e.g.) CRITICAL
low-resource state and this method is used to notify that a large
allocation failed, we would previously revert to NOTE state, while
we should stay at CRITICAL.
2024-10-17 13:42:04 -04:00
Augustin Cavalier
b3731f13ab Support Kit: Add ZSTD_error_memory_allocation to _TranslateZstdError. 2024-10-17 13:37:58 -04:00
Augustin Cavalier
fbc0153a97 bootloader: Display the system package version with the latest state.
We can't easily fetch its timestamp, but we can at least display
the version of the "haiku" package here.
2024-10-17 13:18:18 -04:00
John Scipione
406f30c616 Tracker: Commands.h (and tracker_private.h) updates
* Add kDeleteSelection command alias in Commands.h, keep kDelete.
* Add kMoveSelectionToTrash and use it in place of kMoveToTrash.
  - kMoveToTrash in kept in tracker_private.h for use outside.
* Create a new constant kRestoreSelectionFromTrash for Tracker.
  - Move kRestoreFromTrash to tracker_private.h

Change-Id: I3cdefe97e8359fb53bacfc3319b046b051c6f7db
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8225
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
2024-10-17 16:21:51 +00:00
John Scipione
8f97570f6a Tracker: Style changes related to Shortcuts update
Change-Id: I30d10821a2767c77718f8545b585ef577b546405
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8224
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-10-17 16:21:51 +00:00
Augustin Cavalier
8fbb862695 fs_shell: Adjust following block_cache API change. 2024-10-17 12:15:11 -04:00
drea233
fc7456e9b1 fix typo in "Update keyboard.dox"
Small typo

Signed-off-by: Augustin Cavalier <waddlesplash@gmail.com>
2024-10-17 12:10:30 -04:00
Augustin Cavalier
a2cf217f8f kernel/vm: Add #include <team.h> to vm_debug.cpp.
Should fix the build on RISC-V.
2024-10-17 12:09:46 -04:00
Augustin Cavalier
16ecdb595b kernel: Drop base, length parameters from block_cache...etc methods.
They were ignored and unused; and in fact can't be made to work
properly since the block_cache always operates on exactly block-sized
buffers, and doesn't have contiguous buffers of multiple blocks
to hand out at all.

No functional change intended.
2024-10-17 12:05:22 -04:00
Augustin Cavalier
72d9beca78 bootloader/bios_ia32: Restore split between kernel and identity map allocation.
This mostly reverts commit 19141f2110,
thus restoring most of the changes from 8b813adf6d.

However, we keep these ranges inside the kernel args ranges for now,
as they're used in the 32-bit non-PAE case at least.

Change-Id: I966d3269414dd02713cdda9852f5a4a212d85be5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8463
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-10-17 15:33:31 +00:00
Augustin Cavalier
f21cc2bfb0 USB: Cancel queued transfers before waiting for idle.
Otherwise, stuck transfers will cause us to hit the not-idle assertion.
Should fix #19180.
2024-10-16 16:07:32 -04:00
Augustin Cavalier
086f997e50 kernel/vm: Move most kernel debugger routines to a new vm_debug.cpp.
Reduces the size of vm.cpp by over 800 lines.
No behavioral change intended.
2024-10-16 14:43:20 -04:00
Augustin Cavalier
0a5c9ef0a4 kernel: Move get_mount_point from VMUtils to KPartition.
There's nothing VM-specific about it; it just builds paths
that partitions should be mounted at.

Also move the tests.
2024-10-16 14:25:17 -04:00
Augustin Cavalier
b0b1b524f8 tests: Fix build & link of the DiskDeviceManagerTest. 2024-10-16 14:10:36 -04:00
Augustin Cavalier
1ad8d90108 kernel/vm: Drop an obsolete commented-out line from VMAddressSpace.
The lock names are set properly by VMAddressSpace subclasses.
2024-10-16 12:58:28 -04:00
Augustin Cavalier
a50dfb9087 kernel/vm: Allocate early physical pages from above 4GB first.
This way, on systems with lots of RAM (> 100 GB) where the page array
will wind up taking > 1 GB, we don't consume all the available memory
below 4GB before even getting out of the early boot process.

When we run out of memory above 4GB, the "expand upwards" loop will
try expanding the previous ranges, and then the "expand downwards" loop
will expand the range starting at 4GB downwards if there's memory below.
So if the memory before 4GB is needed, we'll still allocate it.

Fixes #19117.

Change-Id: Ic20934ccf8ea7f6b1d4bff1af4a09cf1688147d2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8448
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2024-10-16 16:17:13 +00:00
Augustin Cavalier
5f87420792 kernel: Add maxAddress constraint to vm_allocate_early_physical_page.
Needed by the x86 PAE code.

Change-Id: I982dfa96427addfc903205f49f53a46462534843
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8457
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-10-16 16:17:13 +00:00
sarahemm
6ff28d8731 PowerStatus: Fix time left and spurious low-battery alerts with >1 battery
1. Only do low battery processing if the battery being queried is the
   "virtual aggregate battery" (ID -1), this fixes the issue of spurious
   and duplicated low battery warnings whenever the extended info panel is
   open (and therefore multiple batteries are being individually queried).

2. Calculate the time remaining separately after adding up all the
   individual battery values, this works around batteries which are not
   currently in use returning -1 time_left which caused the aggregate to be
   incorrect if the values from the driver interface are simply added as-is.

An example situation to illustrate item 2:
Battery 0 capacity: 20,000mWh
Battery 0 draw: 0mW
Battery 0 state: Unused
Battery 0 time_left: -1 (since it currently has zero draw on it, it has
	"infinite time left" if looked at in isolation)

Battery 1 capacity: 20,000mWh
Battery 1 draw: 10,000mW
Battery 1 state: Discharging
Battery 1 time_left: 2 hours

If the time_lefts are added together (even if battery 0 is ignored for that
calculation), it'll show 2 hours left despite there being 40,000mWh of total
capacity for a 10,000mW draw. We now treat all batteries together as one large
one instead, calculating the draw/capacity on the totals which gives an
accurate number.

This fixes issues 2 and 3 in bug #19167.

Change-Id: I1b9a0c3dd47f917da86becfcfebed7b35b3422d4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8462
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
2024-10-16 16:16:10 +00:00
CodeforEvolution
c3c6ee24b0 package_repo: Remove B_ENABLE_INCOMPLETE_POSIX_AT_SUPPORT definition
All other uses of this definition was removed many years ago...
In addition, I'm certain this aspect of POSIX support is complete now.

Change-Id: I309779d8e895efeb6b2b7c107bf2ef038d0a6612
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8458
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
2024-10-15 19:39:32 +00:00
Augustin Cavalier
7a8e5c8c53 kernel/vm: Fix allocating virtual ranges downwards from the bottom.
Another regression from hrev58236: the code assigned start then size
previously, but there was another temporary that made things work
properly that was removed in that commit.

Fixes #18140.
2024-10-15 12:12:21 -04:00
sarahemm
64854db4af PowerStatus: Display unused batteries with a pause symbol.
1. fOnline made sense when APM was the dominant power interface
("online" is "charging" in APM-speak) but it's confusing now that
ACPI is the primary system and specifies more granular status.
Eliminate fOnline and check specifically for charging or discharging as
needed instead.

2. In multi-battery setups batteries that were neither charging nor
discharging were shown with the lightning-bolt charging icon due to the
lack of granularity in fOnline, now shows a paused icon instead.

This solves the first point in #19167.

Change-Id: If723b6b9a4695427d09075680a8ef435b3c1ac54
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8456
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-10-15 03:54:35 +00:00
Augustin Cavalier
fb993aa063 kernel/vm: Fix typo in allocate_kernel_args.
Regression from hrev58236.
2024-10-14 17:25:26 -04:00
Augustin Cavalier
19141f2110 Revert "bootloader/bios_ia32: Allocate physical memory from the kernel separate from the bootloader."
This reverts commit 8b813adf6d.

This does not properly handle the case of 32-bit page tables that
the kernel will continue using (i.e. non-64-bit, non-PAE). So,
some other solution will need to be found to not leak these
and the bootloader heap.
2024-10-14 17:21:37 -04:00
Augustin Cavalier
255bf69fbc kernel/vm: Clean up virtual addr_range processing and rounding.
Only functional change should be the addition of alignment checks in
allocate_early_virtual.
2024-10-14 15:06:12 -04:00
Augustin Cavalier
16e96d6e04 bootloader/bios_ia32: Add an assertion and clean up rounding in MMU code.
No functional change intended.
2024-10-14 15:04:06 -04:00
Greg Crain
8251b2c8f6 usb_audio: add missing descriptors for USB Audio 2.0 and update listusb.
Change-Id: Ic294ca78aaf9bd5ac8476595af5e4e223b07e25e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8372
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-10-14 18:16:10 +00:00
Augustin Cavalier
8bacd281ba sys/param.h: Cleanup.
* Minor tweaks to POSIX sys/param.h for style.

 * Don't redefine alignment macros in BSD sys/param.h even conditionally.
   And add a few more macros from the real BSD sys/param.h, for convenience.
   (Most of these are also declared in musl and glibc's sys/param.h)
2024-10-14 13:53:54 -04:00
Augustin Cavalier
e5f515c322 sys/select.h: Remove howmany() macros.
These aren't defined or used in this header under glibc or musl,
and after the previous commit, aren't needed in the kernel either.
2024-10-14 13:53:52 -04:00
Augustin Cavalier
916e681ca5 kernel.h: Add a HOWMANY macro and make use of it. 2024-10-14 13:53:50 -04:00
Augustin Cavalier
8f383fa10e ftw.h: Remove unneeded #include <features.h>. 2024-10-14 13:53:48 -04:00
Augustin Cavalier
8a19a29283 FAT: Remove some unused macros and #ifndef around the remaining ones.
Also adjust header paths order so the FAT compatibility headers
always come before system ones.
2024-10-14 13:53:46 -04:00
Augustin Cavalier
a2afad0d66 libroot: Use timespec_to_bigtime in clock_nanosleep.
No functional change intended.
2024-10-14 13:53:44 -04:00
Augustin Cavalier
2a39b810fa configure: Allow specifying Python interpreter in HOST_PYTHON.
This reverts commit b6554e72fc
which added the --with-python flag. Using environment variables
to specify host and cross tools is how the rest of this script
behaves, so let's be consistent.
2024-10-14 13:53:42 -04:00
Murai Takashi
86c015295d Tracker: Fix argument order
Fix different order of arguments between definition and declaration
of TTracker::SelectChildInParentSoon() and
TTracker::SelectChildInParent().
Pointed out by cppcheck.

Change-Id: Ie78089c80d77f8f687fb9e63883f0ce7b2e2785c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8379
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-10-14 16:27:02 +00:00
Murai Takashi
8f0ecca94b BAlert: Fix argument order
Fix different order of arguments between definition and declaration
of BAlert::_Init().
Pointed out by cppcheck.

Change-Id: I59af49f8d8789bc96df8ad6da6bc499d322771d0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8378
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2024-10-14 11:06:12 +00:00