Commit Graph
100 Commits
Author SHA1 Message Date
Augustin Cavalier 88306be95c drivers/pty: Check slave TTYs also in get_tty_index.
The old TTY driver had one set of indexes for both master
and slave TTYs, and it used those indexes interchangeably.
We thus need to check both lists here also.

Fixes SSH passphrase prompts not working.
2023-05-10 12:59:13 -04:00
Augustin Cavalier 071ff801ee BSerialPort: Implement WaitForInput() using wait_for_objects.
Fixes #17867.

Change-Id: Ib59781128d5d21317c4042f250333b177a0ed91b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6432
Reviewed-by: waddlesplash <[email protected]>
2023-05-09 23:33:43 +00:00
Augustin Cavalier bbb4db9276 Delete the old TTY driver.
No longer used or included in the build after the previous commit.
2023-05-09 16:04:09 -04:00
Augustin Cavalier 0c2a5bb5ea Replace the "tty" driver with a "pty" driver.
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.
2023-05-09 16:04:09 -04:00
Augustin Cavalier 7a27ef1439 generic/tty: Add the undocumented BeOS 'ichr' ioctl.
This was used by the BeOS port of ncurses, as well as our own ncurses
port until not too long before the alpha1 days, so we should keep it
around for compatibility.

Implementation copied directly from the "legacy" TTY driver.
2023-05-09 16:04:09 -04:00
Augustin Cavalier bb57ea897d generic/tty: Combine settings structures.
It doesn't make much sense to have separate window sizes, termios, etc.
settings for the two halves of a TTY. Moreover, having separate settings
which can get out of sync breaks applications, e.g. double-printing
in shells.

The original TTY driver has unified settings. It seems likely that the
settings were separated as part of the locking simplification, however
the lock separation was reverted a while back, anyway.
2023-05-09 16:04:09 -04:00
Augustin Cavalier 997adc7e61 kernel/fd: Add missing NULL checks in user_io routines.
I am not sure how this path could be hit besides having
O_APPEND set on a socket, which appears to be possible,
though I don't know what purpose that would serve.

Tested by adding these two lines between the sleep() and close()
in the in-tree tcp_connection_test:

fcntl(fd, F_SETFL, O_APPEND);
write(fd, "Hello", 5);

Before this commit, the above lines cause a KDL.

May fix #18133, but I don't presently have access to the
reproduction setup described in that ticket.
2023-04-29 20:01:30 -04:00
Augustin Cavalier be8080575a IORequest: Refactor IOOperation transferred-bytes and status accounting.
Until the introduction of the nvme_disk driver, these classes were
mostly only used directly by the IO scheduler, and then a few direct
usages of IOOperation itself in the individual disk drivers; so
API confusions were easily missed.

When writing the nvme_disk driver's IORequest support, however, it
became readily apparent that there were some pretty bad confusions
around transferred-bytes accounting in IOOperation. This commit
attempts to resolve all of those.

There are two basic changes here:

1. Move transferred-bytes accounting into IOOperation::SetStatus.

The "TransferredBytes" field of IOOperation is against the *original*
range, not the actual operation's range (which will be wider, due to
bouncing, etc.), and furthermore only applies to the actual content
of the request (and not e.g. to a read half of a bounced write.)

These two facts meant that determining what value to pass to
SetTransferredBytes was not trivial, and was easy to get wrong.
I recall messing that up when working on nvme_disk multiple times
before reading the API carefully.

2. Do not pass redundant values to IORequest::OperationFinished.

All of the values here can be derived (albeit indirectly) from the
IOOperation, and all consumers of this API basically did just that.
Rather than make them do it, make the IORequest take care of
computing all of those values itself.

Change-Id: Ic9ae29e1100319e5b7647647c4db7e5aad4d125e
2023-04-28 14:59:21 -04:00
Augustin Cavalier 103c671ef0 AbstractModuleDevice: Add generic read/write hooks via "io" hook.
This substitutes for the already-existing behavior of scsi_cd, scsi_disk,
and virtio_block, so we can delete their hooks and let them use
these new generic fallbacks.

Some other drivers perform clamping, and so using these fallbacks would
constitute a behavioral change.

Change-Id: I9a2e503f2e03abc276bdfc02d1cff1565a9742e9
2023-04-27 16:24:08 -04:00
Augustin Cavalier be67f14dcb mmc_disk: Refactor read/write/io hooks.
* Move geometry fetching to open(); it was not done
   in io() and was duplicated in multiple places.

 * Clean up clamping and bounds checking.

 * Use IORequest::TransferredBytes().

 Change-Id: I4157e516098dc0362c1478abd21a545c1f235cd7
2023-04-27 16:24:02 -04:00
Augustin Cavalier e0f07d3ce0 IORequest: Add an assertion in SetTransferredBytes. 2023-04-27 15:20:17 -04:00
Augustin Cavalier f64b099191 scsi & virtio: Clean up IORequest usage.
* Use TransferredBytes() instead of assuming length.
 * Consolidate checks and invoke io hook instead of scheduler directly.
2023-04-27 15:19:39 -04:00
Augustin Cavalier 8d2c997da2 nvme_disk: Add missing bounds check and adjust clamping. 2023-04-27 15:12:14 -04:00
Augustin Cavalier 8540053c8a xsi_message_queue & xsi_semaphore: Downgrade a lot of traces.
Reduces syslog spam.
2023-04-26 17:17:57 -04:00
Augustin Cavalier d8f78afc8a xsi_message_queue: Permit incoming buffer to be NULL.
The user address space has not included NULL for a while, so this
has actually been broken for years, and nobody noticed. I guess
XSI message queues are not very well used?

Fixes the in-tree "xsi_msg_queue_test1".
2023-04-26 17:17:19 -04:00
Augustin Cavalier 6acd708e97 xsi_message_queue & xsi_semaphore: Use condition variables to wait.
This removes a lot of custom logic for managing waiting threads,
which was not even correct in all cases (and the code actually
acknowledged this with a big TODO about it, which weinhold
added all the way back in 2008!)
2023-04-26 17:16:07 -04:00
Augustin Cavalier 9747721a43 kernel/condition_variable: Add a fast-exit from Wait() for negative timeouts.
acquire_sem_etc does something very similar.
2023-04-26 17:12:24 -04:00
Augustin Cavalier d8e4f52b78 kernel/condition_variable: Add a ConditionVariable::EntriesCount() routine.
Will be useful in changing the XSI subsystems to use condvars.
2023-04-26 17:08:15 -04:00
Augustin Cavalier 484bf053dc VMCache: Use THREAD_BLOCK_TYPE_OTHER_OBJECT.
This would have assisted in debugging #18390.
2023-04-26 15:34:24 -04:00
Augustin Cavalier 557f0446b3 kernel: Introduce THREAD_BLOCK_TYPE_OTHER_OBJECT.
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.
2023-04-26 15:33:53 -04:00
Augustin Cavalier f5e531e92e kernel/thread_types: Remove Thread::condition_variable_entry.
Unused, and "struct PrivateConditionVariableEntry" no longer exists, anyway.
2023-04-26 15:32:20 -04:00
Augustin Cavalier 3c51bd6a2b libroot: Fix initialization of LocaleNumericDataBridge.
We need to store the isGlobal value, so that the destructor
can take care of unsetting the glibc locale properly.

It seems this has been broken since d338200e2b.

Fixes #18344 and probably #18336.
2023-04-25 15:55:42 -04:00
Augustin Cavalier 419abdb265 openbsd_wlan: Add implementation of IEEE80211_IOC_SCAN_REQ.
We cannot actually initiate scans, but we can at least detect when
one is in progress.

This fixes "ifconfig ... scan" on OpenBSD devices returning errors
instead of scan results ("list" always worked.)
2023-04-25 13:37:52 -04:00
Augustin Cavalier 6fa3716c79 docs/user: Import syslog documentation from an old Haiku newsletter article. 2023-04-25 13:10:59 -04:00
Augustin Cavalier 4ba629698f pci/designware: Add another missing include. 2023-04-25 12:50:58 -04:00
Augustin Cavalier 69929490eb locale_t.h: Add missing newline at end of file.
Fixes #18369.
2023-04-25 12:38:37 -04:00
Augustin Cavalier 3ce66fb079 pci/designware: Add missing include. 2023-04-25 12:38:13 -04:00
Augustin Cavalier c4737dcb22 freebsd_network: Be lenient, do not assert if the callout mutex is &Giant.
Same as FreeBSD. Should fix #18356.
2023-04-17 22:47:14 -04:00
Augustin Cavalier 97d55ad49d freebsd_network: Add missing LOCKGIANT to the close() hook.
Should fix #18363.
2023-04-17 21:51:29 -04:00
Augustin Cavalier 6347519ab1 pthread_once: Add static assertions for ONCE_INITs.
Both of these need to be here, they cannot be in the C sources,
as the static assertions throw "non-constant expression" when
placed there.
2023-04-10 11:51:43 -04:00
Augustin Cavalier d9e8ef7f66 threads.h: Fix value of ONCE_FLAG_INIT.
Fixes #18348.
2023-04-10 11:50:33 -04:00
Augustin Cavalier 5cbb772a4d libroot: Fix handling of n=0 in mbrtowc.
Fixes #18350.
2023-04-10 11:25:15 -04:00
Augustin Cavalier 33dd436f25 kernel/team: Fix race condition in team loading wait.
The condition variable that the load_image'ing thread is waiting on
is also owned by that same thread, so as soon as it wakes up, it
will soon return, thus destroying it. Under high load or other unlucky
scheduling conditions, it seems this could occur before the other thread
had even returned from the condition variable's NotifyAll.

Since team->loading_info is protected by the team lock, simply
acquire the team lock once more after being awoken and returning,
to synchronize and prevent this race.

Should fix #18352.
2023-04-08 15:10:35 -04:00
Augustin Cavalier 23e3c5fa0c libroot/icu: Add missing include of assert.h.
Needed everywhere other than GCC2.
2023-04-08 15:06:13 -04:00
Augustin Cavalier adc3561bed libroot: Suppress signed-unsigned comparison warning. 2023-04-08 14:50:13 -04:00
Augustin Cavalier c3c213810b libroot: Do not include terminating NULL byte in result of [wc]strxfrm.
Fixes #18347.
2023-04-08 14:48:48 -04:00
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
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
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
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
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
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
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
Augustin Cavalier 28d588d51e strace: Create a status_t type handler and use it for return values.
This way, we save 3 string comparisons on every non-empty return value.

Actually this code was broken before, and did not print error names
for return types other than status_t, because message.return_value
is an unsigned integer and thus "< 0" was always false. Now we cast
appropriately in the new TypeHandler, so this works properly.
2023-03-28 14:23:27 -04:00
Augustin Cavalier 8b9267565d strace: Do not print unnecessary parentheses.
Cleans up output somewhat.
2023-03-28 13:36:18 -04:00
Augustin Cavalier 0166c1efdd strace: reserve_address_range argument _address is an InOut parameter. 2023-03-28 13:33:51 -04:00
Augustin Cavalier 0f3ea49704 strace: Add area protection flags printing.
Using the new FlagsTypeHandler.
2023-03-28 13:00:58 -04:00
Augustin Cavalier 37f7aba689 strace: Clean up Jamfile.
* Organize sources a bit better.
 * Move -O0 into the loop.

No functional change intended.
2023-03-28 12:59:59 -04:00
Augustin Cavalier 502309ab5a strace: Introduce FlagsTypeHandler, and use it for O_* modes.
Change-Id: I1569084a71c32834c0ff3d8dc71ef3de9d5a817d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6263
Reviewed-by: Adrien Destugues <[email protected]>
Tested-by: Automation <[email protected]>
2023-03-28 15:27:05 +00:00
Augustin Cavalier 4cb9408437 NTFS-3G: Update to 2022.10.3.
Bug fixes only.
2023-03-27 21:56:10 -04:00
Augustin Cavalier 90d34dcaf0 freebsd_network: Rework callout_stop implementation.
From the FreeBSD manual pages:
> If the callout is	currently being	serviced and cannot be stopped,
> and at the same time a next invocation of	the same callout is also
> scheduled, then callout_stop() unschedules the next run and returns
> zero.

Previously we would return zero but not unschedule the next run.
This may fix #18315.
2023-03-24 11:34:34 -04:00
Augustin Cavalier c650846d9e vm: Replace the VMAreas OpenHashTable with an AVLTree.
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
2023-03-24 10:53:52 -04:00
Augustin Cavalier f6fad5e8c2 src/test: Remove "sock".
Now available via HaikuPorts if needed.
2023-03-14 15:23:24 -04:00
Augustin Cavalier f3dc3eabfc Mail: Increase the minimum size of the attachments view.
This restores approximately the old fixed size from before the
previous commit. Ideally this would be the preferred size, not
the minimum size, but that isn't quite possible when contained in
a scroll view.
2023-03-14 15:08:41 -04:00
Augustin Cavalier e76f360a15 Mail: Refactor the Attachments (Enclosures) views to use layouts.
This does not fix all the problems with their appearance,
but it does fix some of them, and paves the way for further fixes
to be made.
2023-03-14 15:00:34 -04:00
Augustin Cavalier 5292bd2993 ActivityMonitor: Adjust last commit for style. 2023-03-10 10:53:29 -05:00
Augustin Cavalier 338570d8d6 debug_server: Remove duplicate setting of B_FLOATING_ALL_WINDOW_FEEL. 2023-02-28 22:08:47 -05:00
Augustin Cavalier 4f3a8009e1 debug_server: Make crash prompt appear above all other windows.
With B_MODAL_WINDOW, others can be brought in front. But with
B_MODAL_WINDOW_LOOK plus B_FLOATING_ALL_WINDOW_FEEL, it will
retain its current appearance, but always stay on top of all other
windows.

Since debug_server does not have a Deskbar entry, this will prevent
such windows from getting "lost" and then having to minimize all others
in order to find them (or forgetting about them altogether by accident.)
2023-02-28 20:25:15 -05:00
Augustin Cavalier 8a5fc3866a openbsd_wlan: Synchronize net80211 with OpenBSD. 2023-02-28 20:09:12 -05:00
Augustin Cavalier dd430c69f2 idualwifi7260 & iaxwifi200: Synchronize with OpenBSD. 2023-02-28 20:07:29 -05:00
Augustin Cavalier b7cc4167b7 tests: Add missing Jam rule for mmap_cut_tests. 2023-02-28 19:36:26 -05:00
Augustin Cavalier 9ed77019b6 tests: Add mmap_cut_tests.
Tests #17556 and #16936. Loosely based on X512's example program.
2023-02-28 19:35:17 -05:00
Augustin Cavalier bc35a6e445 kernel/vm: Prohibit offset from being < 0 in mmap.
POSIX seems to be silent about whether this is permitted,
but at least FreeBSD explicitly does not allow it.

Fixes #16936.

Change-Id: If6b23410ae88245e706df77d276234f4775654f9
2023-02-28 19:34:30 -05:00
Augustin Cavalier 0ecd7516de Package Kit: Use an object_cache in kernel mode for decompression buffers.
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.
2023-02-28 13:49:00 -05:00
Augustin Cavalier 4e51d4b707 packagefs: Use object_cache_delete instead of calling a destructor manually.
No functional change.
2023-02-28 13:48:53 -05:00
Augustin Cavalier ded3731e44 netfs: Include bsd/features.h.
Fixes the build.
2023-02-28 09:49:45 -05:00
Augustin Cavalier 552ac089cf nfs & websearchfs: Drop unused fsproto.h.
Also remove #ifdefs for BeOS.
2023-02-28 09:46:23 -05:00
Augustin Cavalier 79bc16ba6e Rewrite <netdb.h> and drop a lot of non-standard stuff.
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.
2023-02-27 22:51:17 -05:00
Augustin Cavalier 9ae547b297 data/network: Use ports & services files from OpenBSD.
This cuts out a lot of unnecessary protocol entires found in the
longer NetBSD (and originally from ISC) lists. This data is used
in the implementation of getservent(), etc.
2023-02-27 22:01:12 -05:00
Augustin Cavalier 6d36f6bfad netdb: Drop definitions for getipnodeby...
We do not actually export them, or even have source for them in-tree.
2023-02-27 21:11:49 -05:00
Augustin Cavalier 08f748dea7 Deskbar: Remove B_TRANSLATE_SYSTEM_NAME and leave a comment as to why.
Fixes #18206. Related to #18251; a better way to accomplish finding
views without scripting should be added, really.
2023-02-24 11:38:20 -05:00
Augustin Cavalier 36e200e2e0 sys/uio: Add preadv/pwritev.
Fixes #18243.

Change-Id: Ib5867f86100430f5e5c43ce4b2d6d561f546cc1e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6068
Reviewed-by: waddlesplash <[email protected]>
2023-02-24 16:31:51 +00:00
Augustin Cavalier 4c442eb0b8 remote_disk: Fix B_GET[_BIOS]_GEOMETRY ioctls.
They were incorrectly modified in	688acf41a3.

Fixes #18277.
2023-02-22 16:13:21 -05:00
Augustin Cavalier dc509bfab4 fs_shell: Use proper readv/writev functions on Haiku hosts.
Fixes #18269.
2023-02-18 11:38:48 -05:00
Augustin Cavalier 050515f6ae BFS: Fix missing trim of last range in a corner case.
The previous logic of _AddTrim plus _TrimNext meant that if a trim
range was specified in the final call to _TrimNext (i.e. with force=true),
but the trim buffer was already full at that point, that last range
would not actually be trimmed.

Now, _AddTrim returns true when the buffer is filled and trimming
should be done, rather than delaying it and requiring a second
add after trimming.

Change-Id: I4b782948e8dc9267c63e61bce0c078fd4e834177
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6070
Tested-by: Automation <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2023-02-17 20:21:24 +00:00
Augustin Cavalier c97648aad1 docs/user: Use Doxygen's internal search system.
Fixes #17209.
2023-02-15 16:49:45 -05:00
Augustin Cavalier f7b2278e28 docs/user: Update Doxyfile to Doxygen 1.9.6.
Automated conversion via "doxygen -u". No changes to settings otherwise.
2023-02-15 16:45:53 -05:00