Commit Graph
66193 Commits
Author SHA1 Message Date
Oscar Lesta 3761b2f420 etc/profile: locale settings might have changed since SetupEnvironment.
Before this, changing the locale settings via Locale preflet required
a reboot in order for the changes to get picked up by programs running
on Terminal.

Fixes: #18734

Change-Id: I149931c511020f9eb881e71f79d1fd6c647477e2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7792
Reviewed-by: nephele nephele <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2024-07-18 09:23:27 +00:00
Andrew Lindesay c3cad23617 HaikuDepot: UI Scaling
Fix aspects of HaikuDepot's UI that do not scale when
the font size changes to accommodate a high resolution
monitor.

Change-Id: I105ebfe5a8f501cd7ffc22822438147ba07382a3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7844
Reviewed-by: waddlesplash <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
2024-07-17 22:32:57 +00:00
Jérôme Duval 987a1436b3 udis86: remove
switch credits in AboutSystem from udis86 to zydis

Change-Id: I03a7965a272c50714df9726e53c7d4067d8f1925
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7850
Reviewed-by: waddlesplash <[email protected]>
2024-07-17 19:11:50 +00:00
Jérôme Duval 34b59fca80 Debugger: switch to zydis for x86 and x86_64
Change-Id: Iec6d21bc989c3d532c175fd78a2339fede3df1dd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7849
Reviewed-by: waddlesplash <[email protected]>
2024-07-17 19:11:50 +00:00
Jérôme Duval 06b1eff6ec zydis: build static lib
* for GCC2 build with a modern GCC as suggested by waddlesplash
* make the headers compatible with GCC2

Change-Id: Ice74eeddbe10bc8f9cf9ae90baa833a46bb3c676
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7848
Reviewed-by: waddlesplash <[email protected]>
2024-07-17 19:11:50 +00:00
Jérôme Duval cb130a72e8 disasm: switch to zydis on x86/x86_64
Change-Id: I72a006cb217e14228fce0f5e0b8aa8470c1bfba9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7839
Tested-by: Commit checker robot <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-07-17 19:11:50 +00:00
Jérôme Duval 1003e004e6 Import Zydis 4.1.0
* udis86 isn't updated since 2014. New SIMD opcodes are missing.
Thus replaces udis86 with Zydis, which is actively developed and used in
Webkit, SpiderMonkey. It is under MIT license.
* encoder code is removed

Change-Id: Ieae7e829e186ce7d4a6df640c62561ad220858fe
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7847
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-07-17 19:11:50 +00:00
Augustin Cavalier 911f99e2d6 kernel/timer: Rename "last" to "previous".
It points to the previous list item, not the last (final) one.
No functional change intended, but improves code readability.
2024-07-17 13:41:04 -04:00
Augustin Cavalier 2b916f6121 kernel/image: Report image removals on team destruction or exec.
We can't call user_debug_image_deleted with the lock held, so clear
the list and remove all images before unlocking and looping again.
This also means we free() without the lock held, which should
reduce contention.
2024-07-17 13:40:16 -04:00
Augustin Cavalier 10a7c77a3a kernel/team: Notify the debugger when we create the commpage image.
It isn't relocated, so otherwise we wouldn't ever notify.
2024-07-17 13:39:06 -04:00
Augustin Cavalier 58d9ba9035 profile: Emit paths only in the callgrind output.
The callgrind information should contain a path to an ELF file,
not an identifier. We thus only add the identifer when we don't
have something that looks like a path (or is the commpage.)

This allows applications that analyze callgrind output to merge
images with the same ELF file.
2024-07-17 13:31:54 -04:00
Augustin Cavalier ed79e85ae0 profile: Don't try to be clever in SharedImage::ContainsAddress().
The data section could theoretically be before the text section,
but it also may not exist and have a size of 0. The commpage
image is one such image with those qualities, and so we
would thus always find it as having a hit when encountering it
in the list.

And since data_size might be 0, just do < instead of <= and -1.

This massively fixes the profiler's output.
2024-07-17 12:47:07 -04:00
Augustin Cavalier 43f2492813 profile: Drop some unused code.
Commented out and not needed.
2024-07-17 12:44:57 -04:00
Augustin Cavalier 1b6cac3521 profile: Use BStackOrHeapArray to store the result arrays.
Otherwise with very large profile results we can overflow the stack.
2024-07-17 12:43:24 -04:00
Augustin Cavalier 421a5795ae profile: Stop new threads and resume them with the debugger API.
If we don't stop new threads, then they can run before we
have a chance to start profiling them.
2024-07-17 11:10:13 -04:00
Augustin Cavalier 189a9bbf63 strace: Resume target threads with the debugger API not resume_thread().
This way, the thread will be resumed only after the kernel
has finished processing our debugger change requests written
to the same port.
2024-07-17 11:07:32 -04:00
Augustin Cavalier d75f6109c2 kernel/arch: Prioritize post_interrupt_callback over invoke_scheduler.
The profiler depends on this, and it's likely to invoke the scheduler
of its own accord anyway.

This logic could possibly be abstracted into a generic function, seeing
as it's the same across all architectures...
2024-07-17 00:30:24 -04:00
Augustin Cavalier 8a30142841 profile: Unset image in ExclusiveProfileResult if we didn't find a symbol.
Fixes unknown hit counters.
2024-07-17 00:25:06 -04:00
Augustin Cavalier acd752e158 kernel/m68k: Apply same fix to arch_debug_get_stack_trace as in x86.
All the other arches don't even have an implementation of this function.
2024-07-16 21:44:46 -04:00
Augustin Cavalier 7eb6aafc30 profiler: Actually support profiling user stack frames only.
The "-k" argument (which never did anything before) is now inverted
compared to what it used to be, i.e. now specifying it will profile
kernel frames, too, whereas by default only user frames will be
sampled.
2024-07-16 20:37:40 -04:00
Augustin Cavalier 6d5c99effe kernel/x86: Make arch_debug_get_stack_trace handle user-only stack traces.
Begin by getting the user iframe, and remove the logic that was
preventing any return addresses from being reported if STACK_TRACE_KERNEL
was unset.
2024-07-16 20:22:09 -04:00
Augustin Cavalier e763eb55ee kernel/events: Check sync->set for B_EVENT_INVALID.
The infos[i] will only have B_EVENT_INVALID in the case where
select() returned an error and we set it ourselves; or for
wait_for_objects, it will now always be set as one of the select
flags, so we can't rely on it there.

Failing to deselect objects (or, in the case where we did receive
B_EVENT_INVALID, deselecting them again incorrectly) can cause
memory corruptions and use-after-frees.

Fixes at least one KDL inadvertently introduced after the previous
refactorings, but the double-deselect problems predate that commit.
2024-07-16 19:20:34 -04:00
Augustin Cavalier e21aac37e7 strace: wait_for_thread status argument is an Out parameter. 2024-07-16 19:06:13 -04:00
Augustin Cavalier 9e7e161599 strace: Add tracing for wait_for_objects and event_queue syscalls. 2024-07-16 19:03:02 -04:00
Augustin Cavalier 96fb940571 strace: Move poll/select syscall handling to an "event" file.
Also bring along the type handlers, and use FlagsTypeHandler.
2024-07-16 18:43:50 -04:00
Augustin Cavalier ef62eb6117 strace: Only print the first 8 iovecs.
Same limit as other array printers in this file.
2024-07-16 18:43:50 -04:00
Augustin Cavalier 0fbd5c96af strace: vsnprintf returns total possible characters, not number written.
Thus we have to clamp it. Fixes crashes with very long syscall arguments.
2024-07-16 18:43:50 -04:00
Augustin Cavalier 6c4e414fe6 strace: Move TypeHandler for iovec back to NetworkTypes.
Takes advantage of some of its macros.
2024-07-16 18:43:50 -04:00
Augustin Cavalier 72b440df7d kernel/events: Fix wait_for_objects.
In the preceding commit, I missed that "events" was cleared
inside the select loop, making a use later on useless.

Now we don't clear it in the loop, but wait till the end
to do so. (Considering we return without clearing it in
case of out-of-memory or other problems, this may not
even be necessary, but it at least preserves existing
behavior.)
2024-07-16 17:59:03 -04:00
Augustin Cavalier 9a4c543934 pthread: Implement pthread_timedjoin_np.
This also corrects an oversight in pthread_join() that not all
potential error codes of wait_for_thread were accounted for
(in particular EDEADLK wasn't.)

This is a non-standard extension, but is present on both Linux
and FreeBSD, at least.

Change-Id: Ie96e7a261e863ab491bee30349360df7ff3d0e80
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5099
Reviewed-by: waddlesplash <[email protected]>
2024-07-16 19:59:39 +00:00
Augustin Cavalier 69b420563b kernel/thread: Remove duplicate declaration of _user_rename_thread.
No functional change.
2024-07-16 15:33:19 -04:00
Augustin Cavalier 7f86e9ee17 kernel: Properly report that no events were selected in select_fd.
Adjust wait_for_objects/select/poll implementations to handle this
properly (use the original array's selected-events values, not
the select info's values, and ignore errors if events were reported.)

event_queue is not adjusted and will behave differently after this
change (specifically it will not allow such FDs to be added,
which matches behavior of epoll/kqueue elsewhere.)

Change-Id: Icea26efce894f00697afd29f3bf51b7e60e522ab
2024-07-16 15:32:59 -04:00
Augustin Cavalier 9aaf80afaa FAT: Use user_strlcpy in dosfs_read_attr.
Fixes a SMAP violation.
2024-07-16 14:39:59 -04:00
Augustin Cavalier 85fb1089de libroot: Use getentropy to initialize the stack protector.
Now that it's in libroot, we don't need to invoke the syscall directly.
2024-07-16 14:16:09 -04:00
Jérôme Duval 4169a972ee POSIX: move getentropy(2) from libbsd
Specified in POSIX.1-2024
https://www.austingroupbugs.net/view.php?id=1134
Change-Id: Ie715a102aa6f7764bc639e0a1874a6c7f7d81019
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7846
Reviewed-by: waddlesplash <[email protected]>
2024-07-16 16:09:00 +00:00
Augustin Cavalier bc28372cec pthread: Apply extern "C" to getname/setname.
Necessary because we don't include gnu/pthread.h here.
2024-07-16 00:19:56 -04:00
Augustin Cavalier fc1a0ea5ab SetupEnvironment: Remove first set of LC_CTYPE.
It's set again about 30 lines later, this time with the real value,
so there's no need to set it here.
2024-07-15 22:57:57 -04:00
Augustin Cavalier a6fd327884 pthread: Account for more errors than B_BAD_THREAD_ID in pthread_getname_np. 2024-07-15 21:31:22 -04:00
Augustin Cavalier 10563a5fb2 pthread: Reorder the extension functions and make them non-weak.
Put the extensions above the "Haiku thread API bridge",
fix their indentation, and make them standard instead of weak symbols.
(musl does not declare these functions as weak symbols, at least.)
2024-07-15 21:31:04 -04:00
Augustin Cavalier ba0223da5d Haiku Book: Fix typo in launch_daemon documentation. 2024-07-15 21:17:04 -04:00
Augustin Cavalier 6326cd5159 launch_daemon: Remove setting of LC_TYPE.
This appears to be a typo for LC_CTYPE, and as such nothing
ever used it. Environment settings are set up by SetupEnvironment
anyway, and if unset just default to C/POSIX locale, so this
isn't needed here.
2024-07-15 21:16:41 -04:00
Augustin Cavalier 1feff0c037 libroot: Initialize the stack protector guard value with generic_syscall.
Avoids open/read/close of a FD on every application startup.
May help with #18947 (especially as opening files on devfs is
somewhat more expensive than on a regular filesystem.)
2024-07-15 16:46:35 -04:00
Augustin Cavalier c003525101 USB: Release the device manager lock before exploring.
Exploring can take a while, and if we hold the device manager
lock the whole time, we'll block a lot of other things on the
system (including open() calls to anything in devfs.)

So, instead of holding the lock continuously, we now lock it
only temporarily, and instead add protection against deadlocks
when called by other threads besides the explore thread.
2024-07-15 14:09:15 -04:00
Humdinger 12bfa3571c CharacterMap: tweak colors, improve dark theme
Tweaking the colors for the character view.

* Don't use hard coded colors, but B_LIST_* colors.
  B_LIST_* has the advantage over B_DOCUMENT_* that there's a
  *_SELECTED_COLOR, too, for the the currently selected char.

* Make the disabled characters - those not part of the currently set
  font, but taken from a fallback font - a bit darker. Those lacked
  contrast before IMO.

* Dark themes need some special consideration when using disable_color.
  They need to be lightened where bright themes get darkened.

* Added special treatment for the color of selected items. Needed
  for people (e.g. me) that run a bright theme (= dark text on light
  background), but have light text on dark background for selected items.

Fixes #18948
Change-Id: I44e5be6a38e1d531238889b96ca65db0cf49b83f

Change-Id: Ic02ced0540edf29808fcead5dec64758a963e7e3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7841
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-07-15 16:36:04 +00:00
Jim906 2802139f24 FAT: fix divide-by-zero in check_bootsector()
* Zero-test sectorsPerCluster.
* This value will be checked more thoroughly later by parse_bpb().
* Fixes #11119.

Change-Id: I2318fbf3ea7f3c6c49b317ddd7d895757cf5944d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7840
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: Fredrik Holmqvist <[email protected]>
2024-07-15 12:37:43 +00:00
Niels Sascha Reedijk 4b74781a00 Catalogs: remove exr translations after purging from Pootle
Change-Id: I5ff888d69cdb460dcd16f38c0bc98440bc0d8e94
2024-07-15 06:46:48 +01:00
calisto-mathias 9e875c1998 Find Panel: Implement Menu Bar
This commit introduces enhancements to the Find Panel, focusing
on improving user experience and functionality. The primary
changes include:

1. Menu Bar Integration
 - Added a Menu Bar and migrated the more-options section into this
   Menu Bar for a more organized and intuitive interface.

2. Saving a Query
 - Save as Option: This allows users to save a query to any location
   on their storage drive. A save panel enables marking the saved
   query as a template or a query file.

 - Save Option: Treats Queries and templates as documents, enabling users
   to override changes to the file without opening the Save as Panel
   repeatedly. Context-sensitive activation of this option is also enabled.

3. Opening a Query:
 - Users can open a query via the Find Panel, which brings up a File Panel for
   Selection, streamlining query/query template management.

4. Templates Menu:
 - Provides a convenient way to select templates. Newly saved templates
   immediately updated in this menu.

5. Options Menu:
 - Clear Templates: Deletes all the templates from the filesystem and
   refreshes the template menu.

 - Clear History: Deletes either all query files or only temporary query
   files from the filesystem.

6. Improved User Flow For Saving Queries:
 - Queries are treated similarly to document files, containing properties
   specific to the search. Users can override and save details using the
   same file.

7. History Menu:
 - The History menu has also been moved into the menu bar. Here it is
   segregated into temporary and saved query files. This is helpful to
   slowly shift the chain of thought to only show the saved queries in the
   history menu.

Summing up, these changes aim to shift parts of the Find Panel into the
Menu Bar, fitting it along the newer design. It also adds in the required
features to treat queries and query template files as mutable documents
which can be easily saved or retrieved.

Change-Id: I9c13ddd77a7628a0440e59c57b6bb22dab6437c0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7817
Reviewed-by: Niels Sascha Reedijk <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2024-07-14 16:58:20 +00:00
Jessica Hamilton bed49f85a4 OS.h: add a note about B_ABSOLUTE_REAL_TIME_TIMEOUT.
* B_ABSOLUTE_REAL_TIME_TIMEOUT is used for kernel timers, and
  must be used for absolute timeout values, rather than the
  B_ABSOLUTE_TIMEOUT flag. Discovered whilst implementing
  `pthread_timedjoin_np`.

Change-Id: I37ae057073ff5efeecc00406b132abf51bebbdc2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5100
Reviewed-by: Fredrik Holmqvist <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2024-07-13 14:41:34 +00:00
Augustin Cavalier 48c3343960 EXRTranslator: Remove from the tree.
It's now at HaikuArchives and supplied in a package at HaikuPorts.
EXR images are rare and mostly used in pretty specific cases, so it
isn't re-added to the default install.

Catalogs are left in-tree until they are purged from Pootle.

Change-Id: I54e478a30e02bdefd1b8fa53c4b66d84ffb04185
2024-07-11 11:02:28 -04:00
Augustin Cavalier 4dcd60085b ICUTimeData: Use kDefault instead of kFull for the datetime format.
We already used it for the individual date and time formats, so it
only makes sense to use it for the combined datetime format.

This fixes failures to initialize datetime data for non-POSIX locales
after the ICU upgrade, as the "full" format is now longer and contains
characters such as U+202F (NARROW NO-BREAK SPACE) which result in the
UTF-8 encoding being too large to fit in the fixed-size buffer.
2024-07-11 10:48:27 -04:00