Commit Graph
67615 Commits
Author SHA1 Message Date
Augustin Cavalier ed5c4d8a2d file_systems: Add O_DIRECTORY checks to many filesystems that were missing them.
This doesn't get all the filesystems that were missing these checks
(e.g. I didn't adjust the more "WIP" filesystems like XFS and BTRFS)
but it does get most of them.
2025-03-10 23:30:07 -04:00
Augustin Cavalier 992f1401b2 ProcessController: Report kernel memory and fix some TODOs.
* Restore logic for excluding app_server side of bitmaps
   (though this may not work for server-cloned areas, only
   server-allocated ones.)

 * Leave TODO in place for media buffers.

 * Add all kernel-writable areas of the system (kernel) team
   to writable memory, but exclude the block_cache.

Fixes display of kernel memory information in ProcessController's
memory usage menu.
2025-03-10 22:35:55 -04:00
Augustin Cavalier e2ffc7fd31 kernel/vm: Don't report kernel protection to userland except for root.
And don't report other UIDs' area informations at all.

Fixes a TODO.
2025-03-10 22:34:17 -04:00
Augustin Cavalier e87593ae21 atheros813x: Merge changes from upstream FreeBSD.
Up through upstream commit 05a95d19cb248203acdd4e069d3eedfe597c3b49.

May fix #19471.
2025-03-10 22:27:53 -04:00
Jérôme Duval 52c25f31c7 launch_daemon: setting condition also checks for driver_settings
only checks for a field, or field = value

Change-Id: I5dfadb6187831a51e97064cdfed55430b74f7b30
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9117
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-03-11 02:15:39 +00:00
Jérôme Duval 778fe0b67b driver_settings: bufferSize being zero means buffer overflow
Change-Id: I87b4a57c651840ac6aa01d602eddabb192c8c323
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9116
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-03-11 02:15:39 +00:00
Jérôme Duval 63792e3fd0 Revert "driver_settings: Replace type of bufferSize from size_t to ssize_t"
This reverts commit d2a423e499.

this matches the method found in driver_settings.h

Change-Id: Idb1a83dd648d18916ee2ec34727c88fb8f25cb3e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9095
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2025-03-11 02:15:39 +00:00
Jérôme Duval 7f7d085c59 launch_daemon: implement file_created event
Change-Id: Ie42abe85c594be3c354e2d1b5bb25b881a7adea4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9089
Reviewed-by: Jérôme Duval <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-03-11 02:15:39 +00:00
Jérôme Duval e4e3f81a1b launch_daemon: failed condition now skips the job
Change-Id: I0d3db96a068ecc40dfd1c501dfae5800c0e28116
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9080
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-03-11 02:15:39 +00:00
Augustin Cavalier ea0c6448f2 kernel/x86_64: Reset FPU state in x86_64_thread_entry.
Otherwise it won't be reset at all and we will begin with the
previous thread's FPU state, both for userland and kernel threads.

Also clear the FPU state in x86_return_to_userland, just like
in syscall exit.

Change-Id: Ie46d0e64a680c860c7fbff8dc57116625724eadd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9092
Tested-by: Commit checker robot <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-03-11 02:13:26 +00:00
Augustin Cavalier 317307ff46 headers/x86[_64]: Name the "mxcsr_mask" fields properly.
These values aren't referenced anywhere at present however.

Change-Id: I870d6321c6d30f850f48f811213124276543a1a8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9091
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2025-03-11 02:13:26 +00:00
Augustin Cavalier 6db4b42346 kernel/x86_64: Store FPU state from int_bottom_user in arch_thread always.
The XSAVE area can be quite large (1-2KB+), so rather than always
putting it on the kernel stack, just use the arch_thread FPU state.

Change-Id: Ie64c3ea3ca52cd8a4425ae1da69792588a69832a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9090
Reviewed-by: Jérôme Duval <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2025-03-11 02:13:26 +00:00
Augustin Cavalier bdb6d7db1a kernel/x86: Determine math/SIMD exception cause in exception handler.
Fixes a TODO.

Change-Id: I75e7f05bd72f1500234a7b43ed9da01d3a61ecf2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9082
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-03-11 02:13:26 +00:00
Augustin Cavalier 4c76039f6f kernel/x86_64: Keep FPU and SSE control on context switch.
This reverts most of c7360f4b02.

Unlike the other floating-point registers, these values are callee-saved
(see "System V Application Binary Interface, AMD64 Architecture
Supplement" section 3.2.1.) So we need to preserve their values and not
reset defaults on context switch.

EMMS, as the previous changes used, does not suffice to clear
exceptions. We could use FNCLEX instead, but we need to reset
x87 state on context switch anyway, so use FNINIT. Do not
reinstate FNCLEX in the exception handler since it will
be executed on context switch anyway.

We also need to ensure a clean initial state, so take care of that
in arch_thread_init.

See also:
 * remarks in 396b74228e
 * as well as 53e2dc0f85

Fixes #19454 and #18624. Doesn't regress #18656 and #19063.
Doesn't seem to affect #19450.

Change-Id: I7179f1ec7304e7aed09ff80f6773e53d5dbdf5f9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9081
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-03-11 02:13:26 +00:00
Máximo Castañeda af381ebd19 test_app_server: fix build after hrev58397
Change-Id: I81c64db2adf21f6cea15e99f15e765c108d34506
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9118
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2025-03-11 02:07:19 +00:00
Emir SARI 2f2c48ad53 Terminal: use multiplication signs wherever needed
Apparently missed this one, last time.

Change-Id: Ibcafc18ccde3eb3e8c0696a68b2979c51e68dbcc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7590
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2025-03-10 14:01:35 +00:00
Augustin Cavalier 848d379f5d strace: Handle area_id returns like status_t returns. 2025-03-08 14:57:37 -05:00
Augustin Cavalier cee5e4f57e strace: Don't check if status values are smaller than UINT32_MAX.
The type check suffices. Fixes printing ssize_t error names.
2025-03-08 14:57:18 -05:00
Augustin Cavalier 906623697e ram_disk: Do not use cache_get_pages in Trim().
cache_get_pages locks and unlocks the cache to wait for busy pages,
as well as after it's done, which creates a race where some other
thread may start waiting on a page that we have marked busy. But
as we are about to free those pages, that wait will deadlock.

Just loop through the cache's pages directly, skipping any busy ones
and freeing the others directly.

Fixes a deadlock observed with BFS on a ramdisk.
2025-03-08 10:16:02 -05:00
Augustin Cavalier 876171f588 ram_disk: Add missing DEBUG_PAGE_ACCESS_START.
This was removed from cache_get_pages, so we need to do it manually.

Fixes a KDL reported in the comments of #16951.
2025-03-08 09:42:28 -05:00
Autocomitter b8a3901ea2 Update translations from Pootle 2025-03-08 08:07:04 +00:00
Augustin Cavalier bb6c8ca150 strace: Handle ssize_t differently than status_t.
It's 64-bit on 64-bit architectures and must be handled as such.

Fixes strace outputs seen in #16861.

Also clean up style a bit.
2025-03-08 00:12:43 -05:00
Augustin Cavalier fe70bb7f1e libroot/unistd: Fix write truncating return values of _kern_write.
ssize_t is 64-bit on 64-bit architectures, if we truncate to int
then values above 2GB will be seen as negative and errors instead
of the successes they are.

Seems to fix #16861.
2025-03-08 00:11:51 -05:00
Andrew Lindesay 48ca9d08bb Interface: multi add/remove BColumnListView
This change will allow the BColumnListView to have
multiple rows added or removed at the same time.
Without this, applications using the BColumnListView
will need to add and remove rows one by one which,
for longer lists with complex columns, is a
performance problem; an example being HaikuDepot.

Note that this change does not amend the formatting
style on the class's source.

Change-Id: I72303c8b069b686251c3a65af7ae45c8884d5637
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9056
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Andrew Lindesay <[email protected]>
2025-03-07 10:38:28 +00:00
Humdinger 21ee34828b waitfor: re-write, added option to wait for network
The new "-n" parameter waits for the networking to be up.
Code lifted from SoftwareUpdater.

To avoid polling the network status, use start_watching_network().
As this involves messaging, a BApplication is created and a
BMessageRunner is now used to regularly check if threads or
apps have started/ended.

Change-Id: I55b5174dbdbd326d8d40b958ebf966f8fa6718b3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9067
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2025-03-06 20:26:16 +00:00
Jim906 4407440099 nfs4: Remove stale nodes when their ino is reused
* Add FileSystem::EnsureNoCollision to check for a stale node with
  the given inode number, and remove it if it exists.
* Call EnsureNoCollision from Inode::CreateObject and
  Inode::CreateState to cover creation of directory files and regular
  files, respectively.
* Stop using the entry cache.  Instead, make use of the driver's
  DirectoryCache in the lookup hook.
* Fixes #16924.

When a shared file is deleted, and no clients have the file open, the
server considers the file ID number of the deleted file to be eligible
for reassignment to new files.  If the deletion was performed by the
server or by some other client, the Haiku client does't know the file
was deleted, and still may hold a vnode for it.  This interferes with
the creation of a new file by the client, when the file ID / ino of
the new file is the same as that of the stale node.

The reason for disabling the entry cache is to give the driver a
chance to check the server for changes in name-to-ino mapping when the
VFS function lookup_dir_entry is called.  At least in its current
form, the driver isn't able to deal with outdated entry cache
information.  For example, if the Haiku client has added temp.txt to
its entry cache, and then temp.txt is deleted by the server, running
'nano temp.txt' on the client will attempt to open the (non-existent)
file instead of creating it.

Change-Id: Ic3ec21d18c8616fcfeb9234aafb0e647746d23cd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9068
Reviewed-by: waddlesplash <[email protected]>
2025-03-06 19:59:15 +00:00
Oscar Lesta 8ab7b2bd56 ProcessController: swap drawing of (system) committed and cached memory.
The menu item starts with: "System resources & caches..." but then it
wrote fCachedMemory before fCommittedMemory.

Swapping them seems more in line with how the rest of the "Memory usage"
menu is presented as well.

Change-Id: I83345f9ae35b405ed854e7a1992b537d31e27d02
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9083
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: humdinger humdinger <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-03-06 16:42:35 +00:00
Augustin Cavalier b3d011b90a kernel/locks: Assert in rw_lock_wait that we weren't spuriously unblocked.
May have caught #19458 earlier, depending on cause.

Change-Id: Ib5dd4ef72474f944946e1dae214c49fe440669bc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9086
Reviewed-by: waddlesplash <[email protected]>
2025-03-06 15:00:31 +00:00
Augustin Cavalier 0958031b24 kernel/fifo: Don't unlock before unblock.
Otherwise there is a race that can occur if the waiting thread is
interrupted (or hasn't slept yet) while the writing thread tries to
unblock it.

Instead, don't call SetNotified again if we unblocked with a status
of B_OK. This can only happen when we were notified by another thread
successfully.

Should help with #19458.

Change-Id: Iad46b26374a01539f8765231d259392c231c786a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9085
Reviewed-by: waddlesplash <[email protected]>
2025-03-06 15:00:31 +00:00
Augustin Cavalier 240f1a0e91 kernel/devfs: Check whether the node is a directory in devfs_open.
Same checks as other filesystems.

Fixes "cp file /dev/some/block/device".

Change-Id: Ic4bd04972247b94ac4eaa6e211fe6cb1c53f3975
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9084
Reviewed-by: waddlesplash <[email protected]>
2025-03-06 15:00:31 +00:00
Humdinger 2d3b5776e7 AboutSystem: Separate zh-Hans/zh-Hant, add translators
Adding daniel03663 and edouardlicn for Traditional Chinese, and
Jinuk Jung for Korean.

Change-Id: Ie1f38af87068d1d5d2fa0b07b9594fb371887ea1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9027
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-03-05 20:11:43 +00:00
Augustin Cavalier 16db148e63 kernel/x86: Replace homegrown memcpy & memset with NetBSD's.
FreeBSD also uses NetBSD's versions (with their own modifications,
however.) So it seems to make sense for us to adopt these, too;
they look to be better tuned than ours were (like handling
non-aligned addresses better, which was a TODO before.)
2025-03-05 14:25:56 -05:00
Augustin Cavalier 282bdf736c Overhaul generic memcpy and memset.
* Rewrite generic memcpy, with optimizations more like the common memcmp
   optimizations.

 * Rewrite generic memset, with a proper optimized implementation.

 * Name the files "generic_" like other files in the arch generics dirs.

 * Always use the generic versions in the bootloader, since it's
   complied with special flags.
2025-03-05 14:23:13 -05:00
Augustin Cavalier f33654d942 libroot/string: Put the misalignment check in memcmp() into a macro. 2025-03-05 13:43:02 -05:00
Augustin Cavalier a23e085678 m68k, arm: Rename arch_string.S to memcpy.S.
As it only contains a memcpy implementation.
2025-03-05 12:53:16 -05:00
Augustin Cavalier 62793934a1 x86, x86_64: Move (userland) memcpy, memset out of arch_string.S/.cpp.
Put the C++ versions in files with their own names, and
rename the assembly thunks to "commpage_string.S", as it
really just invokes the commpage versions.

The kernel x86 arch_string.S is left alone for the moment
as it will be replaced in the near future anyway.
2025-03-05 12:48:54 -05:00
Augustin Cavalier 8a86fccb1b arm64, riscv64: Drop arch_string.S.
It was empty and unused on these architectures.
2025-03-05 11:57:05 -05:00
Augustin Cavalier 1707ab1299 runtime_loader: Use posix_string_arch as built for libroot.
Instead of using individual files from it.
This will make changes to how it is built easier to make.
2025-03-05 11:55:27 -05:00
Augustin Cavalier 2b52ddef79 libroot/string: Use '==' and not '-' and '== 0' for all except the last comparison.
Should make the code clearer and save a branch in the loop.
Also add Haiku, Inc. to copyright notice.
2025-03-05 11:12:41 -05:00
Augustin Cavalier 5d46b254d4 libroot/string: Apply the same optimization to strncmp as in strcmp. 2025-03-05 10:45:55 -05:00
Oscar Lesta 3096860403 bin/keymap: show help with -h, use -H for --header.
This is less surprising than having it the other way around.

Adjusted the "MkKeymapHeader1" action on src/servers/input/Jamfile accordingly.

Change-Id: I9fb8f8d7d0cfde493c03755beafbff73222cba93
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9066
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2025-03-05 13:01:05 +00:00
John Scipione cb4a168e37 Tracker: menu parameter is ambiguous, rename to parent instead
Change-Id: I9a8811ff8c142efcdfbebae0c2b6e438290eafcd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/9061
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2025-03-04 14:50:27 +00:00
Augustin Cavalier 2e3af8f296 ralinkwifi: Import MT7601U driver from FreeBSD.
It's branded as a MediaTek device, but the firmware
copyright is Ralink.

From upstream b96864412700a2a5b5e9aaf5d6513ec062cfc96f.
Includes adaptations to make it compile on Haiku.
2025-03-03 16:46:01 -05:00
Augustin Cavalier 1f00d7e571 freebsd_network: Add firmware_get_flags.
Needed by the MT7601U driver.
2025-03-03 16:28:39 -05:00
Augustin Cavalier 640cf189a0 ralinkwifi: Cleanup interrupts glue. 2025-03-03 16:20:20 -05:00
Augustin Cavalier 5059b85380 kernel/condition_variable: Add a cpu_pause in the RemoveFromVariable loop.
All the other spin-loops have this, so this loop should too.
2025-03-03 15:13:21 -05:00
Augustin Cavalier a0c4b9a162 SCSI: Use ConditionVariable::NotifyOne, not NotifyAll.
This matches the previous behavior (which just used release_sem
or _etc with a count of 1.) The one waiter might delete the object
containing the condition variable on wakeup, so the difference
does matter.
2025-03-03 15:12:31 -05:00
Augustin Cavalier 73e7455250 BBlockCache: Don't use weak symbols except on Haiku.
We may compile on systems that don't use ELF (e.g. Darwin/macOS.)
Avoid a dependency on the feature where we don't need it.
2025-03-03 14:47:51 -05:00
Augustin Cavalier d56e1a13aa kernel/locks: Make the assertion in mutex_destroy print a backtrace of the owning thread. 2025-03-03 14:43:30 -05:00
Augustin Cavalier 752c6e8b9e kernel/thread: Fix a TODO in get_next_thread_info().
Just find the previous thread and then get the one after it in
the general case. This avoids problems with "unsorted" thread lists
as found in the kernel team or when IDs wrap, with the previous
logic only kept as a fallback if the last-fetched thread
does not exist anymore.
2025-03-03 14:36:01 -05:00