This appears to be a typo for LC_CTYPE, and as such nothing
ever used it. Environment settings are set up by SetupEnvironment
anyway, and if unset just default to C/POSIX locale, so this
isn't needed here.
Avoids open/read/close of a FD on every application startup.
May help with #18947 (especially as opening files on devfs is
somewhat more expensive than on a regular filesystem.)
Exploring can take a while, and if we hold the device manager
lock the whole time, we'll block a lot of other things on the
system (including open() calls to anything in devfs.)
So, instead of holding the lock continuously, we now lock it
only temporarily, and instead add protection against deadlocks
when called by other threads besides the explore thread.
It's now at HaikuArchives and supplied in a package at HaikuPorts.
EXR images are rare and mostly used in pretty specific cases, so it
isn't re-added to the default install.
Catalogs are left in-tree until they are purged from Pootle.
Change-Id: I54e478a30e02bdefd1b8fa53c4b66d84ffb04185
We already used it for the individual date and time formats, so it
only makes sense to use it for the combined datetime format.
This fixes failures to initialize datetime data for non-POSIX locales
after the ICU upgrade, as the "full" format is now longer and contains
characters such as U+202F (NARROW NO-BREAK SPACE) which result in the
UTF-8 encoding being too large to fit in the fixed-size buffer.
FreeBSD's equivalent routine (lapic_write_icr) does not read
these registers; in fact the only thing that does read them
are its initialzation routines, and then its code to check
the interrupt delivery status (same as we do.)
Additionally, APIC_INTR_COMMAND_1_MASK only contains the bits
that are set by the OS, not the ones set by the APIC, which
means that APIC_DELIVERY_STATUS (bit 12) isn't included
and we are thus writing it back here, which doesn't
seem correct.
Change-Id: I2c74b7b8de3cd8295c8dd86e5a7c6530dc5648ed
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7827
Tested-by: Commit checker robot <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Since we always compile the kernel with modern GCC, we might as well
take advantage of modern C++ features. In addition to providing
a sanity check, "final" is also an optimization, since it allows
the compiler to devirtualize calls made directly to a "final" class.
Change-Id: Iedb0ee8834637771f5b6113c17342dbf67e99042
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7826
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This shows that the profiler is still pretty broken, because we
are missing quite a lot of ticks on average. One run of
"profile pkgman search" here produced an output with 66 total ticks
and 423 (!) missed ticks. A brief run of WebPositive was not quite
as bad (main thread: 1078 total ticks, 157 missed ticks.)
Change-Id: Idfc34534e66eff0fe7e948fcc3576be09db879a3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7820
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
We can only do this if the underlying I/O will not be cached,
since the I/O hook bypasses any cache. But that should be fine,
as in the event that reads and writes are going through the file cache,
calling read and write multiple times isn't especially expensive.
On the other hand, when the underlying device is not a file
or something else cache-backed, making many I/O calls instead
of just one can be very expensive. The BFS journal flush seems
to routinely call writev() with over 100 iovecs on a regular basis
during high disk activity, and doing 100+ separate writes to
an external drive vs. just one makes a big difference.
Should help with #15585.
Change-Id: I433e9d9948634f8cdccf7999710c6c5e6b6c8850
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7824
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
* If realloc returns NULL, we still need to free the original pointer.
* If get_memory_map returns with B_BAD_VALUE and entries is 0,
this is really the same as B_BUFFER_OVERFLOW.
Fixes spurious I/O failures when writing the BFS journal directly
with vectored I/O (as the next commit will enable.)
Change-Id: I56b63ea2f6b82716719570f1e35d9b425a49b64e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7823
Reviewed-by: Adrien Destugues <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
We now have just one rather than three (common_user_vector_io,
_kern_readv, kern_writev.)
No behavioral change intended, though there is some slight
functional change (syscall flags are now set/unset much earlier.)
Change-Id: I6c3c26cab1c19755ef15c8b3c9e38afe9b1d145c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7822
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This amends 20ac27def6.
I missed an important case in that commit: if pos is not -1,
then movePosition will still be false, but we nonetheless
need to increment the read/write position.
Should fix#18921.
Without this, a query term that does have an index but for which
the pattern starts with a wildcard (e.g. "*term*") is treated as having
a score of 0. That means that it is then dependent on the query order
as to whether or not the equation will run at all, since if all the terms
have a score of 0 but one has an index, placing that term first
will make the query run while any other would not.
Fixes#18672.
If we have a matching operator, we will replace the current item
with a new item, and we may need to process it again. For example,
in cases like "A||B||C", the first pass will turn this into "(A||B)||C",
and so we need to re-process the first item to get "((A||B)||C".
Fixes "Open with..." and some other things following the query parser
refactorings.
ModelMenuItem can throw exceptions if its Model fails to initialize,
and even though we pass a Model in directly, copying the Model
results in opening the underlying file again, which of course may
fail if something changed since our Model was created.
While at it, remove the return value, since it isn't used anywhere.
Should fix#18905.
This fixes a regression introduced in 34fcf3d9ea.
That commit correctly adjusted the "pos" checks at the top of these
functions, but missed that there was a place in the loop where pos
is incremented. After the first increment, we would have a non-zero
pos, and so the new checks in the actual read/write routines would
return an error, meaning that only the first iovec was ever processed.
This fixes WINE following the aforementioned change.
The directory is created there, so we should also perform the
mount operation there. If we don't, the first boot of a new
Haiku image will not have the ramfs shared_memory, since of
course the kernel can't mount it at a nonexistent directory.
Mainly the ported OpenBSD drivers (where this was added in Haiku-specific
code), and then the few remaining drivers that are no longer supported
on FreeBSD.
* Add more if_{get|set}* routines, and move all copied directly from
FreeBSD into a fbsd_if.c file. Also clean up the header.
* DRIVER_MODULE macros dropped the "devclass" parameter.
In order to not break all existing drivers, use FreeBSD's
interim solution of compatibility macros.
This way, we won't run into stack overflow issues due to recursion.
Who would really need a FS query with more than 32 equations, anyway?
Fixes#18692.
Change-Id: Ieda401446d9cae2e56100ddbab08bebcc724b484
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7789
Reviewed-by: waddlesplash <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
This way, we can handle parse trees of arbitrary depth without
running into stack overflows. Of course, evaluation is still
a problem...
While at it, use "const char*" everywhere, and also put the
query parser into an Init() function so we can return
more statuses than just B_BAD_VALUE.
Part of #18692.
Change-Id: Ib81e6545935ce484df10dfe36ca4ffcf2b3cd607
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7710
Reviewed-by: waddlesplash <[email protected]>
At present it just accepts query strings as command-line arguments
and prints the parsed query to the stream (or the error, if there
is one.)
Change-Id: I907380e370790ad9fb4d8f9406a18d359d0dcc2b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7709
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
This way, by the time we send a notification, the arguments
are already set even if the main thread has not yet started.
Fixes#12703.
Change-Id: Ib93b4b16bffa8cb943cf6389f0f72dce89f9749b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7702
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
The physical memory ranges will actually be used again
later on during post-modules VM setup. The allocated ranges
are what we really want to prevent access to, anyway.
Fixes#18907.
block_alloc and friends are now declared as static, so we got
GCC errors about unused functions when USE_SLAB_ALLOCATOR_FOR_MALLOC
was 0. So, instead, just don't initialize the block allocator
at all.
This was the change that triggered the prior commits: if the
block allocator is completely disabled, the first object
allocated through an object_cache is inside VMAddressSpace
initialization, which happens during the interim period
mentioned in previous commits.
Haiku now can be built and booted all the way to the desktop
with the kernel guarded heap enabled (and without the guarded
heap substituting for the object cache.)
Change-Id: If2f08a741826799127ecfd263d6c82ed4263eaab
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7701
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Haiku-Format: Haiku-format Bot <[email protected]>
See inline comment: if we don't, we'll try to allocate pages
during the post-page-init but pre-area-init period, which
isn't possible (and after the previous commit will properly fail.)
Change-Id: If8392417e05912c8cfc417222abab3b39cb15bf1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7700
Haiku-Format: Haiku-format Bot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Otherwise, vm_allocate_early_physical_page could try to use them to
allocate more physical pages, which isn't legal as page state
management is now the responsibility of the vm_page system.
Discovered while working on re-activating the guarded heap.
In that case, at least, the illegally allocated pages were caught
by the memory manager trying to convert them into areas,
but they weren't marked WIRED and so tripped asserts.
Change-Id: I39af70bf8a652511bb65fe2154bba16d4ba5c924
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7699
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Axel Dörfler <[email protected]>
This has been broken since January 2014, from a change made during
the scheduler refactor (527da4ca8a).
How nobody seems to have figured this out since then, I have no idea,
especially since the 32-bit initialization routine had the
critical function (x86_get_double_fault_stack) commented out entirely.
Even if it wasn't commented out (and it wasn't for 64-bit), it wouldn't
have worked, because the double-fault stacks were not allocated
until "post-VM", while the TSS is set up during "preboot" (basically
just after kernel entry.)
We now take care of this by allocating the virtual address for
the stacks immediately, and then creating an area for it
in the "post-VM" stage. This means that any double-faults
which occur before the post-VM stage will just triple-fault,
but seeing as all double-faults have been triple-faults
for the past decade, that's probably fine. (In order to get a
double-fault stack that early, we would probably need to
have the bootloader allocate it for us.)
This must be working, because it changes #18692
from a triple-fault (instant reboot) into a double-fault KDL.
On some rare memory-corruption KDLs, I have seen pages with
"0" for all fields including page_num. So now we compute the
expected page number from the page's offset into sPages
and print an additional line if it doesn't match what's in the
page structure.
This way, FIONBIO and O_NONBLOCK will no longer get out of sync,
and additionally, FIONBIO can be used to change non-blocking
status of regular (non-socket) FDs, too (which some applications
seem to take advantage of, to avoid needing to fetch the open_mode
before calling fcntl.)
Change-Id: Id894fe76c79ac373c0121a003d68180a3d9b6560
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7697
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Some systems (e.g. NTFS through WSL1) support arbitrarily-large
extended attributes, but do not preserve case on attribute names
(or disallow more characters than the existing manglers took
care of.)
So, this adds a mode in which attribute names are encoded as
hexadecimal. At present it must be manually enabled; in the future
it may be possible to modify ./configure to activate it
automatically.
Change-Id: If20e4cb1cf4153cccc918ce6d51761426055290c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7698
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
* Make the consumer-count int32 atomic, avoiding the need for
all get/put operations to go through a global lock.
* Disable the code that unloads the stack interface when there
are no consumers. Otherwise, we wind up repeatedly loading/
unloading the stack interface during the boot process (e.g.
while sockets are being created and destroyed during net_server
startup.)
In the future, if we want to really unload it, we can add some
interaction with low_resource_monitor or something like that.
Reduces register_domain call count during boot from 31 to 7
(it appears the stack was loaded and unloaded 5 times, before
it stayed loaded the 6th.)
Otherwise, modules that depend on each other will be repeatedly
loaded and unloaded. This reduces the number of register_domain()
calls on a standard boot (of @minimum, at least) from 43 to 31.
(And surrounding portions of the "btCoreData" module.)
* Rewrote the main "l2cap.h" header representing protocol constants
and structures. Now conforms to general Haiku naming conventions
rather than BSD ones. Some more constants added/removed based
on the most recent Bluetooth specification.
* Rewrote all code derived from the BSDs to match Haiku conventions
and structures in the driver.
* Dropped the "channel" and "frame" structures from "btCoreData".
Channels are now managed by L2capEndpoints, and "frames" are
now just plain net_buffers without surrounding structures.
This also makes state management much simpler.
* Made it so that actual net_buffers are passed through to the
l2cap_receive function rather than another data structure.
A fake interface address is used to communicate connection
information. (This probably ought to be changed, though.)
* Get rid of l2cap_lower and l2cap_upper abstractions.
Everything related to channel/endpoint management is now
done in L2capEndpoint, while buffer reception is handled
directly in l2cap_receive and elsewhere, same as other drivers.
* Wire up more hooks and fix module flags (needed to be able to
get the module loaded and opening sockets at all.)
* Implement an actual locking strategy in L2capEndpoint
and HciConnection. There's still problems with lifetime
management, but at least thread-safety is mostly handled.
* Create an L2capEndpointManager and use it to manage
the endpoints, rather than having a single (unsafe)
linked-list.
And plenty of other refactorings and cleanups besides.
There's still more to be done for Bluetooth overall, though:
* The "btCoreData" and "hci" modules also badly need a major
overhaul, and should be merged into a single "bluetooth"
bus_manager. They also shouldn't be passing around pointers
to other modules like this.
* There's a number of TODOs/FIXMEs in the L2CAP module, most
notably around timeouts (especially command timeouts) and
parameter validation/specification.
Tested by myself and kallisti5. Outgoing connections,
at least, manage to fully initialize and configure
successfully.
(And surrounding portions of the "btCoreData" module.)
* Rewrote the main "l2cap.h" header representing protocol constants
and structures. Now conforms to general Haiku naming conventions
rather than BSD ones. Some more constants added/removed based
on the most recent Bluetooth specification.
* Rewrote all code derived from the BSDs to match Haiku conventions
and structures in the driver.
* Dropped the "channel" and "frame" structures from "btCoreData".
Channels are now managed by L2capEndpoints, and "frames" are
now just plain net_buffers without surrounding structures.
This also makes state management much simpler.
* Made it so that actual net_buffers are passed through to the
l2cap_receive function rather than another data structure.
A fake interface address is used to communicate connection
information. (This probably ought to be changed, though.)
* Get rid of l2cap_lower and l2cap_upper abstractions.
Everything related to channel/endpoint management is now
done in L2capEndpoint, while buffer reception is handled
directly in l2cap_receive and elsewhere, same as other drivers.
* Wire up more hooks and fix module flags (needed to be able to
get the module loaded and opening sockets at all.)
* Implement an actual locking strategy in L2capEndpoint
and HciConnection. There's still problems with lifetime
management, but at least thread-safety is mostly handled.
* Create an L2capEndpointManager and use it to manage
the endpoints, rather than having a single (unsafe)
linked-list.
And plenty of other refactorings and cleanups besides.
There's still more to be done for Bluetooth overall, though:
* The "btCoreData" and "hci" modules also badly need a major
overhaul, and should be merged into a single "bluetooth"
bus_manager. They also shouldn't be passing around pointers
to other modules like this.
* There's a number of TODOs/FIXMEs in the L2CAP module, most
notably around timeouts (especially command timeouts) and
parameter validation/specification.
Tested by myself with kallisti5's help. Incoming connections
(on the PSM for SDP) get all the way to the latter half
of the Configuration step before hanging.
Mostly deleting leftovers from where this was copied from IPv4,
and implementing some missing functionality.
Notable bugfix: is_empty_address was broken due to an incorrect
comparison.
In the new "automatic" mode, the number of displayed colors
is just 3, as opposed to the full 38. Much more manageable!
The HSL routines added in this commit were derived from
https://gist.github.com/ciembor/1494530 which is itself derived
from the Wikipedia page describing HSL/HSV.
Part of #15543 and #11636.
Change-Id: I230a358d18c379fb0673162e0b3cbdb8d1b8d84e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7479
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Most of the time when this function is invoked,
the menu is not yet attached to a window, and so
there is no looper to lock. But some of the time,
there is, leading to a crash if we don't lock it.
Fixes#18875.
* Don't allocate a context up front if we're
just going to free it anyway.
* Actually set the various flags originally set
in the constructor in the place where the context
is actually allocated.
* Remove now-duplicate thread_count assignment.
* Default "pos" to "-1" instead of 0 and check for this value
instead of ops->fd_seek directly in IO operations.
* Set "pos" to "0" only for seekable vnodes.
* Return ESPIPE in read() and write() if the specified pos is not
-1, but the descriptor->pos is.
Fixes the VFS part of #18836.
Change-Id: Ib4da1652b06798588abedc98963aeb63511d3e41
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7544
Reviewed-by: waddlesplash <[email protected]>
Using the current time can be confusing when looking at packages or
the bootloader, as the time represents whenever the new state was made,
not when the old state was.
When there is no activated-packages file, we just use the current time
anyway. This means that on newly created systems, the first two states
will have the same time, and the second will have an extra "-1" on the
end of its name to distinguish it (if for some reason the activated
file retains its time, then you'll get "-2", etc.)
Change-Id: I128764ae4650a3433e2584f3ed154b04cf850b19
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7543
Reviewed-by: Jérôme Duval <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>