10272 Commits

Author SHA1 Message Date
Jim906
1c0da902ab userlandfs: Ensure room for requests in port
* Add a parameter to RequestAllocator::AllocateAddress and ::AllocateData
  that allows the client to specify a minimum amount of free space that
  must remain in the port buffer.
* Make use of the new parameter in some operations that can fail
  without it.

The Port buffer can be used to store data associated with a Request.
For some file system operations, further requests must be sent through
the port (by calling AllocateRequest) after reserving port buffer
space for data. Unlike AllocateAddress and AllocateData, which can
use an area if the data is larger than the port buffer capacity,
AllocateRequest can only allocate space in the port buffer. If data
previously allocated in the port buffer happens to be large enough to
fill it, then these further AllocateRequest calls will fail.

Change-Id: If03e0afdfbd9fbc36f0e1a04b5d0a20031932b91
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8866
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2025-01-29 17:17:16 +00:00
Augustin Cavalier
72162cc730 kernel/vm: Put name argument first in VMCache::Init.
This seems to make more logical sense.
2025-01-28 17:55:27 -05:00
Augustin Cavalier
fb3a70af79 kernel/vm: Give VMCaches better names.
This helps with debugging and reading scheduling reports.
2025-01-28 16:40:27 -05:00
Augustin Cavalier
17c3890ce1 kernel/vm: Track fault and copy counts in VMCache.
This solves a TODO for reporting CoW counts in area_info, and paves
the way for adaptive handling of pre-faulting based on how many
faults a cache has handled.

Change-Id: I4ecd7cf46b794c51acac87184fef49ea5ce76743
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8873
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2025-01-28 21:23:38 +00:00
Augustin Cavalier
1be0d390db kernel/slab: Simplify arguments of create_object_cache().
* alignment, cookie, constructor, destructor are rarely used
   (in fact constructors/destructors are never used at present.)

 * Add flags argument, this is more commonly used.

This allows a lot of the invocations of create_object_cache_etc
to be changed to invocations of just create_object_cache, simplifying
the code significantly.
2025-01-27 12:51:12 -05:00
John Scipione
bd2d95cf90 InterfaceDefs: Reorder enums in ascending order, show gaps
Change-Id: I926d0f02e74ea97c302bc4d1794819b60be2874b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8864
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2025-01-27 17:19:49 +00:00
PawanYr
c1b2086dfd Input: add touchpad speed, accel, and scroll settings
See #17265; adds speed and acceleration sliders, as well as a reverse
scroll option. Tested on a Dell XPS 15. Only affects touchpad prefs,
not mouse prefs

Also, fix issues where revert button wasn't being enabled sometimes
when it should have been.

Also, switch to using a BMessage to store touchpad settings in their
file.

(a previous version of this patch added only the scroll setting)

Change-Id: I4d5ed3fadfd5bae1f7b686c904959f6e168b84a0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8756
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: John Scipione <jscipione@gmail.com>
2025-01-26 22:47:31 +00:00
Augustin Cavalier
414774d79f kernel/vm: Rename VMCache::HasPage to StoreHasPage.
It checks whether the page or page's data is present in an underlying
"backing store", not whether the page is present in the cache itself.

No functional change intended.
2025-01-22 16:19:33 -05:00
John Scipione
622853ff8e Appearance and Terminal: Move ColorPreview to shared
Move ColorListView and ColorItem to shared in BPrivate namespace.

ColorItem typedef to BPrivate::BColorItem for apps that are already
using this class.

Gravity screensaver:
* ColorItem => BColorItem.
* Use make_color() to set colors.

Make color drop message name agnostic, check for B_RGB_COLOR_TYPE.
Add be:sender and source to drag message.

Add _SetTermColors() convenience method to set colors on all tabs.

Change-Id: I5a9f55d3ab423ccaa341997cf444603373024553
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8846
Reviewed-by: John Scipione <jscipione@gmail.com>
2025-01-22 19:28:58 +00:00
Dru Satori
0db74e1ae1 intel_extreme: add support for Alder Lake chipsets.
Added AlderLake-P and AlderLake-N variants to agp_gart bus
and intel_extreme driver. Tested and confirmed working.

Change-Id: I1ac1e04fbba222a2f9eef483d68575665561e837
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8840
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2025-01-20 17:17:43 +00:00
John Scipione
9105063938 BTextView: Use document colors on AdoptSystemColors()
AdoptSystemColors() tints document background color to match panel
color if uneditable.

Calling MakeEditable() will automatically apply or unapply uneditable
background tint if you have previously called AdoptSystemColors().

Parent BView::AdoptSystemColors() sets panel colors, we want document
colors here. Do not alter text color - only view, low and high colors
are changed.

Document AdoptSystemColors() and MakeEditable() in BTextView docs.

Change-Id: Ib215735f27bb01fc2f95fcf2fee0185e5fc83f70
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8263
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2025-01-17 16:57:38 +00:00
Augustin Cavalier
f3f347f90d kernel & libroot: Drop wait_for_thread syscall in favor of wait_for_thread_etc.
We don't have many etc and non-etc syscall pairs in this file
(the semaphores seem to be a notable exception), so drop
wait_for_thread and just call wait_for_thread_etc instead.

This breaks syscall ABI, but we've already broken it since beta5
anyway.
2025-01-15 14:52:15 -05:00
Augustin Cavalier
7331a67227 kernel/util: Require passing a list_link to list_remove_link.
If something other than a list_link is passed, an explicit cast
will now be needed.

No functional change intended.
2025-01-14 17:30:36 -05:00
Augustin Cavalier
7d232f0cf8 kernel/image: Switch to using DoublyLinkedList<> for struct image.
No functional change intended.
2025-01-14 17:30:36 -05:00
Augustin Cavalier
9792c51694 kernel/elf: Use extended_image_info instead of reading runtime_loader structures.
This solves some TODOs and allows image_debug_lookup_user_symbol_address
to be dropped entirely. It should also fix reading symbols from binaries
that have multiple TEXT regions, and most functions are not in the first.
2025-01-14 17:30:36 -05:00
Niklas Poslovski
2f8543fe8c interface_kit/ChannelSlider: Fix binary compatibility breakage
Change-Id: I350c80baf7508a9db9a176e3ee050042fafa9321
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8828
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2025-01-13 20:07:35 +00:00
Augustin Cavalier
43b96dabf2 kernel/user_debugger: Add some padding/flexibility to debug_nub_message.
* Reorder a few messages, and add base numbers so that messages
   can be added in the future to all "sections" without breaking
   previous ABI.

 * Rename some messages for consistency.
2025-01-13 14:50:03 -05:00
Augustin Cavalier
2c9560581b Debug Kit: Restore support for symbol lookup by remote memory access.
It's been broken since clone_area was changed to block cloning of
areas without B_CLONEABLE_AREA set on them. We here introduce a
B_DEBUG_MESSAGE_CLONE_AREA debug nub message, which clones the areas
of the debugged team for the debugger.

Also fix some bugs in SymbolLookup::_FindLoadedImageAt methods:
they didn't work properly when *next was NULL, so they would
always fail when iterating over the full list.

Note that this technically breaks libdebug.so and the debugger
protocol ABI. However, nothing out-of-tree that I know of uses
the private libdebug.so, and while GDB does use the debugger
protocol, it doesn't actually use any of the messages past
the first block, so it should still work after this.

Fixes #15251.

Change-Id: I71ccbee4afd17dae30d5dacbc7590d1e2175a90e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8821
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2025-01-13 18:03:52 +00:00
Niklas Poslovski
08028803b1 interface_kit/ChannelSlider: Divide value by 1000 and show one digit after the point.
Fixes #17600

Change-Id: I4357655915270e0ed61f0ce305f299555578bb8b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8384
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2025-01-11 18:37:00 +00:00
Augustin Cavalier
8ecc31ca7b Errors.h: Add ESOCKTNOSUPPORT.
It's in POSIX.1-2024, see
https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/errno.h.html

Fixes #19347.
2025-01-08 11:35:35 -05:00
Augustin Cavalier
babcaa3c29 runtime_loader: Resize heap areas instead of creating new ones.
This is more efficient and works most of the time. Additionally,
we can potentially join with a previous free chunk in the allocator,
avoiding extra fragmentation on the heap.

app_server (on x86_64) only has 1 "rld heap" area after this change
with a size of 0x50000 (320KB), whereas previously it had around 7
with a total size of 0x80000 (512KB).
2025-01-07 17:30:29 -05:00
Augustin Cavalier
7137fc03b2 bootloader heap: Actually implement DEBUG_ALLOCATIONS.
The old define was really "check heap integrity", so it's split off.
In the userland test harness, this takes the total time spent in
the allocator from around 1ms to 14ms for all the allocations used
during a boot with "nightly" profile, so it seems acceptable to
enable it under KDEBUG.

Tested with both BIOS and EFI bootloaders, still works.
2025-01-07 17:30:28 -05:00
Augustin Cavalier
9bf3184b3c kernel/util: Merge the bootloader and runtime_loader heap implementations.
They were mostly copies of one another, save for the glue code
and a few other things. Now they're mostly unified, and this allows
the test to be greatly simplified, too, since it can avoid including
any bootloader code at all.

The heap implementation itself should have no behavioral changes
from before. Those will come in future commits.
2025-01-07 17:30:24 -05:00
Augustin Cavalier
6a75e767e6 kernel/team: Convert Team linked-lists into DoublyLinkedLists.
They were hand-rolled singly-linked lists before. This adds 24 bytes
of size to the Team structure, but turns all the removal operations
in parent and process group into O(1) operations instead of O(N) ones.
Realistically, the Thread linked-lists should be converted as well,
but this is trickier due to interdependence on the Team structure.
2025-01-06 23:39:40 -05:00
Augustin Cavalier
2b7da773ed app_server & libbe: Use server_read_only_memory for the colormap.
At present there's only ever one global one, so we don't bother using
an array for multiple screens (and we don't support multiple screens
yet anyway.)

This fixes a very old TODO, and avoids sending a ~32 KB port message
on every application startup.

Note that this breaks the app_server protocol ABI.
2025-01-06 23:39:39 -05:00
Augustin Cavalier
66f51cb3b9 kernel/team: Do not inherit anything from the kernel's IO context.
We already didn't inherit FDs, which meant that the only thing we
did meaningfully inherit was the table size. That meant that basically
no applications actually had a table size of the default 256, but all
were at the kernel's 4096 (except Tracker and anything started by it,
as Tracker resets it to 512), and also that basically all applications
had FD tables allocated with the raw allocator instead of the block
allocator, which isn't very efficient.

Since this reduces the default FD table size, some applications
might encounter problems. However, build systems and other such
tools should already increase this by default as needed, and it's
easy enough to patch in calls to setrlimit() if it turns out
some applications needed a higher default after all.

Also remove a redundant call to vfs_exec_io_context. Calling
vfs_new_io_context with the second argument set to "true"
already skips cloning CLOEXEC FDs.
2025-01-03 12:26:13 -05:00
Augustin Cavalier
d4a1fc648b kernel/vm: Drop VMCacheRef::ref_count.
Nothing touches it at all.
2025-01-02 21:32:44 -05:00
Augustin Cavalier
f44cb411cc Package Kit & packagefs: Allocate scratch buffers for decompression further up.
Zstd wants a ~90 KB scratch buffer to decompress our 64 KB chunks.
Rather than let it allocate that itself every time, pass in a 2*64KB
"scratch" buffer and statically allocate the working memory from it.
Pass it down using iovecs, and pass down the other buffers in the same
way, to reduce parameters.

Further, rework the object_cache used for heap decompression buffers
to contain objects sized as 4x64KB, so we only need to do one allocation
and deallocation for the compression/decompression and scratch buffers.
Set the minimum reserve to 1 so that the low-memory manager doesn't
reclaim this, as we'll need it when reading back data.

Improves packagefs I/O performance (and thus boot speeds at least a bit,
it appears.)

Change-Id: Id51f6f598b33b9d757a283184c533bb97049529f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8717
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-12-30 19:04:10 +00:00
Augustin Cavalier
7651b97c0a kernel/vm: Consolidate implementations of VMTranslationMap::UnmapArea.
This adds some new parameters to UnmapPage and UnmapPages. The important
one is a "_flags" pointer to UnmapPage, which if specified will be
filled with the page flags instead of PageUnmapped() being called
(and Flush() won't be invoked, either.)

This removes the remaining PAGE_STATE_* changes from VM architecture code.

Change-Id: Iacbc424dd8a75a79986edcd7f04d15a10f773c87
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8728
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-12-30 18:50:10 +00:00
Augustin Cavalier
fccefbf347 kernel/vm: Use allocate_early instead of passing a get_free_page method to early_map.
Simplifies things significantly.
No functional change intended.

Change-Id: Ia14c2ec72038ad6f8b56a14974dca78e1877063c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8725
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-12-28 14:47:32 +00:00
Augustin Cavalier
c5874ee428 kernel/vm: Make use of VMTranslationMap::PageUnmapped in UnmapPages.
An extra argument is added to allow the VMAreaMappings objects to
be added to a queue instead of freed directly (and the lock unlocked,
and so on.)

All architectures adjusted.

This means there is now only one place in each TranslationMap that
the page state and other data is directly adjusted (in UnmapArea).

Change-Id: I3ed2d6d969d1b1e235144a1035c90c750779af27
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8716
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: X512 X512 <danger_mail@list.ru>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-12-27 22:07:34 +00:00
Augustin Cavalier
c9fe6a1441 kernel/user_debugger: Remove declaration for _user_get_stack_trace.
The method itself was removed in 8f9d4cad459baf5e64271aeb92f451c5aba270a5.
2024-12-26 20:34:27 -05:00
Augustin Cavalier
8bb382decf kernel/vm: Drop vm_page_num_available_pages.
Nothing uses it, and it isn't correct anyway: vm_page_num_free_pages()
now includes cached pages, too, while vm_available_memory() includes
not just available memory pages but also swap.
2024-12-26 20:34:27 -05:00
Augustin Cavalier
18443c583a Drivers.h: Add B_SOCKET_IO_BASE declaration.
All the SIO... codes are in the 8900 range.

Change-Id: I7b319877d2430eba2573a0c8fd68cb7fc3b221d8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8693
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-12-21 17:00:00 +00:00
Augustin Cavalier
01e97ff280 KPartition: Drop SetParent().
A comment indicated it "must" only be called in Add/RemoveChild only.
So the field is just modified there now.
2024-12-19 17:21:04 -05:00
Augustin Cavalier
74ae79fed9 kernel/fs: Don't store the mount cookie in the KPartition.
Nothing uses it. If needed, it can be retrieved through the volume
(mount) ID.
2024-12-19 17:17:18 -05:00
Augustin Cavalier
04c8e27efa BDiskSystemAddOn: Remove the Flags field.
Nothing used it. Instead the kernel addons' flags are used instead,
except in the case of PartitionDelegate, which calls SupportedOperations().
2024-12-19 16:34:16 -05:00
Augustin Cavalier
87eae1e3c8 bootloader: Properly enable __PRINTFLIKE for the boot stdio.
No new warnings or errors, it appears.
2024-12-17 19:49:23 -05:00
Augustin Cavalier
f836917f47 kernel/vm: Rework ordering of _RemoveConsumer and drop "unmergeable" flag.
This reverts a8877df135c0395285945b11a75d57e10b7aecdf.

Previously, the "unmergeable" flag was necessary for the RAMFS,
because if the last vnode reference was released while there
was still a consumer (as the old ordering of _RemoveConsumer
had), then the release of the cache reference when the vnode
was removed would result in the cache trying to merge with
its now-only consumer and sole referrer.

Now, instead, we remove the consumer before releasing the store
reference, so that there's no chance the cache will be merged
inside this method.

mmap_cut_tests still pass, web browsers using ramfs shared_memory
still seem to work.
2024-12-17 19:12:40 -05:00
X512
8ea4167e8b kernel/vm: use DoublyLinkedList for VMCache areas list
Change-Id: I0c6a231f245fa542f5d90959755de1e6ba39eb8e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8685
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-12-17 17:53:47 +00:00
Jérôme Duval
04c90835ac POSIX: add pthread_getcpuclockid()
fix #15615

Change-Id: I6b34f97464fac97d0b339fa338cfc5df34536080
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8681
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2024-12-17 09:45:13 +00:00
Augustin Cavalier
d4d55c1fbb kernel/vm: Rename _FreePageRange "discarded" argument to "freedPages".
Clarifies things. No functional change.
2024-12-16 22:06:06 -05:00
Augustin Cavalier
e52dd571d9 bootloader: Make releasing the heap the platform loader's responsibility.
Otherwise, platform loaders couldn't make heap allocations inside
platform_start_kernel(), which some loaders (e.g. EFI) do.

Implement calling heap_release() for the BIOS loaders at least.
This gets us back the ~1.5MB of bootloader heap memory there.
2024-12-16 13:36:39 -05:00
PulkoMandy
a38c3c0384 serial/tty: fix handling of custom baudrates
Fixes the code I introduced in hrev50114 for custom serial port
baudrates. The idea there was based on FreeBSD implementation, but I
missed a key detail: speed_t in BeOS (and Haiku) is only an 8 bit value.
Note that BeOS does not have c_ispeed and c_ospeed fields, instead they
are named c_ixxxxx and c_oxxxxx with a comment in termios.h saying that
they are not used. So the renaming and moving of these fields isn't a problem.

This means the previous code worked only for speed between 20 and 255
baud, quite the opposite of what I wanted to do, which is to enable
access to fast baudrates.

This new implementation exploits the fact that tcflag_t is 32 bit, but
we never actually use more than 16 bits. Therefore, the high bits of
each value were unused, and can be reclaimed to store the speed,
by changing tcflag_t to 16 bits. The speed is then inserted as two 16
bit values that can be combined as a 32 bit one. The flag bits are not
moved (on little endian systems), and the extra values are guaranteed to
be set to 0 by any previous code that was compiled with 32 bit tcflag_t.

Support for different speeds for input and output is now also possible
(POSIX specifies separate functions for setting the input and output
speeds, which is useful for some old terminals and modems, where it was
useful to have a high baudrate for data to display on the screen, but
things typed on the keyboard aren't quite as fast). If desired, we could
now properly implement this in our serial drivers, but it isn't done
here yet.

Additional changes:
- speed_t is now a 32bit type, allowing to pass large values to
  cfset(i,o)speed
- fix some places where a baudrate enum value was incorrectly put in the
  c_ispeed and c_ospeed fields, this is not how they were meant to be
  used (it meant the default was to use a speed of 0, that means "hangup"
  the line, which I think no serial driver really implemented).
- do not put baudrate enumeration values in c_iflag and c_oflag, they
  are meant to be used in c_cflag only, and conflict with other bits.
  Separate speeds for input and output can be done by setting the
  c_cflag value to CBAUD (indicating custom baudrates) and then setting
  the values in c_ispeed and c_ospeed.

Fixes #18483

Change-Id: If63a24b5ced5edf6d051d921197db194def0c614
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7068
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2024-12-14 12:29:05 +00:00
Augustin Cavalier
038d9b44d1 kernel/listeners: Use an rw_spinlock for the gWaitObjectListenerLock.
When the system profiler is in use, this spinlock is used very often.
Internally there's another spinlock which isn't (yet) rw, though.
2024-12-13 17:17:43 -05:00
Augustin Cavalier
5a39b9f82f kernel/vm: Remove unused "no_cache_change" member from VMArea. 2024-12-13 17:14:46 -05:00
Augustin Cavalier
d00cb444a6 kernel/vm: Decommit discarded pages of overcommitted caches.
Overcommitted caches should only have commitments equal to the
number of pages they actually contain, so we should decommit
whenever pages are discarded.

This changes the API of VMCache::Discard to return an ssize_t
of the size of pages that were discarded (or a negative error on
failure.) Nothing checked the return value besides things in VMCache
itself, it appears; but it apparently never fails, so that's fine.

Also add asserts to Commit() that the new commitment at least
encompasses all pages the cache actually contains.
2024-12-13 15:08:45 -05:00
Augustin Cavalier
e7af1dd2e0 kernel/vm: Introduce VMCache::CanOvercommit().
Allows the Anonymous caches to report overcommitting status.
2024-12-13 14:25:40 -05:00
Augustin Cavalier
be88b511d7 kernel/vm: Remove an unneeded and misplaced include.
VMArea.h is already included at the top of the file.
2024-12-11 14:13:36 -05:00
Augustin Cavalier
27e83b8be8 input: Adjust input_pointing_device_subtype enumeration and usages.
Follow input_device_type above: we don't have _TYPE or _SUBTYPE on
the end, but _POINTING in the middle, because these aren't in a global
"subtype" enumeration, but a B_POINTING_DEVICE-specific enumeration.

Also don't bother adding the UNKNOWN type to messages that have no
type; if it's not included, UNKNOWN is implied. Saves a few CPU cycles.

Change-Id: I9088b9fcee63bf001b43febbe1e3ac17eb1792b4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8635
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-12-11 19:11:45 +00:00