Fixes non-directory-filtered queries after the earlier refactor
to how they work (hrev58845).
Also don't bother writing an empty message if there are no
directory filters, and remove any attribute that does exist.
* Introduce notify_query_entry_moved to the fs_interface API.
axeld added a hook to the query parser (then in BFS) in hrev34317
to directly handle moves/renames, but just sent notifications for
it as B_ENTRY_REMOVED + B_ENTRY_CREATED (which is in fact the same
exact thing BeOS R5 did, I tested). We need to preserve that ABI/API,
unless flags that didn't exist on BeOS R5 are set.
* Rework notify_query_attr_changed to notify_query_attribute_changed.
This method is Haiku-specific (it was added in hrev39131), but it
wasn't very useful: it only sent the name of the file, not the name
of the attribute that changed.
It now sends the name of the attribute along with an "int32 cause",
same as notify_attribute_changed does.
* Rename the private flag B_ATTR_CHANGE_NOTIFICATION to B_QUERY_WATCH_ALL.
This better describes what it does (it's analogous to the B_WATCH_ALL
node_monitor flag). Probably we should make it public at some point...
(although probably at a lower value.)
* Overhaul QueryParser notifications logic to implement WATCH_ALL
properly, make use of the new and improved notification methods,
and to deduplify some logic.
This makes it possible to use queries with B_QUERY_WATCH_ALL
in a similar fashion to watching a directory node with B_WATCH_CHILDREN,
avoiding the need to watch every single node individually.
* Perform path filtering in GetNext*, not just BRefFilter.
See inline comment: This way, most filtered nodes won't
result in BPoses being created, saving lots of time and
memory.
* Move logic to load directory filters to the place other
settings are loaded.
* Memory management cleanups: shuffle some objects around,
avoid needing clones and refcounts for others, etc.
Significantly improves efficiency of path-filtering queries.
We don't declare them in our headers, so this just confuses
configure scripts that look for them, and creates problems later on.
Fixes binutils, which tried to use these, but the implicit
function declarations and resulting pointer-integer conversion
just caused crashes.
This should be much more efficient in the kernel.
Live update of windows when files change elsewhere still seems to work.
Queries and "Open with" still use per-node monitoring at present, but
all others now use only the single monitor for directories.
If they don't, then we don't want to keep trying to load them
every time we'd want to call the hook (e.g. in rebuilding the
addons menus, which happens every time an item selection changes
to match the mimetype list.)
We have to rebuild the addons menu every time a file selection changes,
so avoid repeated reads/deserialization unnecessarily.
Rename the "AddOnShortcut" structure to "AddOnInfo" as it contains
more than just shortcut information now.
Otherwise we rebuild this menu very often.
This change means that alterations to Tracker templates will not
get picked up by already-open windows. If that is an issue (templates
are rarely modified), then we'll have to add node monitoring
to only rebuild this list when actually necessary.
Only search once for a shortcut exactly matching the current
modifiers, i.e. whether with or without COMMAND_KEY.
Also clarify some of the comments and logic.
Instead, only do it when we get a message from the BDeskWindow
after it modifies the fAddOnsList. (The add-ons context menu
may still get rebuilt in MenusBeginning(), though, depending
on mime type; likely that should use the AddDynamicItems()
hook to avoid being rebuilt so often.)
Every time the main menu was rebuilt, we leaked the "secondary"
add-on items, which included some FDs. Now, we just skip
creating addon items altogether if we're not going to insert them.
(BuildAddOnMenus() had logic to insert items, but this seems to
have been dead code, because "primary" would always be false,
so the primaryList would never have any items in it.)
Should fix#19506 and related problems.
Includes changes/adjustments for integration with Haiku's libroot
as well as C89 fixes for GCC2 compatibility. Also imports one
patch from glibc trunk to fix ungetc+fflush behavior.
Fixes#19039, follows up #19479.
Change-Id: I73ebde80d314460174d344ba1e2960807ad4717b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9160
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
* Make EINTR (B_INTERRUPTED) always mean "interrupted system call",
not "interrupted transfer". Use B_BUSY for that instead.
* Drop B_CANCELED, return EBADF (B_FILE_ERROR) for those cases instead.
* Handle B_INTERRUPTED properly in userland ioctl calls.
Should fix#19542.
* Check for overflows in invoke_debugger_command.
* Reset it inside invoke_debugger_command always.
It wasn't reset in the case of INVOKE_COMMAND_FAULT, meaning
we would "leak" command levels, thus leading to crashes
and other problems inside the kernel debugger.
Fixes recursive KDLs or even triple faults caused by faulting
commands and pipes inside the kernel debugger.
Previously we just went through x86_fatal_exception to get to KDL,
now we will invoke the double-fault-specific method (which doesn't
print a backtrace by default), and also use the double-fault-specific
method to determine the current CPU.
Between the ctrlr_stat and ctrlr_data, it was using over 8KB of stack.
Now it's using only a few hundred bytes.
Fixes a stack overflow on 32-bit x86, which caused #19523.
This is the same value used lower down outside the double fault stacks.
Fixes KDL in double faults (previously it would cause another fault
trying to read the current thread from TLS.)
* Immediately free chunks that are from areas below a size threshold
and which cover the whole area, or are in that area's head or tail.
* Avoid unmapping just-freed chunks and any in the last area,
if we can, while releasing memory. This should force smaller
or not-needed chunks out of the caches more rapidly.
* Drop the "single page cache clear" logic, as it isn't needed now;
the "immediately free small areas" logic takes care of the same case
in a more general way than for single pages.
Running a query for all files in Tracker, letting memory usage go
up to 200+MB, and then closing the query results window seemed to
test this logic pretty well. area_for+get_area_info were invoked
without a subsequent unmap ~12,000 times, vs. around ~3,600 that
the unmap path was taken. Other cases (web browsers) have lower
counts than that, at least in any given short window, from the
(admittedly brief) testing I did.
Hopefully will help with the huge amounts of areas seen in #19514.
Unlike glibc's, these don't take the current locale into account.
The POSIX specification says: "In other than the C and POSIX locales,
other implementation-defined subject sequences may be accepted."
Not accepting any other than the default seems to be more consistent
regardless.
This also makes things consistent between wchar_t and char, as we
were using the BSD implementations of strto*l for regular chars
but glibc's for wcsto*l before.
We can't rely on it not changing between calls, especially as
MaxUpdateTextWidth() changes the value and re-gets it, and
that's called at the end of this method always. So we need to
keep our own copy rather than using the one that's owned by
the subclass.
Fixes a use-after-free uncovered by the guarded heap in VolumeSlider,
reported in #19493.
It accesses values through macros, so just write functions that
fetch the appropriate value from Haiku's structures.
Note that the values for multibyte digit characters are hardcoded.
As far as I can tell, we never set or updated these in glibc's
locale structures, so it always just used the default, so this
should not be a behavioral change from before.
We define these as __builtins in math.h, but the compiler might
use out-of-line versions, and we need to export the symbols anyway.
musl implements the __fpclassify routines, so just use them.
Otherwise it needs to use libio internals to implement these,
which we don't want. musl also exports all these methods for
the same reason.
Implementations taken from glibc 2.15, current gnulib (5077f67), and
in a few cases tweaked for better Haiku support.
Should fix#19479.
* Take it from upstream glibc 2.15, much closer to the version we use.
* Drop fpurge from stdio.h, it's nonstandard. Keep it around for
ABI compatibility for now (BeOS didn't have it.) __fpurge is left
in stdio_ext.h.
Same upstream commit as the mktemp file came from. Some modifications
to integrate better with Haiku.
FreeBSD has no tmpnam_r, so a new version implemented here
(inspired by FreeBSD's tmpnam implementation) that is fully
thread-safe.
From upstream dc36d6f9bb1.
Methods not declared for Haiku removed, and the old randomization
code is retained for now (but with getentropy() at least.)
See inline comment: otherwise we could deadlock waiting for busy pages.
At the same time, make page_faults_allowed just an int16 and drop
atomics and extra checks, they aren't needed.
Fixes#19441.
Change-Id: I1b7cc06f66b44c3520fa36497c076ee5a6320706
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9120
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
* Make PositionToolTip update even when not attached to a window.
* Always use the "hover" message to update the tooltip,
never SetPosition.
* Use BControl::Invoke so that hover messages are sent instantly.
* Position the tooltip above the slider always.
Combined with the fixes to the Interface Kit, this provides a much
nicer experience for slider time tooltips.
Change-Id: Ib7f884ca91c253ed7e6639946fd2378166137d80
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9122
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Ideally we would only hide our own tooltip and nobody else's, so
a TODO is added for that case.
This method is called for all mouse events if we get B_OUTSIDE_VIEW
or B_EXITED_VIEW as their "transit", but since tooltips themselves
get all mouse events and thus B_OUTSIDE_VIEW, this had the effect
of hiding all tooltips immediately instead of after the delay.
It was previously ignored if the tooltip was already open.
Note that, combined with the previous commit, this means that
the "where" passed in will basically always be used (except for
"sticky" tooltips.) Applications or classes that use this private
API but pass in wrong or bogus positions will now need to be fixed.
Instead of re-fetching the mouse position. This avoids tooltips "jumping"
when they may have resized by only a few pixels and don't need to be
repositioned.