Commit Graph

65137 Commits

Author SHA1 Message Date
Augustin Cavalier
3e1163d6af libroot: Disambiguate parameters of ICUCollateData::Strxfrm.
Same thing that was done for wcsxfrm in 218604196a.
2023-04-08 14:17:15 -04:00
Augustin Cavalier
e69e1b2b3a libroot: Remove glibc's random.c.
Not used anywhere.
2023-04-08 13:51:41 -04:00
Augustin Cavalier
87be02e12a libroot: Replace rand() and rand_r() implementations with musl versions.
These functions are obsolete, anyway. We should probably remove
them from the kernel at some point...
2023-04-08 13:50:37 -04:00
Augustin Cavalier
05a0671dde libroot: Synchronize random() implementation with upstream FreeBSD.
Specifically, FreeBSD 12 (newer versions refactored this API into
more than just one file.)

Fixes #18346.
2023-04-08 13:49:03 -04:00
Augustin Cavalier
6d3d196648 getlogin_r: Make actually reentrant and fix error return value.
Fixes #18349.
2023-04-08 13:04:11 -04:00
Augustin Cavalier
fcd82d3dc3 math.h: Change definition of FP_ILOGB0 to match the specification.
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.
2023-04-08 12:30:15 -04:00
Augustin Cavalier
0f67b2ac2e uchar.h: Add missing include of stdint.h.
Fixes #17040.
2023-04-08 12:30:14 -04:00
Andrew Lindesay
86ee86f5a9 HaikuDepot: Nickname Length
HDS has increased the length of the nickname to
32 characters on version 1.0.147 and this change
supports that change in the desktop client.

Resolves to #18343

Change-Id: Iae07acc165165e91b04cef7ebc1190d241d9a053
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6307
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-04-08 15:55:28 +00:00
Freaxed
40e5560a3c BOutlineListView: fixed expansion causing items to disappear
On a multi-level list view, when expanding an item containing other collapsed lists, the last items disappear due to a wrong element counting.

Change-Id: I2313ad8efb23e8db54cd3563687bf0c2a775a12a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6259
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: Stefano Ceccherini <stefano.ceccherini@gmail.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-04-08 15:54:57 +00:00
Jessica Hamilton
8079adc050 libroot: fix path inconsistency in the find path API.
With the package kit merge, settings from packages were
placed into ~/config/settings/global for packages installed
into the PackageFS Home mount.

As a result, B_FIND_PATH_SETTINGS_DIRECTORY was returning a
user settings path different to the find directory API, making
transitioning from find directory to find path incompatible.

This change also updates the package_daemon and packagefs
to remove the remapping also occurring there.

Change-Id: Id5d077503e177a5f7cbc48779c132160b0d01890
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5941
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-04-08 15:54:33 +00:00
Zardshard
d8eeb8a4cc Debugger: explain target must be specified for CLI debugger
Previous behaviour was to exit without any explanation.

Change-Id: I3350a139fadffb197c7833f3c46861a401f86271
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6306
Reviewed-by: Rene Gollent <rene@gollent.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Automation <automation@haiku-os.org>
2023-04-06 02:56:16 +00:00
Zach Dykstra
9fe85f9688 mail: automatically scale toolbar icons
Change-Id: I756122de2f4ee99883a53d0d2163004328660c85
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6305
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-04-05 14:44:37 +00:00
Zach Dykstra
457e5ee245 mail: switch 'Set to' window to use layout lib
'File -> Close and -> Set to' used a hard-coded window size and
control/button layout. Switch this to use the layout library for proper
scaling.

Change-Id: Ieeed93da82fb6bdcca852e3bb2f5a3315222ec27
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6303
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-04-05 14:38:01 +00:00
John Scipione
863bf67d8d Deskbar: Scale leaf/team menu with bold font only
Note that this only affects the leaf and team menu item icon size
as we do not actually display any bold text here and this does not
cause any menu text to display as bold anywhere in Deskbar.

The reason to use bold font is because the leaf/team menu is set
to the same height as the window tab and the window tab is bold.

Fixes #17913

Change-Id: I8fd23e30e9a28e6aa24b4726c73863b9d0370010
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6297
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Automation <automation@haiku-os.org>
2023-04-04 18:39:40 +00:00
John Scipione
6781d35fcc Deskbar: Removed Utilities.h include from BarApp
There is no Utilities.h in Deskbar

Change-Id: If31a8eb0d36a62c9402c9d46e16891874e2d1aa2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6268
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-04-04 18:38:30 +00:00
PulkoMandy
095b381310 BitmapStream: fix grayscale AVIF decoding
BitmapStream creates a BBitmap without specifying a bytes per row, but
then check the bytes per row matches the header. It is better to ask
BBitmap for the desired bytes per row to avoid any difference in
padding.

Change-Id: Ie1facfd423ad888a14757a0fffc9e8cdf72ef832
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6301
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-04-04 18:37:03 +00:00
Emmanuel Gil Peyrot
cc889ed79a mime_db: Broaden AVIF filetype guess
The current version expects the first box to be exactly 32 bytes, but some
files found in the wild only have 28 bytes, so we now ignore the first four
bytes and it works.

Change-Id: I4c304bd6385bffd15f4adbb99cbf464f9767f7bf
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6302
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: nephele <nep@packageloss.eu>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-04-03 21:51:35 +00:00
Zardshard
c0a43216c6 Debugger: add support for executable file refs
Adds support for handling executable files in the
Debugger::RefsReceived function.

This change
* makes Deskbar menu->Recent Applications->Debugger->A recently opened
  executable open the executable instead of simply opening the
  Teams window, and
* allows dragging and dropping an executable onto the application's
  icon.

Change-Id: I8e70e7929188301ce976f1f14e885236d3cb2b0a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6299
Reviewed-by: Rene Gollent <rene@gollent.com>
Tested-by: Automation <automation@haiku-os.org>
2023-04-03 21:50:03 +00:00
Augustin Cavalier
d0b67fcc80 kernel/util: Clean-ups to DoublyLinkedList insertion routines.
* 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.
2023-04-01 12:31:39 -04:00
Augustin Cavalier
3d3b89c8cc kernel/util: Privatize the deprecated DoublyLinkedList::Insert() variant.
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.
2023-04-01 11:34:44 -04:00
Augustin Cavalier
ce08f03c61 kernel & add-ons: Adjustments to use DoublyLinkedList::InsertBefore.
The Insert(before, element) function has been marked deprecated since
2010, but still had many usage and kept accumulating more. It's long
past time we got rid of all them and actually deprecated the function
itself.

Insert(before, element) just calls InsertBefore, so no functional change.
2023-04-01 11:34:44 -04:00
Autocomitter
9560eadfb4 Update translations from Pootle 2023-04-01 08:05:25 +00:00
Augustin Cavalier
6ec600d29b kernel/util: Add self-link assertions to list_add_link_to_{head|tail}.
These caught the problem fixed in prior commits, and would have saved
me an awful lot of debugging time had they existed from the start.

They cannot catch all double-list-insertions, of course, but it's
relatively cheap to add these, and more than nothing.
2023-04-01 00:53:01 -04:00
Augustin Cavalier
70b4d59f18 freebsd_network: Refactor callout_stop and functions which invoke it.
* Create an internal variant which accepts a "bool locked" parameter.
   Use this from callout_reset instead of invoking it before locking,
   and then relocking afterwards. Eliminates some possible (though,
   so far as I know, benign) races.

 * mtx_assert always, even if the callout is not active. (Requirement
   notated in the comment.)

 * In callout_reset, do not invoke callout_stop at all unless we are
   cancelling; in cases of mere reschedules, simply change c_due
   and notify the callout thread.

 * While at it, use list_init_etc in init_callout; no-op change,
   but keeps things clean.

This should fix #18338 (specifically the change to never invoke
callout_stop when merely rescheduling, not cancelling.)
2023-04-01 00:51:22 -04:00
Augustin Cavalier
f863f473b5 freebsd_network: Check for c_due > 0 in the callout invocation.
Here is the scenario in which this matters:

1. A callout comes due, it is removed from the list, and c_due is set
   to 0. We then wind up in the mtx_lock here inside invoke_callout;
   while some other thread holds the lock.

2. The other thread, holding the lock, decides to *re*schedule the callout
   for a later time than the present. callout_reset sees the callout has
   a c_due of 0, thus indicating it is not in the sTimers list, adds it,
   and sets a (future) c_due.

3. The other thread unlocks c_mtx, thus the callout thread acquires it
   and proceeds.

Under the code I wrote in hrev56875, before this commit, the following
would occur (at least with the ipro1000 driver on some hardware):

4. c_due would be set to -1, thus signaling the callout was no longer
   scheduled, and thus not in the sTimers list (despite being in it!).
   The callout's own method would decide to reschedule itself, and
   invoke callout_reset as such.

5. callout_reset would, seeing c_due of <= 0, try to add the callout to
   the sTimers list. However it is already in the list, and in many
   circumstances the only item in the list, so it would get silently
   linked to itself.

6. An infinite loop due to the looped linked-list and/or double-remove
   resulting in NULL dereferences would result.

Steps 1-2 coinciding in just the right way was apparently very rare, hence
why this problem only appeared very infrequently. The code I wrote to force
their coinciding made the problem happen extremely frequently.

This fixes #18334.

(Figuring out that the problem was an item being linked to itself, and
most critically a double-*reschedule* not a double-*removal*, took
far too long to figure out. I will be refactoring this code more
in subsequent commits, but also introducing new assertions to our
linked-list systems which enabled me to finally track down this problem
at all. Who knows; perhaps they will shake loose other bugs.)
2023-03-31 23:56:24 -04:00
Augustin Cavalier
1110e6fc65 freebsd_network: Migrate callout invocation to another function.
Avoids "goto" and reduces indentation.
2023-03-31 13:38:00 -04:00
Trung Nguyen
55f3abb4c9 userlandfs: Support mapping FUSE files to memory
- Create a file cache for FUSE mounted files on open to allow
memory mapping these files unless direct_io is specified.
- Implement DoIO for FUSE mounted files.

This patch enables files mounted through FUSE filesystems such as
sshfs or vmhgfs to be `mmap`ed, allowing remotely cross-compiled
executables to be directly run on Haiku.

Change-Id: I364b8225eae5b1d586280c2b3301fb661581caed
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6277
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-03-31 13:42:17 +00:00
Zardshard
bcbe43f8d3 Debugger: Add core files to list of file types handled
Change-Id: I34fc9eba27519fd486c735da9d32d5c7b6f72e4f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6266
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-03-31 13:40:19 +00:00
Augustin Cavalier
673bc1087f freebsd_network: Always unset c_due after removing the callout from the list.
Use 0 as the magic value instead of a positive one. This way, <= 0
consistently signals that the callout is not in the list, whereas > 0
signals that it is.
2023-03-30 17:30:50 -04:00
X512
11e68e0c54 apps/haiku3d: Swap then unlock to fix rendering on glvnd
* The old non-EGL OpenGL kit did some weird stuff (tm) trying
  to fix Be's mistakes around OpenGL locking.
* The EGL libglvnd OpenGL kit (coming soon) no longer does wierd
  unlocking behaviours. This fixes a "white screen" for Haiku3D

Change-Id: I2a6804098516c0cd9ec63ccd1eb25c0813452933
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6267
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-03-30 20:03:20 +00:00
Augustin Cavalier
e6d3d777b2 freebsd_network: Cleanup callout_thread.
* Reorganize inner loop for clarity and to reduce indentation.
 * Handle callouts that are due at this exact system_time.
 * "break" instead of "continue" if lock fails.
2023-03-30 13:42:05 -04:00
Augustin Cavalier
ff6e777d28 kernel/util: Clear list links on removal under KDEBUG.
This way, if someone tries to double-remove an item or do other
invalid things to it, this will crash instead of (silently) corrupting.
2023-03-30 12:46:31 -04:00
Augustin Cavalier
2393d22cdb kernel/util: Add static assert that the two list links are the same size.
They are used interchangeably in some places, so we should assert this.
2023-03-30 12:43:23 -04:00
David Karoly
e37168ad4f kits/app: fix unaligned copy in BMessage
BMessage contents are packed so we might get alignment exception on some
architectures when fetching fields from message with Find##typeName.

As memcpy() is already used when composing message content in AddData,
here we introduce memcpy in Find##typeName functions.

Change-Id: I0213409a219acda138f8d2fe7023e5dcfcd5cff3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6195
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-03-30 14:54:15 +00:00
Panagiotis "Ivory" Vasilopoulos
71f5445c91 Installer: Remove leftover code
Just some refactoring, nothing too much. The tooltip is not necessary
because the hints have been made much more visible using popups and
the default state of the Installer window itself.

Change-Id: I25f10fe3460c4df0bdc4e4af298532f94c65ebc5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6262
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-03-30 13:01:39 +00:00
Zach Dykstra
29285e87a8 translators: remove explicitly setting sizes
With the change in hrev56876, translator configuration views no longer
need to hint what their sizes should be.

Change-Id: I7742b4c8d71ec98635e530b34573e6f765f12d30
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6265
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Tested-by: Automation <automation@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-03-30 04:04:37 +00:00
Augustin Cavalier
15ff8d64b6 BNetworkDevice: Remove GetNextNetwork.
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.
2023-03-29 20:15:32 -04:00
Augustin Cavalier
11a8223711 Migrate in-tree consumers of BNetworkDevice::GetNextNetwork to GetNetworks.
GetNextNetwork is very inefficient as it fetches all networks but only
returns one of them. GetNetworks was introduced to compensate for that,
but only the most regular consumers were initially migrated. Now,
the remaining consumers of the old API are converted to the new one.
2023-03-29 20:10:34 -04:00
Augustin Cavalier
8c58c0c5e3 BaseTranslator: Use PreferredSize() not ExplicitPreferredSize() in resize.
The former will use the explicit preferred size if one is set;
otherwise, it will use the computed preferred size; whereas
the latter will only use the explicitly set one, which if it has
not been set, will just be an empty BRect.

Fixes #15434, #18329.
2023-03-29 18:35:04 -04:00
Augustin Cavalier
d2670b490d freebsd_network: Handle an edge-case race of callout_stop.
If callout_stop() runs at the same time the callout_thread is
about to process the callout, we can wind up with a situation where
the callout is "active" but has not yet run due to waiting on the mutex.

FreeBSD's documentation confirms that callout_stop must be called
(when "safe" is 0, i.e. not callout_drain) with the callout's lock
held, if it has one, and so we can prevent the callout from being
invoked at this point, too.

Additionally, fix return values of callout_reset.

May further help with #18315.
2023-03-29 11:37:02 -04:00
Augustin Cavalier
d86a240aec kernel/thread: Refactor thread-local-storage initialization and updating.
* TLS slots are not in any way architecture-specific; we do not even
   have a mechanism by which they could be made so at present.
   Thus, the initialization of them can be moved to common code, and
   out of the per-architecture implementations.

 * When dealing with a fork()ed thread, it will already have a TLS array
   with values set in it. Therefore, do not overwrite the whole array,
   but instead only update the specific values which have changed on fork.
   This fixes at least part of #17896.
2023-03-29 11:24:17 -04:00
Alexander von Gluck IV
ed24eb5ff1 3rdparty/proposals: Add draft WIP khronos proposal
Change-Id: I48eed026db138e4f83cb7f5e0403f0fcaaa401f2
2023-03-29 08:50:35 -05:00
Zardshard
5bf437dd89 DriveSetup: Rename view name to match class name
Change-Id: I5c744f0279265525472ae899f777234eb055d171
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6261
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Automation <automation@haiku-os.org>
2023-03-29 11:15:44 +00:00
Augustin Cavalier
baf281aa61 strace: Fix names of hardcoded syscall lists.
Before this commit, specifying %memory or %network just crashed strace.
I guess this was never tested?
2023-03-28 16:44:54 -04:00
Augustin Cavalier
55f633f7ec strace: Add printing for the address-spec enum. 2023-03-28 16:21:10 -04:00
Augustin Cavalier
90b0629ee1 strace: Trivial improvements.
* Break in FlagsTypeHandler once we have cleared all flags.
 * Use sizeof(hex) instead of writing out the size again.
 * Place comment above variable name in patch_syscalls.
2023-03-28 15:38:53 -04:00
Augustin Cavalier
04acec35f9 strace: Add set_memory_protection to area syscalls. 2023-03-28 15:29:25 -04:00
Augustin Cavalier
97685bf91d strace: Set void** parameters of area syscalls as InOut. 2023-03-28 15:26:49 -04:00
Augustin Cavalier
7da3e2fcc4 strace: Treat void** the same as addr_t*.
This way, the actual value pointed to will be printed, instead of
the pointer itself.
2023-03-28 15:24:54 -04:00
Augustin Cavalier
7046e7cd8a strace: Cleanup read_string.
Our std::string is not broken; rather, the bytesRead may include the
terminating NULL byte, which was then added to the string and caused
misbehaviors. So we need to use strnlen with std::string also, and
then everything works as expected.
2023-03-28 15:09:41 -04:00