While debugging some problems on the HaikuPorts build VMs, mmlr
noticed their clocks had an alarming amount of drift. This prompted
an investigation into TSC calibration mechanisms, and the discovery
that there is a VM-specific one which we did not implement.
This mechanism is more accurate than counting cycles on VMs where
cycles can be "stolen" (the probable cause of the aforementioned
clock drift.)
Tested in VMware (works out of the box) and on QEMU/KVM
(may need TSC frequency specified or a host with invariant TSC.)
Change-Id: I4ccfdb2e4e2621404ec9026e7106c02bf96faf18
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7063
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
* Solves a few "Unknown connector" errors on newer cards.
* It's just another physical name for DisplayPort
Change-Id: I37a6f1bb1db66279b305bdbce3c200612eac1130
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7042
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This undoes fc7864091e.
It was only ever used by the FreeBSD compatibility layer,
only supported one structure, and created problems with
concurrent builds.
Fixes some PTE concurrent access bugs.
Change-Id: I09ec56861fae389a8a3e228b17a3921b85202c8b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6949
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Attribute is ignored for now.
It is supposed to check ABI compatiblity and reject loading incompatible images.
Haiku currently do not use multiple ABIs for RISC-V so it is safe to ignore attributes.
PT_RISCV_ATTRIBUTES program header is produced by default in GCC 13 and Clang 17.
Change-Id: I4659e9bacbf34a2a0bc16b34c2aaa37232d700fa
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6948
Reviewed-by: David Karoly <karolyd577@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
This switches the application over from using basic
authentication to using token-based authentication in
preparation for later using Open-ID based
authentication flows. The application version is also
bumped in order that the server can detect this version
at some later date in the future when it no longer
supports basic authentication itself.
Change-Id: I7addde1d57503c58d6bcd54908f22f66830c0c59
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6944
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
* Replace count_low/count_high with bigtime_t fields plus an int32.
sizeof(spinlock) is now 32 bytes with the debug option enabled.
* Adjust and clean up all spinlock code to use the new fields.
* Fold DEBUG_SPINLOCK_LATENCIES into the new code. Remove the bootloader
option and other flags for it (these were not compiled in by default.)
The new code should be much easier to understand and also more powerful.
However, the information transmitted to userland isn't as useful now;
the KDL command output will have the interesting information.
(Things could be reworked to transmit more interesting information to
userland again if desired, but as this code clearly hadn't been compiled
for many years, as it referred to global spinlocks that have been gone
for a very long time.)
Change-Id: I2cb34078bfdc7604f288a297b6cd1aa7ff9cc512
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6943
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Only the x86 and PPC implementations look like they would have worked,
while the builtin is available and will work across all architectures.
We already use it unconditionally in some parts of libroot.
Change-Id: I2dffb3b2c7cdd605092382b9d649151adb921bb4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6942
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Our features.h does not define __USE_GNU, and so applications trying
to use this GNU-ism would have to define it for themselves, even if
_GNU_SOURCE had already been specified.
BSlowContextPopup was mostly a duplicate class of BNavMenu
only on top of BPopUpMenu instead of BMenu. Now, BPopUpNavMenu
just subclasses BNavMenu and adds the few features of BPopUpMenu
neccessary.
Drag-and-drop of files using the pop-up nav menu seems to still work fine.
Change-Id: Ic1f49c5bed60fff7a3076a22f74aebc6eba51d57
As part of adding perspective transformations, agg_trans_perspective.h
was patched to fix a multiple definitions error. This change has been
submitted for review to the "upstream" repositories at [1], [2],
and [3].
Also includes various other improvements such as VertexSource being
split into its own file, code style improvements, and documentation
improvements.
[1] https://sourceforge.net/p/agg/patches/6/
[2] https://github.com/ghaerr/agg-2.6/pull/9
[3] https://github.com/aggeom/agg-2.6/pull/7
Change-Id: I4bffd2f87354bde10155e23145a232a925be6ff3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6801
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
The new version has many more features than the old one. This update
is necessary for an upcoming update to Icon-O-Matic adding perspective
transformers.
This update is pulled from https://github.com/ghaerr/agg-2.6 at commit
e7db22bd12700118257b4cb780539c421e01aa51 with our changes applied on
top. Note that this repository isn't necessarily the chosen upstream
that all future updates should be pulled from. See the discussion
starting at [1] for more information.
This also updates the affine transformation since the newer perspective
transformation requires the newer version.
[1] https://discuss.haiku-os.org/t/gsoc-2023-progress-on-perspective-transformation-haiku-project/13594/34
Change-Id: Ic578eec15fbb9131338b3c605c737ce1bfb252ca
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6808
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
on x86_64 implemented with rdtscp or rdpid, generically with a syscall.
Change-Id: I8f776848bf35575abec8a8c612c4a25d8550daea
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6866
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Implemented `UnixBufferQueue::SetCapacity` so that `setsockopt`
with `SO_RCVBUF` will not always return an error.
Change-Id: I2d9be84633f84474fac64b379e9f89ef2751a094
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6816
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
* Check fFirst/fLast instead of previous/next. Avoids
list corruption when trying to remove already-removed
elements, instead will cause null-dereference KDL.
* Always set next/previous to NULL even when DEBUG is not
enabled.
It only supports file descriptors and processes (threads),
and a few flags (not all) to go with them.
This has been tested extensively against libuv.
Change-Id: I6fc5930fa7273698172c9c695965842b5df44f03
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6746
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Based on hamishm's original patch from 2015, but heavily modified,
refactored, and reworked.
From the original commit message:
> When an object is deleted, a B_EVENT_INVALID event is delivered,
> and the object is unregistered from the queue.
>
> The special event flag B_EVENT_ONE_SHOT can be passed in when adding
> an object so that the object is automatically unregistered when an
> event is delivered.
Modifications to the original change include:
* Removed the public interface (syscalls remain private for the moment)
* Event list queueing/dequeueing almost entirely rewritten, including:
- Clear events field when dequeueing.
- Have B_EVENT_QUEUED actually indicate whether the event has been
appended to the linked list (or not), based around lock state.
The previous logic was prone to races and double-insertions.
- "Modify" is now just "Deselect + Select" performed at once;
previously it could cause use-after-frees.
- Unlock for deselect only once at the end of dequeue.
- Handle INVALID events still in the queue upon destruction,
fixing memory leaks.
* Deduplified code with wait_for_objects.
* Use of C++ virtual dispatch instead of C-style enum + function calls,
and BReferenceable plus destructors for teardown.
* Removed select/modify/delete flags. Select/Modify are now the same
operation on the syscall interface, and "Delete" is done when 0
is passed for "events". Additionally, the events selected can be fetched
by passing -1 for "events".
* Implemented level-triggered mode.
* Use of BStackOrHeapArray and other convenience routines in syscalls.
Change-Id: I1d2f094fd981c95215a59adbc087523c7bbbe40b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6745
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Explicitly hide some BAlert functions that ought to have been
deleted. This prevents binding generators from thinking that these
functions are available, causing undefined symbol errors during
link time.
Change-Id: I56f53808851b82a10f31015d2351d4e2c29b6f33
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6718
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
ASID allocation is not supported yet, so always use ASID 0 for user pages for now.
Change-Id: I021e77dae692c22984bc625dd0588362bece45b7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6698
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Make Haiku headers a bit more friendly to binding generators by:
- Giving some `enum`s names (especially those that appear in
default arguments).
- Converting an internal `inline` function into a macro so that
the result could be evaluated in compile time.
Change-Id: I770674ad8fa7b24ac30b6b447d52a4b4c2530b8a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6716
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
gcc 13 is confused by the custom bitset implementation, so use the C++
standard one instead.
However, this results in including the C++ <string> header in kernel
code. This doesn't work for gcc2, because of two problems:
- That header includes a declaration of atomic_add that doesn't match
the one in SupportsDefs.h (which can in some cases replace the function
with a #define for an inline version). Adjust the header to use the
be a problem because it creates a risk of circular inclusions.
Standard C++ headers shouldn't depend on BeAPI ones.
- It also leads to the inclusion of iostream which defined lock and
unlock functions in the global namespace. We don't want these, and they
are not part of the C++ standard, so just remove them.
Ideally we could use std::hash for the GetHashCode implementation, but
that doesn't work because it depends on an helper function that's in
libstdc++, and we can't link that from kernel add-ons.
Change-Id: Iee07280beb4dddf7a9b6160e37f3b816e4de89ae
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6663
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Previously this just turned the rw_lock into the equivalent of a
recursive_lock, which meant that reader vs. writer assertions
were of no use.
Now, we have a per-thread static array which stores the held read
locks, allowing ASSERT_READ_LOCKED_RW_LOCK to work properly,
and allowing multiple readers to be active at a time.
This probably should still remain disabled even on nightly builds,
but at least it's much more useful as a debugging tool than it was
beforehand.
Change-Id: I386b2bc2ada8df42f4ab11a05563ef22af58e77f
GCC 13 is more strict about what C++ features are available in a freestanding
(= build without standard library) build. The `stdlib.h` and `math.h` headers
are redefined as part of libstdc++. If the object is built as freestanding, it
should be assumed that none of the standard library functions are available.
The solution in Haiku has been to add part of the standard library into the
kernel shared object. The method of exposing them has been to allow the
use of `stdlib.h` and `math.h` in the kernel and in kernel add-ons.
This change allows that approach to continue. What it does, is that it defines
specific headers which will be picked up when a module is built using private
kernel headers. When building for the kernel (or for the boot module), it will
bypass GCC 13's libstdc++ default behaviour of not including the POSIX/platform
header with all the function definitions.
An alternative to be considered for the longer term is to specifically define
the parts of the C/C++ standard library that is available in the kernel in
these headers, or create custom headers when building kernel modules (which is
how Linux approaches it).
Change-Id: Icab4614f642219fa77732b02401570708ee9a963
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6645
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
- Resize the `page_protections` array in `cut_area` and also shift
the bits if necessary.
- Set the correct protection array as well as the real page
protections for the second area produced by `cut_area`.
Change-Id: I62293480487e869420ebe5a3bc729cec2a14c687
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6395
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This requires the introduction of the flag B_USER_MUTEX_SHARED, and then
actually using the SHARED flags in pthread structures to determine when
it should be passed through.
This commit still uses wired memory even for per-team contexts.
That will change in the next commit.
GLTeapot FPS seems about the same.
Change-Id: I749a00dcea1531e113a65299b6d6610f57511fcc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6602
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
* Introduce SWDBM flag similarly to the arm64 port
* Reuse TEX[2] for SWDBM flag which should be availble
to be used by the operating system if TEX remap
is enabled.
* Introduce SetAndClearPageTableEntryFlags for updating
accessed and modified flags atomically
* Startup sequence is handled similarly to accessed flag, i.e.
set Modified flag in initially mapped pages in bootloader and early map.
* Once the kernel initialization has progressed enough,
pages are mapped as read-only and modified flag handling is done
in the page fault handler.
Change-Id: I8f761e2c6325d1b91481abd569d5e8befded0761
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6518
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Condition variables are now a pretty common way the kernel blocks threads.
That means the "threads" command was getting difficult to navigate, since
at any given time, a lot of threads could be blocked on "cvar".
Now we try (carefully, because it could fault!) to fetch the first 4
characters of the "type" name and display then. This suffices to
distinguish the most common object block types in the list at a glance
(e.g. "cvar:port" for port reads, the most common.)
Change-Id: I94f4b59fd78b7ebdce913944551a5e98f0ca2e33
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6605
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This allows to see the display in Screen preferences, and know its DPI
and physical size (as much as EDID data can be trusted). This
information could be used to compute the default font size, for example,
so it's important that all drivers provide it whenever possible.
Change-Id: Ic3d04e53cf5fcb24e22d35661d2b364a257947da
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6576
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Suppose the following scenario:
1. Thread A holds a mutex.
2. Thread B goes to acquire the mutex, winds up in kernel waiting.
3. Thread A unlocks; first unsets the LOCKED flag.
As WAITING is set, it calls the kernel; but instead of processing
this immediately, the thread is suspended for any reason (locks,
reschedule, etc.)
4. Thread B hits a timeout, or a signal. It then unblocks in the kernel,
which causes the WAITING flag to be unset.
5. Thread C goes to acquire the lock. It sets the LOCKED flag.
It sees the WAITING flag is not set, so it returns at once,
having successfully acquired the lock.
6. Thread A, suspended back in step 3, resumes.
Now we encounter the problem. Under the previous code, the following
would occur.
7. Thread A sees that no threads are waiting. It thus unsets the LOCKED
flag, and returns from the kernel. Now we have a mutex theoretically
held by thread C but which (illegally) has no LOCKED flag set!
8. Some other thread tries to acquire the lock, and succeeds, for LOCKED
is not set. We now have one lock owned by two separate threads.
That's very bad!
The solution, in this commit, is to (1) switch from using "atomic_or"
to lock mutexes, to using "atomic_test_and_set", and (2) mandate that
_kern_unblock_mutex must be invoked with the mutex already unlocked.
Trying to solve the problem with (2) but without (1) produces other
complications and would overall be more complicated. For instance,
all existing userland code expected that it would set LOCKED, but then
check LOCKED|WAITING. If _kern_mutex_unlock does not unset LOCKED,
then whichever thread sets LOCKED when it was previously unset is
now the mutex's undisputed owner, and if it fails to notice this,
would deadlock.
That could have been solved with extra checks at all lock points, but
then that would mean locks would not be acquired "fairly": it would
be possible for any thread to race with an unlocking thread, and
acquire the lock before the kernel had a chance to wake anyone up.
Given how fast atomics can be, and how slow invoking the kernel is
comparatively, that would probably make our mutexes extremely "unfair."
This would not violate the POSIX specification, but it does seem like
a dangerous choice to make in implementing these APIs.
Linux's "futex" API, which our API bears some similarities to, requires
at least one atomic test-and-set for an uncontended acquisition,
and multiple atomics more for even the simplest case of contended
acquisition. If it works for them, it should work for us, too.
Fixes #18436.
Change-Id: Ib8c28acf04ce03234fe738e41aa0969ca1917540
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6537
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
pthread_barrier_wait can return errors, which on Haiku are negative
and so -1 is an error condition, it should not be reused for a magic
constant.
This breaks ABI. However, until the recent fixes, barriers were so broken
that I doubt any application was using them seriously (Mesa, for instance,
has them disabled.)
Change-Id: Ica23921de012a33e9e7aded816bb1347bd157b31
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6517
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>
Reviewed-by: X512 <danger_mail@list.ru>
Pages should not be marked as accessed when initially mapping them.
However, there's a short interval during kernel startup when new pages
are mapped but the fault handler is not installed yet.
Therefore, we set Accessed Flag to 1 in early_map.
Once the kernel initialization has progressed enough, we start mapping
new pages with Accessed Flag set to 0.
The chicken and egg problem of initially mapping the vector page is
tackled by preallocating the vector page in the boot loader.
Change-Id: Ie3be4f81812d7a090af57e8c79420598d16182b9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6450
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
We must do this to prevent lock order inversion: when busses are
initialized, they are started by the (locked) device manager, and
then acquire the explore lock. We must do the same in Explore itself,
for when called by the explore thread, we would otherwise first acquire
the explore lock, then (when publishing new nodes) acquire the device lock.
Should fix #18421 and #18393.
- Resize the `page_protections` array in `cut_area` and also shift
the bits if necessary.
- Set the correct protection array as well as the real page
protections for the second area produced by `cut_area`.
Change-Id: I62293480487e828970ebe5a3bc729cec2a14c687
- Add support for retrieving the `siginfo_t` structure of a signal
event from the Debugger API.
- Add code to `strace` to display this information every time a
signal event occurs, similar to the Linux `strace` tool.
Change-Id: If4e92bbae049ee0b52efaf9fc911d66511da62f4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6393
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Introduce a new utility method, "generic_memcpy", which takes
generic_addr_t plus indications of whether these specify virtual or
physical addresses (and potentially user addresess) and calls the
appropriate memcpy variant depending.
All bus drivers adjusted to support this at once. We don't actually
take advantage of the physical addresses in any way (yet), as USB
controllers have some pretty specific requirements that would have
to be carefully validated to use these directly.
All bus drivers tested and confirmed to still be working.
Change-Id: I66326667e148091147bb2b3d0843a26fb7e5bda6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6479
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This way it is more easily accessed from drivers outside the kernel,
which it soon will be, without having to add an explicit UseHeaders.
(The drivers that use it already all use the IOScheduler.)
No functional change.
Change-Id: Ibc2d2678e37d9d7ab73391cb17b72cca86f92132
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6477
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Before the PCI refactor, PCI initialization/enumeration occurred
immediately after the PCI module was loaded, and so by the time
we got to IOAPIC initialization, it was already complete.
After the refactor, PCI enumeration is deferred until slightly later,
and so we would try to initialize IO-APICs without knowing PCI
information. This would fail, as read_irq_routing_table needs to
have that available.
Hopefully fixes #18425, #18393, #18398.
Change-Id: I1e4b06367da26eeb10085a1c6322ed39885b632b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6476
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Allow to easily access the alert icons and anything that's added to app_server
resources.
Fixes #10887.
Convert BAlert, Debugger AlertWithCheckbox and Keymap ModifierKeysWindow
to make use of it, removing the duplicate code to locate app_server
resources.
The resources are initialized only once (per application), so there is no need
to reload them for every access to the icons.
In the ticket there is discussion about putting this in BControlLook,
but I think this should in fact be moved fully into app_server with
special drawing commands for well-known icons. That would avoid loading
and rendering the icon on the application side to then send it to
app_server (especially in remote_app_server case)?
In any case, this simple API can serve as a base for applications to
use, and we can change how it is implemented later on.
Change-Id: Id370526ae5cf165cfb8bc277bc8a7f46c26f542d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6463
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
We did not ever implement these, it seems, and so they are just
cluttering up the global namespace.
Change-Id: Ib37c3a31663525a18268c9bfe326bfba9afbc794
- Stored the additional start time of each team, expressed by
milliseconds since boot.
- Added more fields to the `team_info` structure. These field
include those provided by the `get_extended_team_info` syscall as
well as the newly introduced `start_time`.
- Extended the `_kern_get_team_info` system call to receive an
additional `size_t` argument. If this size is smaller than or
equal to the size of the old `team_info` structure, the newly
added attributes will not be retrieved.
Change-Id: I22ee6b91ad2ee3b66a7f770036c79a718c5f115c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6390
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
Implemented exclusive mode on Haiku and added the related `ioctl`
operations (`TIOCEXCL` and `TIOCNXCL`).
Change-Id: Iaa201ea20eec0e45d02dd5db9ba6aa35fd27dfb2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6387
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
This new driver uses the "generic" TTY layer, unlike the old driver
which had its own implementation (which the generic module was derived
from, originally.)
The remaining bits of support for controlling TTYs is added to the kernel &
generic layer at the same time, which should allow for serial interfaces
to be controlling terminals now, as well.
Tested with bash, nano, vim; all seems to still be working as expected.
Exported `pthread_attr_get_np` under `_DEFAULT_SOURCE`. Otherwise,
the presence of this function in `libroot.so` without a definition
would confuse some configuration scripts.
Change-Id: I623ebefc98800e9528dc48859c2aefc828821f27
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6383
Reviewed-by: Jessica Hamilton <jessica.l.hamilton@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
I want to use this in at least 2 third-party applications. I think it's
time to make it shared?
Change-Id: I855a59aab4ad6d47d77cf2901cb3dfc34c108059
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6296
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
THREAD_BLOCK_TYPE_OTHER implies the "object" pointer in the
wait information is a string. But sometimes we want to pass
through objects which are not strings, for inspection in KDL.
Remove ConstrainClippingRegion calls as they do not take into
account view transformations.
Clip drawing to the drawing rect, not the updated area.
Fixes #12890
Change-Id: Ie76cb83e0af03213008da78407de25261daea5df
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4457
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
busses/pci/x86: add
Other add-ons are in following commits.
Change-Id: I7a77bfaef0e8995917b4b54c8369d7075533ec26
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6220
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
See #18351 for details on the specifications.
This is the same thing NetBSD does. BeOS R5 defined these values
differently than we did even before this commit, and it does not
seem to have caused problems then, so this should be fine.
While technically an ABI break, in practice these values are not
always differentiated on other platforms, and it appears musl's
code triggers divide-by-zero exceptions on purpose before it
returns this value, anyway.
Fixes #18351.
* Make some code common in Insert.
* Remove unneeded logic from InsertAfter and just call the base Insert.
InsertBefore does this, already.
* Synchronize Insert code and APIs in the fs_shell DoublyLinkedList.
Removing it outright would cause implicit conversions and then the other
variant being called, which would create invalid lists. So make it private
so that any attempts to use it will create errors at compile-time.
As far as I can tell, it has no consumers whatsoever outside the tree.
(wpa_supplicant did not even use it.) So, remove it altogether.
If that turns out to be mistaken, we can reinstate it temporarily
as a private class function or ABI-only symbol.
Since we used a hash table with a fixed size (1024), collisions were
obviously inevitable, meaning that while insertions would always be
fast, lookups and deletions would take linear time to search the
linked-list for the area in question. For recently-created areas,
this would be fast; for less-recently-created areas, it would get
slower and slower and slower.
A particularly pathological case was the "mmap/24-1" test from the
Open POSIX Testsuite, which creates millions of areas until it hits
ENOMEM; it then simply exits, at which point it would run for minutes
and minutes in the kernel team deletion routines; how long I don't know,
as I rebooted before it finished.
This change fixes that problem, among others, at the cost of increased
area creation time, by using an AVL tree instead of a hash. For comparison,
mmap'ing 2 million areas with the "24-1" test before this change took
around 0m2.706s of real time, while afterwards it takes about 0m3.118s,
or around a 15% increase (1.152x).
On the other hand, the total test runtime for 2 million areas went from
around 2m11.050s to 0m4.035s, or around a 97% decrease (0.031x); in other
words, with this new code, it is *32 times faster.*
Area insertion will no longer be O(1), however, so the time increase
may go up with the number of areas present on the system; but if it's
only around 3 seconds to create 2 million areas, or about 1.56 us per area,
vs. 1.35 us before, I don't think that's worth worrying about.
My nonscientific "compile HaikuDepot with 2 cores in VM" benchmark
seems to be within the realm of "noise", anyway, with most results
both before and after this change coming in around 47s real time.
Change-Id: I230e17de4f80304d082152af83db8bd5abe7b831
Change-Id: Ia16e66a7bdac37019e6256405b9f10024909c69a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6215
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
The kernel heap only uses object caches for objects up to size 8192.
Larger allocations have to go through the raw allocator. That can
get pretty expensive.
Adding instrumentation around the malloc/free calls in this function
showed that on my machine, some 596ms during boot were spent on
*malloc/free alone*, all else aside. After this change, we are at
around 110ms, or a >5x improvement. Running an fgrep -R on /system/
after boot increased the cumulative time in memory functions to over
5 seconds, while after this change it is "only" 1170ms.
Honestly, it seems like the object depots should be able to be faster
than that, even if this function is called thousands of times. But that
is a problem for a different investigation.
It would be even faster for every consumer of this data in
packagefs just allocated one set of buffers up front, or at least
for a single "read session", but plumbing that all the way
through the myriad abstractions of the Package Kit will
not be easy, and is left for another time, as well.
While the BSDs and glibc seem to have various _r functions,
they all return int for errors instead of a pointer, making ours
exactly backwards of theirs for error reporting and thus useless.
So, remove them from the header entirely. They are left in
for ABI backwards compatibility for the time being.
A few constants not used by anything in the tree (i.e. not actually
implemented by libnetwork/netresolv) were also dropped. Some deprecated
or non-standard functions were placed behind _DEFAULT_SOURCE or deleted
entirely.
The header itself is now organized approximately as the BSDs do,
although with various Haiku-isms instead of BSD-isms where appropriate.
In fixed size mode, the menu field always uses all the available width.
In non-fixed size mode, the menu field will resize itself to be as small
as possible.
With layout, usually the difference isn't noticeable, since the layout
will already try to resize the control to the smallest possible size.
But there are a few cases where it makes a difference, when the layout
is over-constrained and the menu field can't be made as small as
possible. In that case, the menu field would be forced to fill its
allocated space, where we can instead make it a little smaller.
Change-Id: I911d497218a09aab3824865968558df5d4b3cf98
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6076
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: John Scipione <jscipione@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
These were introduced by mistake during the addition of the layout
system. They have been private since 2011. It seems safe to assume that
nothing uses them anymore and they can now be removed safely.
Change-Id: I98d030096f9cb06fccc25233fe4da17d0213050e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6075
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
BSD extension to set both the input and output speed of a termios
structure.
Fixes #18220.
Change-Id: I8c4a06b4be4aa55b8ce35cb7f62552fc47a8e8d0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6049
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
..instead of readv_pos/writev_pos. This way, we can be sure that we
are remapping them properly even under Haiku, as well as remove some
potential confusions.
bfs_shell seems to still work fine on a regular build.
They are not about reading and writing pages, but just iovecs.
As the passed iovecs use void*s, it can't possibly be working with
physical pages on 32-bit systems with PAE.
It appears nothing uses or implements these functions anyway,
as there was nothing else in the tree I had to adjust after making
this change...
* changed explicit locking to use Autolocker for gFontManager/fAppFontManager
in ServerApp, per comments in https://review.haiku-os.org/c/haiku/+/4790
* changed BFont::LoadFont (memory version) to use size_t for size and offset
* no functional changes
Change-Id: I438a4975d5bb1b2fa17bc54e9e171c31dadfeec5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6003
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
"Newer" synaptics touchpad support a new mode where they can report more
information to the host. In this mode, there is a different packet
format for tracking extra data from the touchpad, including a wheel
encoder (mousewheel) if available, and multitouch finger tracking.
This mode is documented in the Synaptics touchpad interfacing guide
(Synaptics document 511-000275-01 Rev. B), but was not yet implemented
in our driver.
It should help with detecting multiple fingers, or finger position on
clickpads to determine right or left click.
This change implements the following items from the Synaptics
interfacing guide:
- Cleanup and clarify the code for features detection to properly report
clickpads
- Enable "extended W" mode if supported
- Process extended W values 0 (mouse wheels, reported in the
touchpad_event structure and could be used by input_server for
scrolling), 1 (secondary finger), and 2 (finger count)
- Fix handling of wValue, which is not always a finger width
- Add handling of vValuen which indicates the finger width when wValue
doesn't
Overall, this should provide the movement_maker with a better picture of
what's happening.
Also improve tracing to show received packets and the corresponding
WValue since that's an important value in identifying which type of
packet it is.
Unfortunately I currently don't have a laptop with synaptics touchpad to
test this with.
Change-Id: If334392f4eb2a146955f6c8c897f0ab64d79b8d9
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4425
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: nephele <nep@packageloss.eu>
This is duplicated across multiple filesystems, and could probably be
used in more still.
Adjusted only BFS, EXT2, and NTFS in this commit, as they are the ones
which make use of fs_ops_support.h already and thus need to be modified
to avoid duplicate-definition errors.
Also tweak next_dirent to support being built under fs_shell.
(Possibly we should define ASSERT there, though?)
Compute a font size that just fits the available space, instead of using
an arbitrary scaling. This makes the code adjust to any font and any UI
size.
Select the appropriate font using a binary search, which will need only
a few attempts (I think 6 font sizes will be tried at the default
config)
Change-Id: Ie3b8678678c0d940981f1785418aa8ab354d01c5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3893
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This is needed to fix usage of POKE_GET_PHYSICAL_ADDRESS on
x86 32 bits (with PAE).
Change-Id: Ic00185ec7fcf9b6666ad6169a752d8b8edd2b61b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5975
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
This patch adds an API call to BFont, called LoadFont, that
takes a string path to a font file. The user fonts are managed
via a new class called AppFontManager that inherits from the base
class FontManagerBase but adds the methods to add and remove user
fonts from disk or memory. There is also a new method called UnloadFont
to remove a user font, but on exit of an app all user fonts should be
automatically cleaned up.
Global/system fonts are managed by the GlobalFontManager, which is
a new class that also inherits from the base class FontManagerBase,
replacing the old "FontManager" class.
A maximum of 128 user fonts may be loaded, and memory fonts
may not exceed 20MB.
There's also an overloaded version of LoadFont that accepts
an area_id and loads the font from memory. A size and offset may
optionally be provided to allow for an area that contains more
than just a font.
Change-Id: I6add42bdf0c0cefc0e2e2a4984fd848c3e7269e5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4790
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
* aborted transfers will release the notify semaphore when the cancel is notified.
* the allocated buffer would be freed on return, while the usb stack eventually copied
data in the buffer in our back, leading to KDL crashes, because the freed buffer would
be right reallocated for some kernel team structures.
* regression introduced by hrev55806, the transfers didn't need to be cancelled before.
Change-Id: Ifb6e941f71d05c37c36f878059c33883bb72a67c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5905
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
* We needed this previously due to our gcc2 compiled kernel.
* Now that our kernel is always latest gcc, we can move to the
c++20 syntax for inline assignment.
* Improves compatibility with clang, less GNU-specific stuff
Change-Id: Ib7272a0a52554a31e9a0e788fd3f031db9049795
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5898
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
we detect basically the cpu info before loading the microcode,
to be able to detect the vendor, and avoid any update on hypervisor.
I couldn't test because my cpu doesn't have any update available.
Change-Id: I6aea830158423b3ee13b640be8a788fc9041e23c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5859
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
the entropy source is read every second and pushed to the PRNG.
the PCI device is tested, not the ACPI.
Change-Id: I9bb6b21c7189b28a1d8a624d83b33ff6682152dc
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5825
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
tested on Zen2 (Ryzen 3 5300U)
This support was submitted in October for inclusion in Linux.
Haiku supports only two profiles. We could probably add some more, and let the driver says which it supports.
Change-Id: Id7754b445bc32a691d58a1e4af630351562abc22
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5826
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
remove the yarrow module. the hardware modules can push entropy with queue_randomness().
virtio_rng will now push entropy every 300 seconds.
helps with #14937
Change-Id: If76c5deabf61dc616a0e051332f44b89deb6b8a1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5824
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
There's currently no way for an application to convert between view and
drawing coordinates with a drawing states stack without keeping track of
all the transformations itself, which is not very convenient for helper
or library functions.
Handle other spaces too, for good measure.
Change-Id: Ic8404a1c111e273fff1eebf2f9f59f58246b796c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5775
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
C99 chapter 7.18.2, Limits of specified-width integer types:
"This expression shall have the same type as would an expression that is
an object of the corresponding type according to the integer promotions."
C99 chapter 6.3.1.1:
"If an int can represent all values of the original type, the value is
converted to an int; otherwise, it is converted to an unsigned int.
These are called the integer promotions."
Therefore, UINT8_MAX, UINT16_MAX, UINT8_C and UINT16_C should be signed.
This prevents building WebKit with -Werror.
Change-Id: Ib2a2c15acc2c761cccf8caa016c7ff163e3fdc0d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5806
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Fix regression that building Haiku on 32 bit Haiku become not possible.
Change-Id: I527a8c3bc3ad4744d5515a76888d5cac06293cbe
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5750
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
The overall design does not deviate much from my proof of concept [2] and that still makes a good read to
understanding the overall architecture. If you want to get a sense of how it is built up, the API comes with
full doxygen documentation for the public API [3], and I have also done a PoC change for HaikuDepot which is
useful as an illustration on what the impact for the user of the new library is. [4] There is also a test suite
that may give some insight into the day to day ergonomics of the API [5].
The current state is that I am fairly confident that many HTTP requests will actually work, but I do expect
rough edges with a protocol with this many diverse implementations. There is also a list of features yet to be
implemented on Trac [6]. Additionally, I still want/need to do performance testing.
The goal of merging the kit right now is to start making it available for more uses, and through that also give
a chance to shape its future. There are also some design decisions that need review, most notably I expect some
discussion around the uses of C++ 17 idioms (like std::optional and std::string_view) and around the use of
exceptions for error handling.
The impact of merging right now should be near zero: the netservices2 kit lives in its own header space, and
builds into its own static library (libnetservices2.a). It is not yet used in any of the apps in our
repository.
The branch does remove the deprecated services kit from the libnetapi.so library, though it leaves
libnetservices.a intact. After our previous announcement to remove it after beta 3, this should be expected.
[2] https://github.com/nielx/haiku-netservices-rfc/tree/exceptions
[3] https://git.haiku-os.org/haiku/tree/docs/user/netservices?h=dev/netservices
[4] https://review.haiku-os.org/c/haiku/+/5692
[5] https://git.haiku-os.org/haiku/tree/src/tests/kits/net/netservices2?h=dev/netservices
[6] https://dev.haiku-os.org/wiki/Development/NetServices2
Change-Id: I5d0b7e2619699f39a2506588417b57391f0f5cc2
* Nothing in the tree and few things outside it used BIG_{SPACING|INSETS};
it seems a value of 15px (at default font size) is not that useful.
There are, however, a lot of things around the tree that use multiples
of 20px. So, make BIG be that, with the intent to replace those
with BIG directly.
* Introduce CORNER_{SPACING|INSETS}. There are a lot of applications
(e.g. Tracker, Terminal, Debugger etc.) which use scroll bar width/height
to metrically align controls with the window frame or with some other
control which contains scroll bars. Rather than have to invoke
BScrollBar or BControlLook directly to get the value, we should just
derive the size of scrollbars from a spacing constant instead
and get rid of the custom function. (For now it is just replaced.)
This reuses the old values for BIG, as it is equal to 14px at default.
* Introduce BORDER_{SPACING|INSETS}. This is equal to the typical border
size of 1px at default font size (or lower) and uses floor() instead of
ciel() to compute what the size should be (i.e. it will remain 1px
at 150%/18pt and only go up at 200%/24pt.) This will allow a lot of
the hardcoded border sizes around the tree and elsewhere to use
ComposeSpacing() instead.
Change-Id: Iaea3fa30364859888e816a9d61ac156268d70758
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5702
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: nephele <nep@packageloss.eu>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This methods do not need DoublyLinkedList class state.
sGetLink field that actually implement GetPrevious/GetNext methods is already static.
Change-Id: Ie0b40f7f1b72d640d75403905b8944666874dc87
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5796
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit formats all the netservices2 code with the `haiku-format` tool from
https://github.com/owenca/haiku-format (commit aa7408e), with the following
customizations:
* SpaceBeforeRangeBasedForLoopColon is set to false
* Braces before a catch block are not wrapped
* Most headers, except for ExclusiveBorrow.h, have been manually reformatted
to adhere to Haiku's header format (issue #19 in the repository)
Change-Id: I693c4515cf26402e48f35d1213ab6d5fcf14bd1e
The GetNextNetwork() method is really inefficient: it fetches all the
networks at once from the kernel every single time and then winds
up returning only one of them. In parts of the GUI that iterate over
all networks more than once per refresh (sometimes within a loop, even!)
this was often a noticeable lag on the GUI, especially with OpenBSD
drivers which have extra overhead to do struct translation in the
ioctl handler.
Now, we have a way to fetch all scan results at once and just iterate
over them as many times as we need, and this is what NetworkStatus
and Network preferences now do, saving lots of time and effort.
- These two functions imported for Linux/BSD compability.
Signed-off-by: Han Pengfei <pengphei@qq.com>
Change-Id: I3e9cada26f1ed043bfaed83e8185dcfff3bd71e2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5746
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
for legacy and new drivers.
This is an opcode for ioctl that can be used on almost any device entry found in /dev.
When used, ioctl will fill a buffer with the absolute path to the driver file that is
being used by the device.
This opcode was available in BeOS R5, though remained unimplemented in Haiku since
the introduction of the Device Manager almost two decades ago.
Original change by Jacob Secunda.
Change-Id: Ic49141b677b4158a63918459d4048450c825447c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5078
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
* This seems to be required when building the DriveEncryption kernel
driver with gcc 11.2 on x86-64, at least.
Change-Id: Ie1ae09435dd912021957e64d4b9a3e7b05913c33
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5742
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
also only provide a default name for partition containing a file system
fix #17958
Change-Id: Ib5a8928dc5272a400a99aa05b792201f3a6a2c7d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5705
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This takes care of making sure the dirent buffer is properly aligned,
which it needs to be on some platforms (SPARC, ARM, etc.)
Change-Id: I9a6352b1e654c090a200770d51f96511ee024a99
only scsi_disk checks the actual value, other drivers take the logical block size.
This change reports the physical block size from the disk rather than the block
size used by IDE/SATA/SCSI commands. On typical modern SATA disks, the SATA
commands will use 512 byte blocks, but the disk will actually read and write
4K blocks internally. This is only of importance for partition alignment for DriveSetup,
and is independant of file systems or partitioning systems. This could also influence
the recommended block size for some file systems.
Change-Id: Id0f2e22659e89fcef64c1f8d04f81cd68995e01f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5667
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
This will give the same result as fs_stat_dev, so the filesystems will
have the same name everywhere.
Change-Id: Ic684142efaeb2c16b393f3f3e5c9c3010a054b30
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5636
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
The respective files can be found in the FreeBSD source tree at:
- lib/libstdthreads/call_once.c
- lib/libstdthreads/cnd.c
- lib/libstdthreads/mtx.c
- lib/libstdthreads/threads.h
- lib/libstdthreads/tss.c
Missing is support for PTHREAD_DESTRUCTOR_ITERATIONS.
Change-Id: I7a6c79954f36195eadd1351d308c21a001192232
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5675
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
This avoids introducing an entirely custom hook in FUSE.
It uses the ioctl hook in an unconventional way (calling it with no
valid fuse_file_info) but this can be fixed if a filesystem requires it
(by opening a file handle on /, doing the ioctl, then closing again).
An updated version of fusesmb-haiku is available and confirmed working:
https://github.com/haikuarchives/fusesmb-haiku
Change-Id: If1268113874363fa035e5340be75e9f5198216d6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5199
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Not referenced in any Jamfile, does not compile, untouched since
2003 except for a few coding style and cppcheck fixes. The functionality
is implemented elsewhere in the disk device manager and userland
filesystem add-ons for DriveSetup.
Change-Id: I5ebe125931c8d4410c2d335f9d6c0e32008f038b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5637
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
* 90% of our logs start with some context on what is
generating a log message (thing:)
* Things following this logging model however do "thing [time"
which is inconsistent
* Being consistent will allow us to start scanning logs in a
smart way and try to analyze patterns of what is throwing
errors, etc in an automatic way.
aka /^(service/driver/etc)\:/
Change-Id: I1ef2df4f17f70f858a485554a4e8a3f87f1a69c8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5568
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Oscar Lesta <oscar.lesta@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
This smart pointer is designed to help with putting some explicitness and
safety around the case where someone will use their own object that implements
the BDataIO interface to store the body of a network request. By default,
BDataIO objects do not require or enforce thread safety. Since accessing these
unsynchronized objects between two threads is undefined behavior, it should be
explicitly discouraged.
The BExclusiveBorrow/BBorrow smart pointer helper helps solve that by enforcing
the limitations on using an unsynchronized object in two threads. When used
correctly, there is a runtime check on incorrect use by the developer. This
should help write better code.
The design is based on shared_ptr, including having an admin block akin the
control block, that manages the internal object. This type-erased admin block
has the advantage that it allows the owner to have a different type than the
borrower. It also handles cases where the lifetime of the borrower is longer
than the owner: the borrower can continue to use the object until they want to
return it, after which it will be cleaned up. This will make it possible to do
some fire and forget pattern in the network services kit, where someone may
just wants to create a file and borrow it to the network request, and care
about further processing the file in the future.
Change-Id: Ie9b7e7472c868b60f663b4db4fa449d421e447eb
* set PXN for all page tables below KERNEL_BASE
* also set PXN for physical page mapper
PXN, Privileged execute-never
When the PXN bit is 1, a Permission fault is generated if the processor
is executing at PL1 and attempts to execute an instruction fetched from
the corresponding memory region.
Change-Id: I3056cbed151004ac9edfbc81ebeada328aeb603c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5607
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Use the Privileged Only Thread ID Register aka TPIDRPRW to store
the current thread pointer.
The Privileged Only Thread ID Register is only accessible
in privileged modes, and is read/write.
see: ARMv7 Architecture Reference Manual,
section B3.12.46 CP15 c13 Software Thread ID registers
Change-Id: I5273bee8a80b78cdc547b2f6c96632d120eb3d55
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5608
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This was a holdover from BeOS, which did this as inline assembly.
We do not on any platform other than 32-bit x86, and even there
we may have preferred to do things a little differently on non-BeOS
ABIs.
Most things ported from other systems, or even native apps, are going to
use _Thread_local variables anyway, which will bypass this system
altogether.
This takes an int32 (e.g. B_MINI_ICON or another constant) and
then returns a BSize scaled appropriately, the same as ComposeSpacing()
does already for the *_SPACING constants.
This will be used to replace icon size computations throughout the tree.
GICv2 can use interrupt numbers up to 1019:
* 0-15 are SGIs aka ICIs
* 16-31 are PPIs
* 32-1019 are SPIs
Change-Id: I1c19be77105683da3f6988a5607b14dc10a899db
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5565
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Now that we have locale_t, we can use the musl versions of these functions.
This also fixes a licensing issue: the strptime implementation had an
advertising clause (although in upstream *BSD it was removed, so we
likely could have managed to remove it anyway.)
These allow for additional messages about the progress/status of the request.
For now, the messages are sent unconditionally, though it may be reasonable to
in the future switch to sending them only when enabled.
Change-Id: Ic45a0055037af02c689494fa5ce0acd03592ad7e
... and B_WORKSPACES_CHANGED too.
hrev50148 propagated B_SCREEN_CHANGED messages to
children allowing them to respond to screen changes
fixing #8035 back in 2016.
This does the same thing for workspace messages only
I spelled propagate correctly this time.
Add private _PropagateMessageToChildViews() convinience
method to BWindow to do this work.
Call PostMessage() instead of calling MessageReceived()
directly which can work better in certain circumstances.
Change-Id: I5978c3fe674bbe75d9eafb7afb654a49ee3e0c11
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5516
Reviewed-by: Axel Dörfler <axeld@pinc-software.de>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This fixes a bug in the HttpAuthTest, and in general, moves responsibility of determining
the shape and size of the content to the right place.
Still to do is to fix the case where there really is a variable length content. This will
now probably error out as a connection closed error.
Change-Id: I13c20028e834cc9af8c7bc1d7d7613bf60838e64
should help with #17664
register change from Tahiti for #17377
Change-Id: I52b9691cd6a04b58b70e905bc29e803f06936789
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5526
Reviewed-by: John Scipione <jscipione@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
uselocale now attempts to create a backend and a databrige.
If the attempt fails due to a missing libroot-addon-icu, uselocale
does nothing (to support applications calling uselocale during
startup to enforce the C locale).
Else, uselocale will fail with ENOMEM.
LocaleBackend::CreateBackend() has been modified to return a status_t
that indicates whether NULL is returned due to out of memory (B_NO_MEMORY)
or due to being unable to load the ICU addon (B_MISSING_LIBRARY).
Change-Id: I0f62ebde5890364c64e6694ec58d38de43ec6841
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5505
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This change allows the user to control how many concurrent request can be done
per session. This is going to be helpful to running the tests as well; they were
all fired up in parallel, which sometimes leads to our test server refusing a
connection.
Change-Id: I4f1f40b28b8e0199ea5589b36cd8d00ecd849a63
The integration PostTest has a basic test that the expected messages are sent and
have the expected data fields. The gist is documented in book.dox.
To do are the messages around SSL. However, that functionality is also not
implemented yet, so there is nothing to send.
Change-Id: Ib8f36ed32f9854d643d8256338b71af7067059f0
- It is possible to call open() on a directory, but FUSE lowlevel
filesystems don't implement that and expect it to be re-routed to the
opendir call. BRoster uses this to read the dir/file attributes to
identify it, so it could not identify directories properly.
- In ReadDir, make sure to not return more entries than asked, as this
confuses the userlandfs protocol communication (the kernel does not
acknowledge the readdir reply, and then the server hits an assert when
receiving the next request instead of the ack).
Change-Id: I9c4e9a3f0fc6e9879d4cfbc0d5402a4733d2218a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5482
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
- Import latest version of files from FUSE 2.9.9 (our last
synchronization was with 2.7.4)
- Adjust fuse pkgconfig file to use the POSIX error mapper
automatically, since that's required for all FUSE software
- Implement the lowlevel API in addition to the highlevel one. The
lowlevel API uses inode numbers to identify files, rather than paths,
making it a better fit to the userlandfs architecture.
The FUSE 2.x branch is not maintained anymore by FUSE developers,
however, pretty much no one migrated to FUSE 3.x. So it is more
interesting to implement, rather than 3.x.
Confirmed still working with sshfs and curlftpfs.
Example use:
I tested this with github.com/whoozle/android-file-transfer-linux
- Build the fuse library and copy it to ~/config/non-packaged/add-ons/userlandfs/
- Start the server: /system/servers/userlandfs_server aft-mtp-mount
- Connect your Android phone and put it in USB file transfer mode
- Mount the device: mount -t userlandfs -p 'aft-mtp-mount /boot/home/MyPhone -d -o use_ino' ~/MyPhone
- You can now access your phone data
Change-Id: Ic3efda7ffbc33737e6f4958428fb3ec9939ef105
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5198
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This considerably overhauls touchpad event generation, simplifying and
cleaning it up considerably:
* Return the touchpad specifications through the MS_IS_TOUCHPAD ioctl.
* There is now a dedicated MS_READ_TOUCHPAD ioctl, as touchpads
can either return touchpad_movement structures or mouse_movement
ones depending on what mode they are operating in.
* Event repeating on timeouts is now handled in MovementMaker and
the input_server control thread, so MS_READ_TOUCHPAD takes
a timeout value. This means we can drop all the EventProducers.
* Use the real floating-point math functions in MovementMaker now
that we are running in userland.
* Drop unused structures, constants, headers, and other things
related to touchpad support.
Change-Id: I28cdb28e4100393a9338a8ebb865573cec13fc1e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5455
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Implemented the missing POSIX functions in <locale.h>:
newlocale, duplocale, uselocale, and freelocale, and also
provided missing type definitions for <locale.h>.
Implemented missing POSIX locale-based function variants.
Modified LocaleBackend so that it could support thread-local
locales.
Some glibc-like locale-related variables supporting
ctype and printf family of functions have also been updated
to reflect the thread-local variables present in the latest
glibc sources.
As there have been some modifications to global symbols
in libroot, libroot_stubs.c has been regenerated.
Bug: #17168
Change-Id: Ibf296c58c47d42d1d1dfb2ce64042442f2679431
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5351
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
This commit introduces a simple thread-safe ring buffer implementation
based on top of BDataIO. The main use case for this class will be to
implement shared buffers between threads for the upcoming refactoring
of Services Kit.
Change-Id: I526bc044b28c91496ad996fabebe538e75647f2c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2966
Reviewed-by: Jacob Secunda <secundaja@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Include only the APIs we are (shortly) going to actually support.
The other structures and functions declared in this file were
never supported nor used anywhere in Haiku's tree.
* Also drop unused vblank semaphore storage
* Spotted by X512. These are from intel_extreme
which was used as a base *ages* ago.
Change-Id: I2a6baaa4849baeb8c8cf10e2046d0fbe10c3a356
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5389
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
- Implemented version 5 superblock fields and necessary macros.
- Checksum functions are implemented which will be used for crc verification and crc updates.
- fssh_kernal_priv.h ROUNDDOWN macro definition is consistent with kernal.h definition.
Change-Id: I49b7c939bfd3ea1bffc85b3db42bc678dcce75cd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5350
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
This was introduced into the main API in 2010 (d72ede75fb),
but was actually only fully used for the past month (c2a9a890f3)
when SIOCGIFMEDIA was supported for all *BSD drivers and not just WiFi.
Most userland consumers of this structure did not use it correctly,
as was the case in #17770, and only worked because in the fallback case
the network stack just treated it as if it were an ifreq.
Nothing actually used the ifm_count/ifm_ulist (though tentative APIs
were exposed for it) as noted by previous commits; and the fact that
Haiku's IFM_* declarations are so spartan makes most of the returned
values unintelligible to userland without using FreeBSD compat headers.
If, in the future, we decide to implement ifmedia listing and selection
properly, that should likely be done with separate ioctls instead of
having multi-function ones like this.
This is technically an ABI break, but in practice it should not matter:
ifmediareq::ifm_current aligns with ifreq::ifr_media, so the things
that used this structure like our in-tree code did will continue to work.
Until this past May, the only other field that was usually set was
ifm_active, but in the absence of setting ifm_status all non-Haiku
consumers should ignore it completely.
The only consumer of this ioctl that I know of out of the tree,
wpa_supplicant, still works after these changes.
These are BSD extensions, not POSIX functions. They were needed
in libroot by the previous versions of the ftw/nftw implementations,
but the musl versions do not need them, and so we can move them to
libbsd.
This is a minor ABI break, but hopefully whatever was using them
in libroot also links to libbsd. If not, that's an easy enough fix.
(These were only added to libroot in 2013.)
This file contains a set of constants and flags which are already passed
between applications, net_server, and wpa_supplicant to indicate network
security, connection modes, and a variety of other things.
As the OpenBSD net80211 stack does not need wpa_supplicant for WPA2/PSK,
it only makes sense that we would pass the same information we pass
to wpa_supplicant into the stack instead. Rather than expose yet another
set of constants and flags to userland besides the FreeBSD and these
Haiku native ones, just make it so this file can be included in the kernel,
and the constants thus used directly.
this needed for dp aux before skylake, only for DP A (eDP).
should help with #17771
Change-Id: I4bdcca1fdc05294fb5b56c5c96164b6936a5881e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5355
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
Create a utility function which performs all necessary checks,
allocates memory, and copies the structures, and then make use of it
in the three places in the kernel which did all this manually.
None of them were previously complete: the fd and socket code only
checked iov_base and not iov_len, while the port code did not check
anything at all.
Part of #14961.
It has more general use than just in the VM code; basically anything
which receives buffers from userland should be invoking this if it
does anything besides user_memcpy (which alreay does it.)
The device is what actually controls the MTU, and it has its own
field for this, so having a second one just meant the MTU never
got updated after startup.
Remove the "mtu" field from the interface, use the "device->mtu" directly,
and then actually invoke device->module->set_mtu when updating.
* also uses the BAR size when dumping regs (as done by the intel_reg tool).
Change-Id: Ie29768afc8f9c42bb9a03b2866db34c4b0e43b7d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5334
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
BInvoker methods are now used, and input-handling is also tweaked.
Change-Id: I120cca8df9f11c11aac80911108d62fb49488f8f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4927
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
hraw_clock is possibly dynamic, but for the usecase this seems good enough.
Tested on SandyBridge and Haswell laptops.
Change-Id: I045b3c03f6b37bbffb3d8688658ffaa2a97311ae
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5319
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>