Commit Graph
100 Commits
Author SHA1 Message Date
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
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
Augustin Cavalier a6025379d1 FAT: Don't try to create file caches too early.
Otherwise we get log spam in builds from fat_shell about
failures to get vnodes, which looks bad.
2024-07-09 15:02:37 -04:00
Augustin Cavalier d694b88a62 kernel/x86: Make acpi_read & acpi_write private (static).
They aren't used anywhere outside this file anymore, and they
shouldn't be used when X2APIC is enabled, anyway.
2024-07-09 14:59:30 -04:00
Augustin Cavalier 2d2528f6f6 fat_shell: Fix build.
We need the BSD headers for <sys/queue.h>
and other things, so we can't use "strict-ansi".
2024-07-09 14:44:36 -04:00
Augustin Cavalier 51af683457 fs_shell: Fix infinite recursion in get_vnode_name.
Spotted by GCC.
2024-07-09 14:44:04 -04:00
Augustin Cavalier f6839b1ca7 fs_shell: Only define LONGLONG_MAX if not defined.
Fixes a bunch of warnings.
2024-07-09 14:43:45 -04:00
Augustin Cavalier 3cd4900795 kernel/x86: Do not read APIC registers while setting the interrupt command.
FreeBSD's equivalent routine (lapic_write_icr) does not read
these registers; in fact the only thing that does read them
are its initialzation routines, and then its code to check
the interrupt delivery status (same as we do.)

Additionally, APIC_INTR_COMMAND_1_MASK only contains the bits
that are set by the OS, not the ones set by the APIC, which
means that APIC_DELIVERY_STATUS (bit 12) isn't included
and we are thus writing it back here, which doesn't
seem correct.

Change-Id: I2c74b7b8de3cd8295c8dd86e5a7c6530dc5648ed
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7827
Tested-by: Commit checker robot <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-07-09 17:52:19 +00:00
Augustin Cavalier 3ea2ee1a40 kernel: Use "final" more in the VM and x86 paging classes.
Since we always compile the kernel with modern GCC, we might as well
take advantage of modern C++ features. In addition to providing
a sanity check, "final" is also an optimization, since it allows
the compiler to devirtualize calls made directly to a "final" class.

Change-Id: Iedb0ee8834637771f5b6113c17342dbf67e99042
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7826
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-07-09 17:52:19 +00:00
Augustin Cavalier 3af5908769 fat_shell: Fix filemode of Jamfile. 2024-07-09 12:06:30 -04:00
Augustin Cavalier 88979be93f PCI: Log failed config reads.
We already log "can't read config" in this method, so let's
also log lower-level failures.

May help with investigating #18536.
2024-07-09 11:45:44 -04:00
Augustin Cavalier 1342073197 PCI: Avoid overflows in ReadResourceInfo.
The operation should be promoted to at least 32-bits anyway,
but it's better to be safe here.
2024-07-09 11:40:57 -04:00
Augustin Cavalier 599a303e23 PCI: Return more meaningful error codes from ReadConfig/WriteConfig. 2024-07-09 11:36:50 -04:00
Augustin Cavalier 2813fd13ca profiler: Report CPU times and use them to compute "missed" ticks.
This shows that the profiler is still pretty broken, because we
are missing quite a lot of ticks on average. One run of
"profile pkgman search" here produced an output with 66 total ticks
and 423 (!) missed ticks. A brief run of WebPositive was not quite
as bad (main thread: 1078 total ticks, 157 missed ticks.)

Change-Id: Idfc34534e66eff0fe7e948fcc3576be09db879a3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7820
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
2024-07-08 17:13:30 +00:00
Augustin Cavalier 60b260aca1 kernel/block_cache: Coalesce consecutive block writes.
This way we can take advantage of the writev() optimization
added in the preceding commit.

Should also help with #15585.

Change-Id: Ib3b8d2c72b4a36cfb75d7c17b91d442161b2dbdd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7825
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-07-08 15:51:13 +00:00
Augustin Cavalier 6c7ced1f01 kernel/fs: Try to use real vectored I/O in common_vector_io.
We can only do this if the underlying I/O will not be cached,
since the I/O hook bypasses any cache. But that should be fine,
as in the event that reads and writes are going through the file cache,
calling read and write multiple times isn't especially expensive.

On the other hand, when the underlying device is not a file
or something else cache-backed, making many I/O calls instead
of just one can be very expensive. The BFS journal flush seems
to routinely call writev() with over 100 iovecs on a regular basis
during high disk activity, and doing 100+ separate writes to
an external drive vs. just one makes a big difference.

Should help with #15585.

Change-Id: I433e9d9948634f8cdccf7999710c6c5e6b6c8850
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7824
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2024-07-08 15:51:13 +00:00
Augustin Cavalier cf638bb14b nvme_disk: Fix a few bugs in the get_memory_map logic.
* If realloc returns NULL, we still need to free the original pointer.

 * If get_memory_map returns with B_BAD_VALUE and entries is 0,
   this is really the same as B_BUFFER_OVERFLOW.

Fixes spurious I/O failures when writing the BFS journal directly
with vectored I/O (as the next commit will enable.)

Change-Id: I56b63ea2f6b82716719570f1e35d9b425a49b64e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7823
Reviewed-by: Adrien Destugues <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-07-08 15:51:13 +00:00
Augustin Cavalier ff91caf6e5 kernel/fd: Merge vectored I/O implementations.
We now have just one rather than three (common_user_vector_io,
_kern_readv, kern_writev.)

No behavioral change intended, though there is some slight
functional change (syscall flags are now set/unset much earlier.)

Change-Id: I6c3c26cab1c19755ef15c8b3c9e38afe9b1d145c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7822
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2024-07-08 15:51:13 +00:00
Augustin Cavalier 722d3c01b7 kernel/fs: Increment pos in readv/writev so long as it's not -1.
This amends 20ac27def6.

I missed an important case in that commit: if pos is not -1,
then movePosition will still be false, but we nonetheless
need to increment the read/write position.

Should fix #18921.
2024-06-28 13:47:33 -04:00
Augustin Cavalier 44e9aa9f33 file_systems/QueryParser: Don't let the equation score be 0 if there's an index.
Without this, a query term that does have an index but for which
the pattern starts with a wildcard (e.g. "*term*") is treated as having
a score of 0. That means that it is then dependent on the query order
as to whether or not the equation will run at all, since if all the terms
have a score of 0 but one has an index, placing that term first
will make the query run while any other would not.

Fixes #18672.
2024-06-26 18:20:50 -04:00
Augustin Cavalier 88911fe61c file_systems/QueryParser: Only increment within the operators loop.
If we have a matching operator, we will replace the current item
with a new item, and we may need to process it again. For example,
in cases like "A||B||C", the first pass will turn this into "(A||B)||C",
and so we need to re-process the first item to get "((A||B)||C".

Fixes "Open with..." and some other things following the query parser
refactorings.
2024-06-26 17:23:11 -04:00
Augustin Cavalier eca86a00ae Tracker: Add a try/catch around ModelMenuItem's creation in AddOneAddOn.
ModelMenuItem can throw exceptions if its Model fails to initialize,
and even though we pass a Model in directly, copying the Model
results in opening the underlying file again, which of course may
fail if something changed since our Model was created.

While at it, remove the return value, since it isn't used anywhere.

Should fix #18905.
2024-06-26 16:37:28 -04:00
Augustin Cavalier 1a3dae790e Tracker: Code cleanup around add-ons.
Mostly de-indents and some shuffling in headers.
No functional change intended.
2024-06-26 16:37:26 -04:00
Augustin Cavalier d1c8e2fe7c strace: Don't print the starting "_kern_" in the stats view.
Same change that was made for the non-stats printing a long
time ago.
2024-06-25 22:10:49 -04:00
Augustin Cavalier 05404cc538 freebsd_network: Print the bounce buffer type in panic message.
May help with diagnosing #18885.
2024-06-25 21:48:28 -04:00
Augustin Cavalier 8e56b86bdd kernel: Use BStackOrHeapArray in fd & port vector I/O syscalls.
The socket syscall needs to still use the heap. Also add a comment
around get_iovecs_from_user() indicating what callers must do.
2024-06-25 21:33:20 -04:00
Augustin Cavalier 20ac27def6 kernel/fs: Fix readv/writev after the seek-disabled refactor.
This fixes a regression introduced in 34fcf3d9ea.

That commit correctly adjusted the "pos" checks at the top of these
functions, but missed that there was a place in the loop where pos
is incremented. After the first increment, we would have a non-zero
pos, and so the new checks in the actual read/write routines would
return an error, meaning that only the first iovec was ever processed.

This fixes WINE following the aforementioned change.
2024-06-25 20:46:54 -04:00
Augustin Cavalier 32c59a45e1 strace: TypeHandler for iovec*.
Useful for readv, writev, and writev_port_etc.
2024-06-25 20:20:15 -04:00
Augustin Cavalier 0caf909cec Move mounting the shared_memory ramfs to launch_daemon.
The directory is created there, so we should also perform the
mount operation there. If we don't, the first boot of a new
Haiku image will not have the ramfs shared_memory, since of
course the kernel can't mount it at a nonexistent directory.
2024-06-25 19:09:38 -04:00
Augustin Cavalier 146690fec4 aironetwifi: Amend last change.
Seems my local incremental build spuriously succeeded.
2024-06-25 18:57:35 -04:00
Augustin Cavalier 6335cebddd usb.ids: Update. 2024-06-25 18:37:30 -04:00
Augustin Cavalier e791322263 pci.ids: Update. 2024-06-25 18:37:16 -04:00
Augustin Cavalier 4780e4d4df freebsd_network: Remove some now-unneeded methods and compatibility macros. 2024-06-25 18:35:03 -04:00
Augustin Cavalier 5a39afd352 aironetwifi: Synchronize to the last version before it was removed. 2024-06-25 18:32:53 -04:00
Augustin Cavalier df49d6c934 drivers/network: Remove remaining declarations of "devclass".
Mainly the ported OpenBSD drivers (where this was added in Haiku-specific
code), and then the few remaining drivers that are no longer supported
on FreeBSD.
2024-06-25 17:40:09 -04:00
Augustin Cavalier 088c695b17 freebsd_network: Remove fls/ffsl from generic/cpufunc.h 2024-06-25 17:14:45 -04:00
Augustin Cavalier 97a29cc796 freebsd_network: Remove definitions of ffs/fls functions from x86/cpufunc.h 2024-06-24 22:19:49 -04:00
Augustin Cavalier 054e94c69b iaxwifi200: Port a change from upstream OpenBSD. 2024-06-24 22:18:15 -04:00
Augustin Cavalier 25e0933970 openbsd_wlan: Synchronize with upstream OpenBSD. 2024-06-24 22:05:52 -04:00
Augustin Cavalier 95ce8f21aa rtl8125: Synchronize with upstream OpenBSD. 2024-06-24 21:57:29 -04:00
Augustin Cavalier b1ae2896a0 openbsd_network: Add cast to silence a warning. 2024-06-24 21:56:59 -04:00
Augustin Cavalier 1f33dab2e6 freebsd_network: Move ffs/fls routines to libkern.h and use builtins.
FreeBSD upstream did this a while back. Should fix the 32-bit build.
2024-06-24 21:56:08 -04:00
Augustin Cavalier 86021fd407 Synchronize freebsd_net80211 and all maintained FreeBSD drivers with 14.1.
Tested with realtekwifi, still works.
2024-06-24 21:19:47 -04:00
Augustin Cavalier f6b6453fee freebsd_network: Additions for FreeBSD 14.x net80211 and drivers. 2024-06-24 20:55:29 -04:00
Augustin Cavalier 1454f3c27a Synchronize all remaining FreeBSD ethernet drivers with FreeBSD 14.1.
Except those since dropped from FreeBSD.
2024-06-24 19:58:44 -04:00
Augustin Cavalier 3fcde6b236 freebsd_iflib, intel22x, ipro1000: Synchronize with FreeBSD 14.1.
ipro1000 tested in QEMU, still works.
2024-06-24 19:48:17 -04:00
Augustin Cavalier 7d36436b75 freebsd_network: Additions and modifications for FreeBSD 14.x drivers.
* Add more if_{get|set}* routines, and move all copied directly from
   FreeBSD into a fbsd_if.c file. Also clean up the header.

 * DRIVER_MODULE macros dropped the "devclass" parameter.
   In order to not break all existing drivers, use FreeBSD's
   interim solution of compatibility macros.
2024-06-24 19:46:25 -04:00
Augustin Cavalier 83e4de8b64 file_systems/QueryParser: Limit to 32 equations maximum.
This way, we won't run into stack overflow issues due to recursion.
Who would really need a FS query with more than 32 equations, anyway?

Fixes #18692.

Change-Id: Ieda401446d9cae2e56100ddbab08bebcc724b484
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7789
Reviewed-by: waddlesplash <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
2024-06-24 19:40:08 +00:00
Augustin Cavalier 6d7e181767 file_systems/QueryParser: Rewrite parsing logic to avoid recursion.
This way, we can handle parse trees of arbitrary depth without
running into stack overflows. Of course, evaluation is still
a problem...

While at it, use "const char*" everywhere, and also put the
query parser into an Init() function so we can return
more statuses than just B_BAD_VALUE.

Part of #18692.

Change-Id: Ib81e6545935ce484df10dfe36ca4ffcf2b3cd607
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7710
Reviewed-by: waddlesplash <[email protected]>
2024-06-24 19:40:08 +00:00
Augustin Cavalier e0ff85edaa tests/file_systems: Add a QueryParserTest.
At present it just accepts query strings as command-line arguments
and prints the parsed query to the stream (or the error, if there
is one.)

Change-Id: I907380e370790ad9fb4d8f9406a18d359d0dcc2b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7709
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-06-24 19:40:08 +00:00
Augustin Cavalier 76f38b534f tests/file_systems: Synchronize <userland>ramfs Jamfile with kernel one.
Doesn't fully build but at least gets closer to the kernel version.

Change-Id: I3f7c83da97b7163724e3dc547603a88796def254
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7708
Haiku-Format: Haiku-format Bot <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-06-24 19:40:08 +00:00
Augustin Cavalier 804e27b8fb tests/file_systems: Delete obsolete beos_interface Jamfiles.
Change-Id: I6a8777f763e2c24e60823deef5a7521248a30b72
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7707
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2024-06-24 19:40:08 +00:00
Augustin Cavalier f91b5cb297 tests/file_systems: Move some tests to a common "shared" directory.
Rather than having individual directories for the tests. No
functional change intended.

Change-Id: Ie453eab2d7347cef4ea68a1e7793d01817e7da39
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7706
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-06-24 19:40:08 +00:00
Augustin Cavalier 0a44afc6bf BFS: Use the shared QueryParser.
Ideally should have no functional changes from the old one.

Change-Id: Id557d8fb069603221887447597ef0ffce5de07a6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7705
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Axel Dörfler <[email protected]>
2024-06-24 19:40:08 +00:00
Augustin Cavalier 7da55c7296 file_systems: Backport changes to QueryParser from BFS.
* 3e818f2075
 * 711e2dc05b
 * 6609c1a03a
 * f79179975d
 * 0ed0f5cb35 (tweaked for 64-bit)
 * a2eb6bbda4

Change-Id: I11d9946b475449b7b5aeed956e3ae8a776a0b20a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7704
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-06-24 19:40:08 +00:00
Augustin Cavalier 3a17bd3545 file_systems: Adjustments to QueryParser in preparation for BFS using it.
Should not result in functional changes to packagefs and ramfs
queries behavior.

Change-Id: If361ca65de99d255e67f929c3442e0c20e39cdf4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7703
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2024-06-24 19:40:08 +00:00
Augustin Cavalier 365b32bb6e kernel/team: Set team arguments during load_image/exec_team.
This way, by the time we send a notification, the arguments
are already set even if the main thread has not yet started.

Fixes #12703.

Change-Id: Ib93b4b16bffa8cb943cf6389f0f72dce89f9749b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7702
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-06-10 16:32:09 +00:00
Augustin Cavalier 2e01121f19 kernel/vm: Only prevent access to the physical allocated ranges.
The physical memory ranges will actually be used again
later on during post-modules VM setup. The allocated ranges
are what we really want to prevent access to, anyway.

Fixes #18907.
2024-05-30 12:14:36 -04:00
Augustin Cavalier 2b06e3ea48 BScrollView: Only adjust other dimension if it's greater-than-zero.
And add an inline comment with a bit of explanation,
since this logic has now been revised multiple times.

Fixes #18690.
2024-05-29 19:31:58 -04:00
Augustin Cavalier fb79b8994f Appearance: Only Select() if we are attached to a window.
Otherwise the appropriate message won't be sent.
AttachedToWindow() will take care of selecting
in that case.

Fixes #18891.
2024-05-29 19:02:55 -04:00
Augustin Cavalier bd25d788a2 kernel/slab: Disable the block allocator entirely if disabled.
block_alloc and friends are now declared as static, so we got
GCC errors about unused functions when USE_SLAB_ALLOCATOR_FOR_MALLOC
was 0. So, instead, just don't initialize the block allocator
at all.

This was the change that triggered the prior commits: if the
block allocator is completely disabled, the first object
allocated through an object_cache is inside VMAddressSpace
initialization, which happens during the interim period
mentioned in previous commits.

Haiku now can be built and booted all the way to the desktop
with the kernel guarded heap enabled (and without the guarded
heap substituting for the object cache.)

Change-Id: If2f08a741826799127ecfd263d6c82ed4263eaab
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7701
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
2024-05-29 18:10:06 +00:00
Augustin Cavalier 7133a49e81 kernel/slab: Allocate one area upfront when the debug heaps are in use.
See inline comment: if we don't, we'll try to allocate pages
during the post-page-init but pre-area-init period, which
isn't possible (and after the previous commit will properly fail.)

Change-Id: If8392417e05912c8cfc417222abab3b39cb15bf1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7700
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-05-29 18:10:06 +00:00
Augustin Cavalier ebc1a034fb kernel/vm: Prevent access to kernel args physical ranges after page init.
Otherwise, vm_allocate_early_physical_page could try to use them to
allocate more physical pages, which isn't legal as page state
management is now the responsibility of the vm_page system.

Discovered while working on re-activating the guarded heap.
In that case, at least, the illegally allocated pages were caught
by the memory manager trying to convert them into areas,
but they weren't marked WIRED and so tripped asserts.

Change-Id: I39af70bf8a652511bb65fe2154bba16d4ba5c924
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7699
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Axel Dörfler <[email protected]>
2024-05-29 18:10:06 +00:00
Augustin Cavalier 0b4eefc5c8 kernel/vm: Fix printf specifier for page_num_t.
Should fix a -Werror on 32-bit.
2024-05-28 23:24:53 -04:00
Augustin Cavalier 8d63c2f657 kernel/x86: Fix double fault stack allocation.
This has been broken since January 2014, from a change made during
the scheduler refactor (527da4ca8a).

How nobody seems to have figured this out since then, I have no idea,
especially since the 32-bit initialization routine had the
critical function (x86_get_double_fault_stack) commented out entirely.

Even if it wasn't commented out (and it wasn't for 64-bit), it wouldn't
have worked, because the double-fault stacks were not allocated
until "post-VM", while the TSS is set up during "preboot" (basically
just after kernel entry.)

We now take care of this by allocating the virtual address for
the stacks immediately, and then creating an area for it
in the "post-VM" stage. This means that any double-faults
which occur before the post-VM stage will just triple-fault,
but seeing as all double-faults have been triple-faults
for the past decade, that's probably fine. (In order to get a
double-fault stack that early, we would probably need to
have the bootloader allocate it for us.)

This must be working, because it changes #18692
from a triple-fault (instant reboot) into a double-fault KDL.
2024-05-28 23:06:53 -04:00
Augustin Cavalier 56c6878258 kernel/vm: Add sanity check for page_num in "page" KDL command.
On some rare memory-corruption KDLs, I have seen pages with
"0" for all fields including page_num. So now we compute the
expected page number from the page's offset into sPages
and print an additional line if it doesn't match what's in the
page structure.
2024-05-28 17:04:18 -04:00
Augustin Cavalier d12b3a0e1d kernel/socket: Allow the network stack to be unloaded on KDEBUG kernels.
This includes nightly builds; but at least we keep the efficiency gain
on release builds.
2024-05-28 16:32:13 -04:00
Augustin Cavalier 6b99b20692 telnet: Synchronize with FreeBSD 13.3. 2024-05-28 16:23:27 -04:00
Augustin Cavalier 0c84b78dd3 ftpd: Synchronize with FreeBSD 13.3. 2024-05-28 16:08:22 -04:00
Augustin Cavalier 45383846d8 kernel/fs: Translate ioctl(FIONBIO) into fcntl(F_SETFL).
This way, FIONBIO and O_NONBLOCK will no longer get out of sync,
and additionally, FIONBIO can be used to change non-blocking
status of regular (non-socket) FDs, too (which some applications
seem to take advantage of, to avoid needing to fetch the open_mode
before calling fcntl.)

Change-Id: Id894fe76c79ac373c0121a003d68180a3d9b6560
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7697
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-05-28 19:05:22 +00:00
Augustin Cavalier e08f7fd12b kernel/vfs: Slight refactor to F_SETFL to reduce duplication.
No functional change intended.

Change-Id: Ida1dd3b1629836d3d48598bb98bc2c56cdcf869f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7696
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-05-28 19:05:22 +00:00
Augustin Cavalier 560f1681fa listattr: Needs <time.h>.
Seems to be implicitly included on Haiku, but for <build>listattr
on Linux, it's needed.
2024-05-28 14:55:32 -04:00
Augustin Cavalier 85ae477c41 libroot: Remove obsolete comment in fs_attr implementation.
We've had special syscalls and used them for many years now.
2024-05-28 14:55:03 -04:00
Augustin Cavalier 68f76d61d7 libroot_build: Add a "hex-encoded attribute names" mode.
Some systems (e.g. NTFS through WSL1) support arbitrarily-large
extended attributes, but do not preserve case on attribute names
(or disallow more characters than the existing manglers took
care of.)

So, this adds a mode in which attribute names are encoded as
hexadecimal. At present it must be manually enabled; in the future
it may be possible to modify ./configure to activate it
automatically.

Change-Id: If20e4cb1cf4153cccc918ce6d51761426055290c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7698
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2024-05-28 18:51:45 +00:00
Augustin Cavalier 61eed15db9 kernel/socket: Refactor {get|put}_stack_interface_module and keep it loaded.
* Make the consumer-count int32 atomic, avoiding the need for
   all get/put operations to go through a global lock.

 * Disable the code that unloads the stack interface when there
   are no consumers. Otherwise, we wind up repeatedly loading/
   unloading the stack interface during the boot process (e.g.
   while sockets are being created and destroyed during net_server
   startup.)

   In the future, if we want to really unload it, we can add some
   interaction with low_resource_monitor or something like that.

Reduces register_domain call count during boot from 31 to 7
(it appears the stack was loaded and unloaded 5 times, before
it stayed loaded the 6th.)
2024-05-27 19:45:57 -04:00
Augustin Cavalier 757031348e network/stack: Unload all modules at end of scan process.
Otherwise, modules that depend on each other will be repeatedly
loaded and unloaded. This reduces the number of register_domain()
calls on a standard boot (of @minimum, at least) from 43 to 31.
2024-05-27 19:45:24 -04:00
Augustin Cavalier a03edeab4d sdhci_acpi: Disable tracing for now.
It adds a lot of log spam even on systems without any such devices
(due to device detection.)
2024-05-27 19:36:38 -04:00
Augustin Cavalier 91e6e52158 L2CAP: Major refactor of the whole component.
(And surrounding portions of the "btCoreData" module.)

 * Rewrote the main "l2cap.h" header representing protocol constants
   and structures. Now conforms to general Haiku naming conventions
   rather than BSD ones. Some more constants added/removed based
   on the most recent Bluetooth specification.

 * Rewrote all code derived from the BSDs to match Haiku conventions
   and structures in the driver.

 * Dropped the "channel" and "frame" structures from "btCoreData".
   Channels are now managed by L2capEndpoints, and "frames" are
   now just plain net_buffers without surrounding structures.
   This also makes state management much simpler.

 * Made it so that actual net_buffers are passed through to the
   l2cap_receive function rather than another data structure.
   A fake interface address is used to communicate connection
   information. (This probably ought to be changed, though.)

 * Get rid of l2cap_lower and l2cap_upper abstractions.
   Everything related to channel/endpoint management is now
   done in L2capEndpoint, while buffer reception is handled
   directly in l2cap_receive and elsewhere, same as other drivers.

 * Wire up more hooks and fix module flags (needed to be able to
   get the module loaded and opening sockets at all.)

 * Implement an actual locking strategy in L2capEndpoint
   and HciConnection. There's still problems with lifetime
   management, but at least thread-safety is mostly handled.

 * Create an L2capEndpointManager and use it to manage
   the endpoints, rather than having a single (unsafe)
   linked-list.

And plenty of other refactorings and cleanups besides.
There's still more to be done for Bluetooth overall, though:

 * The "btCoreData" and "hci" modules also badly need a major
   overhaul, and should be merged into a single "bluetooth"
   bus_manager. They also shouldn't be passing around pointers
   to other modules like this.

 * There's a number of TODOs/FIXMEs in the L2CAP module, most
   notably around timeouts (especially command timeouts) and
   parameter validation/specification.

Tested by myself and kallisti5. Outgoing connections,
at least, manage to fully initialize and configure
successfully.
2024-05-01 00:25:43 -04:00
Augustin Cavalier bb83316a58 L2CAP: Major refactor of the whole component.
(And surrounding portions of the "btCoreData" module.)

 * Rewrote the main "l2cap.h" header representing protocol constants
   and structures. Now conforms to general Haiku naming conventions
   rather than BSD ones. Some more constants added/removed based
   on the most recent Bluetooth specification.

 * Rewrote all code derived from the BSDs to match Haiku conventions
   and structures in the driver.

 * Dropped the "channel" and "frame" structures from "btCoreData".
   Channels are now managed by L2capEndpoints, and "frames" are
   now just plain net_buffers without surrounding structures.
   This also makes state management much simpler.

 * Made it so that actual net_buffers are passed through to the
   l2cap_receive function rather than another data structure.
   A fake interface address is used to communicate connection
   information. (This probably ought to be changed, though.)

 * Get rid of l2cap_lower and l2cap_upper abstractions.
   Everything related to channel/endpoint management is now
   done in L2capEndpoint, while buffer reception is handled
   directly in l2cap_receive and elsewhere, same as other drivers.

 * Wire up more hooks and fix module flags (needed to be able to
   get the module loaded and opening sockets at all.)

 * Implement an actual locking strategy in L2capEndpoint
   and HciConnection. There's still problems with lifetime
   management, but at least thread-safety is mostly handled.

 * Create an L2capEndpointManager and use it to manage
   the endpoints, rather than having a single (unsafe)
   linked-list.

And plenty of other refactorings and cleanups besides.
There's still more to be done for Bluetooth overall, though:

 * The "btCoreData" and "hci" modules also badly need a major
   overhaul, and should be merged into a single "bluetooth"
   bus_manager. They also shouldn't be passing around pointers
   to other modules like this.

 * There's a number of TODOs/FIXMEs in the L2CAP module, most
   notably around timeouts (especially command timeouts) and
   parameter validation/specification.

Tested by myself with kallisti5's help. Incoming connections
(on the PSM for SDP) get all the way to the latter half
of the Configuration step before hanging.
2024-05-01 00:25:43 -04:00
Augustin Cavalier d3e2c76409 l2capClient: dos2unix. 2024-05-01 00:25:43 -04:00
Augustin Cavalier c54549e7fd tests: Wire in L2capClient's Jamfiles. 2024-04-26 16:21:19 -04:00
Augustin Cavalier fd38d7d4c3 btDebug: Fix duplicate "bt: " in CALLED entries. 2024-04-26 16:21:19 -04:00
Augustin Cavalier 692ac8f330 L2CAP: Cleanups and refactors to l2cap_address.
Mostly deleting leftovers from where this was copied from IPv4,
and implementing some missing functionality.

Notable bugfix: is_empty_address was broken due to an incorrect
comparison.
2024-04-26 16:21:19 -04:00
Augustin Cavalier b9209765f9 NetBufferUtilities: Add NetBufferDeleter.
As the name implies, it's an AutoDeleter for NetBuffers.
2024-04-26 16:21:19 -04:00
Augustin Cavalier d3192e1006 kernel/util: Adjust includes of VectorMap.
This way it can be included even if "util" isn't in the header search
path.
2024-04-26 16:21:19 -04:00
Augustin Cavalier 979a0bc487 Appearance: Hide most colors by default and compute them automatically.
In the new "automatic" mode, the number of displayed colors
is just 3, as opposed to the full 38. Much more manageable!

The HSL routines added in this commit were derived from
https://gist.github.com/ciembor/1494530 which is itself derived
from the Wikipedia page describing HSL/HSV.

Part of #15543 and #11636.

Change-Id: I230a358d18c379fb0673162e0b3cbdb8d1b8d84e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7479
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-04-11 17:38:45 +00:00
Augustin Cavalier 2d8b193455 quicktour: Fix syntax error.
Fixes #18871.
2024-04-05 15:27:32 -04:00
Augustin Cavalier d919c744b2 src/tools: Remove duplicate copy of MsgSpy.
There is another (and more recently updated) one
in src/tests, which is also wired in to the build
system (which this one was not.)
2024-04-05 15:25:21 -04:00
Augustin Cavalier c92708ab72 Tracker: Lock the menu looper before getting its font.
Most of the time when this function is invoked,
the menu is not yet attached to a window, and so
there is no looper to lock. But some of the time,
there is, leading to a crash if we don't lock it.

Fixes #18875.
2024-04-05 15:22:49 -04:00
Augustin Cavalier aa977a0227 ffmpeg: Fix fCodecContext initialization and usage.
* Don't allocate a context up front if we're
   just going to free it anyway.

 * Actually set the various flags originally set
   in the constructor in the place where the context
   is actually allocated.

 * Remove now-duplicate thread_count assignment.
2024-04-05 15:07:22 -04:00
Augustin Cavalier c9eb52ae09 TCP: Check return value of ProtocolSocket::Open(). 2024-03-23 15:17:50 -04:00
Augustin Cavalier 1e0c1ca344 FileTypes: Fix -Werror=parentheses after prior commits. 2024-03-23 14:46:48 -04:00
Augustin Cavalier cdb8ce2438 runtime_loader: Fix incorrect usage of rpath.
This should've been changed to pathString
in 43d1a0dc3c.

Fixes #18858.
2024-03-23 14:40:46 -04:00
Augustin Cavalier f5682ebb56 wb840: Remove usage of load_driver_symbols under DEBUG.
This function is not declared in the headers anymore,
and is a deprecated no-op.
2024-03-22 23:15:39 -04:00
Augustin Cavalier 34fcf3d9ea kernel/fs: Refactor file_descriptor seek-disabled behavior.
* Default "pos" to "-1" instead of 0 and check for this value
   instead of ops->fd_seek directly in IO operations.

 * Set "pos" to "0" only for seekable vnodes.

 * Return ESPIPE in read() and write() if the specified pos is not
   -1, but the descriptor->pos is.

Fixes the VFS part of #18836.

Change-Id: Ib4da1652b06798588abedc98963aeb63511d3e41
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7544
Reviewed-by: waddlesplash <[email protected]>
2024-03-22 17:21:43 +00:00
Augustin Cavalier 76142a9377 package_daemon: Try to use the old activated-packages file time for the state name.
Using the current time can be confusing when looking at packages or
the bootloader, as the time represents whenever the new state was made,
not when the old state was.

When there is no activated-packages file, we just use the current time
anyway. This means that on newly created systems, the first two states
will have the same time, and the second will have an extra "-1" on the
end of its name to distinguish it (if for some reason the activated
file retains its time, then you'll get "-2", etc.)

Change-Id: I128764ae4650a3433e2584f3ed154b04cf850b19
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7543
Reviewed-by: Jérôme Duval <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2024-03-22 00:38:53 +00:00