Commit Graph
100 Commits
Author SHA1 Message Date
Augustin Cavalier 123fa38638 usb_audio: Add to regular image.
Requires multiple media server restarts to switch
outputs to it, but that's a known media services
problem (#12777 and #12776.)

Input doesn't work quite right with the hardware
I've been testing with, but that's also a known
problem it seems (#9951). Meanwhile, output
seems to work pretty well, once it gets going.
2024-01-31 23:05:43 -05:00
Augustin Cavalier 3a9063ba08 usb_audio: Increase default buffer size to 2048 samples.
Ultimately this is just a minimum, in reality
we round up to the nearest page size and use
that to determine how many packets we queue
at once.
2024-01-31 22:44:13 -05:00
Augustin Cavalier 62ec294959 XHCI: Don't double-report completion status for isochronous transfers. 2024-01-31 14:49:00 -05:00
Augustin Cavalier b785b0cf1c usb_audio: Report callback errors to syslog.
That way they don't just get lost.
2024-01-31 14:39:33 -05:00
Augustin Cavalier f4e363ee29 XHCI: Report ring overrun/underrun (isochronous errors) back to drivers.
Since transfer status is reported via the packet descriptors, we
can report the endpoint status through the callback status.

Reduces syslog spam when using the USB audio driver.
2024-01-31 14:36:52 -05:00
Augustin Cavalier be3ce6d7e9 USB: Make "buffer error" reporting consistent.
This error means that the controller failed to read or write data
to/from system memory fast enough. As a result, we should report it
as READ_ERROR/WRITE_ERROR, rather than something that sounds like
an error with the device itself.

Then, make BABBLE reporting consistent: this is a data overrun/underrun
of the device itself, not the buffers passed to the controller.
This then leaves B_DEV_FIFO_OVERRUN/UNDERRUN unused, and thus usable
for reporting ring overrun/underrun on isochronous transfers.

The API documentation already described DATA_OVERRUN/UNDERRUN basically
like they were babble errors, while FIFO_OVERRUN/UNDERRUN are
currently described as "internal errors" at present. No driver actually
checked for these.
2024-01-31 13:55:40 -05:00
Augustin Cavalier 22f0158a25 XHCI: Move error status conversion to its own function and reuse it.
Also add COMP_MISSED_SERVICE -> B_DEV_TOO_LATE while at it.
2024-01-31 13:47:34 -05:00
Augustin Cavalier dbc23cdfb7 userlandfs: Allocate requests in-kernel as kernel-only.
Things still seem to work, and may fix some SMAP
violations.
2024-01-30 21:44:02 -05:00
Augustin Cavalier 41a1732deb userlandfs: Disable use of the file cache in FUSE for now.
It still needs more work, it appears.

Fixes #18746.
2024-01-30 21:43:26 -05:00
Augustin Cavalier d385686cbf userlandfs: Make DoIO handle IO smaller than the request size properly.
When _InternalIO returns with "bytes" smaller than the
original request, this isn't an error (or something we
should retry), but just something we need to pass on.

Fixes part of #18746. However, even after this commit,
file reads don't work quite right: reading past the end
of a file returns errors instead of just no data.
2024-01-30 21:43:00 -05:00
Augustin Cavalier ed574cce93 TTY: Return success on partial writes.
Otherwise the calling program will think that
no part of the write succeeded, when in fact
it did.

tty_read() already did this correctly. Not sure
how this wasn't uncovered previously.

Fixes #18447.
2024-01-30 16:01:21 -05:00
Augustin Cavalier ef1427bb58 PowerStatus: Add logic to automatically install in Deskbar.
Modeled after NetworkStatus. Also add it to
default_deskbar_items.sh.

Fixes #18748.
2024-01-30 14:44:28 -05:00
Augustin Cavalier 6a47944773 kernel/condition_variable: Add another check of the wait status after _RemoveFromVariable.
If it was set, we want to return it.
2024-01-30 14:22:54 -05:00
Augustin Cavalier a162e7af99 desklink: Size custom items based on Deskbar's current icon size.
Fixes #18757.
2024-01-30 14:18:29 -05:00
Augustin Cavalier b2720cd3d9 BScrollView: Don't adjust other dimension if it's negative.
Some non-layout applications start out with negative
view dimensions. Making them positive too early on can
break the view's appearance, it seems.

Fixes #18690.
2024-01-30 13:52:56 -05:00
Augustin Cavalier 230de61bd6 registrar: Truncate the recent apps/entries lists to 100 items.
The constant can easily be changed if needed.

Fixes #18737.
2024-01-30 13:44:45 -05:00
Augustin Cavalier 4fec81750d TCP: Refactor sending logic.
* Break segment setup out into its own method.

 * Break the actual sending logic out into its own method.
  - While at it, remove some old/obsolete comments and
    rearrange some of the logic to match.

 * Separate the send-pure-ACK and send-data methods.
  - This way, the "force" parameters will act differently,
    specifying "force" to SendAcknowledge() may generate
    a duplicate ACK, while to SendQueued() it will either
    send data smaller than a segment size, or do nothing.

Functional changes should be minor, and the code
meanwhile should be much easier to read.

Change-Id: I1e14b9a1e3b7c8b2d3bf8ae30f1369d8c9f662a4
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7361
Reviewed-by: waddlesplash <[email protected]>
2024-01-30 17:34:27 +00:00
Augustin Cavalier d2f65e76ee OHCI: Remove unused variable following previous commit. 2024-01-30 00:43:57 -05:00
Augustin Cavalier 8c458fc42b USB: Initialize packet descriptors inside the stack.
Allows deletion of generic code from bus drivers.
2024-01-30 00:39:47 -05:00
Augustin Cavalier 02f5db9104 usb_audio: Always USB_ISO_ASAP rather than scheduling transfers by frame.
Seems to make things work much better.
2024-01-30 00:16:07 -05:00
Augustin Cavalier 005ba2b47d usb_audio: Do not use any timeout in _MultiBufferExchange.
The other multi-audio drivers do likewise.
2024-01-30 00:14:49 -05:00
Augustin Cavalier 1f6757e31f XHCI: Overhaul isochronous transfer handling.
* Each packet needs to be its own TD.

 * All transfers are scheduled in frames, not microframes.

Combined with a few fixes to the USB audio driver, this seems
to get things working much better than before.
2024-01-30 00:14:23 -05:00
Augustin Cavalier d49d21bba0 graphics/virtio: Disable tracing.
Reduces syslog spam.
2024-01-29 22:52:37 -05:00
Augustin Cavalier 6eaaa52128 usb_disk: Cancel queued transfers on the interrupt endpoint in removed().
May help with some KDLs.
2024-01-29 22:06:34 -05:00
Augustin Cavalier 5c2c391d20 TCP: Remove overridden default buffer size.
The default of 65535 now seems to work OK,
following previous commits.
2024-01-29 16:06:25 -05:00
Augustin Cavalier c4f37b0017 TCP: Initiate a send before waiting in SendData().
Otherwise, we will sit around here waiting forever,
with the send queue full but nothing actually sending
data.
2024-01-29 16:05:54 -05:00
Augustin Cavalier 0382176581 IPv4: Overall MTU is 65535 (0xFFFF).
If the route supports a greater MTU, we need to
clamp it.

The loopback reports an MTU greater by one byte
(65536), and if we don't clamp it here, TCP will
try to send packets actually that large (and fail.)
2024-01-29 16:05:11 -05:00
Augustin Cavalier 4fbebc21b8 registrar: Back out change to convert case in B_REG_MIME_GET_SUPPORTING_APPS.
This reverts commit 3ab43722bf.

Now that GetSupportingApps does case conversion, we don't need to do it here.
2024-01-26 18:20:35 -05:00
Augustin Cavalier cdf3559b27 Storage Kit: Do case conversion in SupportingApps::{Get,Set}SupportedTypes.
We already convert everything to lowercase in BuildSupportingAppsTable(),
so we should do the same here.

Fixes #18752 (again.)
2024-01-26 18:19:16 -05:00
Augustin Cavalier 89fcf815e6 Storage Kit: Source clean up to SupportingApps.
Remove extraneous comments, early-return on error (and thus de-indent.)
No functional change intended.
2024-01-26 18:09:33 -05:00
Augustin Cavalier 94d33dcbb6 XHCI: Rework _LinkDescriptorForPipe to avoid double-links.
The previous logic would link from the end of the ring to the start,
and the TRB there would always itself be a link TRB. Now, we avoid this
by linking back to the start from within the TD segments, and putting
the "Event Data" TRB there.

May help with some problems.

Change-Id: I92c4e135ee28c8c89646594a99fb40ee0d6c4484
2024-01-26 17:36:26 -05:00
Augustin Cavalier 45436c7a67 freebsd_iflib: Remove workaround for multi-packet receive.
Following the last commit, we can just let if_input
process the whole chain at once.

The logic here may not have been correct, and possibly
caused memory leaks under high-traffic conditions.

May help with #18585 and others.
2024-01-26 16:02:48 -05:00
Augustin Cavalier 9504fccf29 freebsd_network: ether_input needs to support multiple packets.
It does on FreeBSD, though not many drivers make use
of this functionality (on Haiku, only iflib appeared to,
and it has a workaround at the moment.)
2024-01-26 16:00:13 -05:00
Augustin Cavalier 17aa6d0125 IPv4: Make header fields go out of scope when no longer usable.
There was a comment indicating where this happened, but then
there was a use of one of them after this point. Fix that,
and add { } around their use to prevent this from happening again.
2024-01-26 14:32:59 -05:00
Augustin Cavalier aeb3a97aba XHCI: Properly handle "Length invalid" and erroring TRBs on the endpoint ring.
Should improve #18432 and other tickets.

Change-Id: Iaafe2d9d61bc0514e4dd6283b9e75496d5e2d44a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7341
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2024-01-18 19:14:04 +00:00
Augustin Cavalier a2270c7035 kernel/vm: Avoid committing memory in vm_map_file for PRIVATE_MAP without PROT_WRITE.
Instead, rely on commitment being done later, when the
protections are changed. set_area_protection() already
did just that, but set_memory_protection did not, so
it is implemented here.

Fixes #18733.

Change-Id: Ia58aee93faf1296fce69d723b12d0fa0a8440706
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7339
Reviewed-by: waddlesplash <[email protected]>
2024-01-17 20:21:30 +00:00
Augustin Cavalier e5e1f48bf5 PCI: Convert constant missed in prior commit. 2024-01-15 15:24:58 -05:00
Augustin Cavalier fabb71cc0e PCI: Support more than 6 PCI memory ranges.
Also use the standard kernel-wide constants for IO or memory space
rather than defining new ones, as well as the PCI constants for
address types.

Change-Id: Iad03f7666ad5121a5c9a398339aa1a191339a1d1
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7336
Reviewed-by: waddlesplash <[email protected]>
2024-01-15 20:18:57 +00:00
Augustin Cavalier 6533df4fe4 iaxwifi200 & idualwifi7260: Synchronize with OpenBSD. 2024-01-15 14:12:49 -05:00
Augustin Cavalier 7bcc4a30f9 openbsd_wlan: Synchronize net80211 with OpenBSD. 2024-01-15 14:12:09 -05:00
Augustin Cavalier 2fb174a701 kernel/fs: Add missing initialization. 2024-01-10 12:51:10 -05:00
Augustin Cavalier 79c0b6288f kernel/fs: Make vnode_path_to_vnode and derived methods take VnodePutter&.
Upcoming changes will make this method return values in _vnode even
when they return error codes under some conditions. To avoid easily-
caused memory leaks, this commit refactors the output variable to
be VnodePutter&, and all consuming methods to thus make use of Putters.

Should not be a functional change.

Change-Id: Id7b9066f8cd50c159d52c921b16e475e4e1de806
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7301
Reviewed-by: waddlesplash <[email protected]>
2024-01-10 17:43:46 +00:00
Augustin Cavalier bb09458028 kernel/vfs: Convert from custom VNodePutter to the generic VnodePutter.
The latter is actually an AutoDeleter based on CObjectDeleter.
No functional change intended.
2024-01-08 15:14:09 -05:00
Augustin Cavalier 76f69a9e77 kernel/fs: More usage of FileDescriptorDeleter.
Remaining non-uses are mostly in specialized functions that e.g. operate
on many file descriptors at once (like vfs_exec_io_context.)

Reduces "goto"s. Should not have any functional change.
2024-01-08 14:57:38 -05:00
Augustin Cavalier 1bde6f6c36 kernel/fs: Standardize AutoDeleters for file_descriptor on FileDescriptorPutter.
No functional change intended.
2024-01-08 14:52:14 -05:00
Augustin Cavalier fa766875af kernel: Rename DescriptorPutter to FileDescriptorPutter.
For consistency. No functional change.
2024-01-08 14:11:30 -05:00
Augustin Cavalier 1322e37a03 docs/user: Fix typo. 2024-01-08 14:07:53 -05:00
Augustin Cavalier 12bba3817d nvme, mmc: Fix SMAP violations in B_GET_MEDIA_STATUS.
Fixes #18736.
2024-01-06 12:07:25 -05:00
Augustin Cavalier 141cc59300 TCP: Actually invoke SendQueued when the window widens.
IMMEDIATE_ACKNOWLEDGE invokes SendQueued ... but with
a send window size forced to 0, so it just generates an
ACK (or a duplicate ACK as the case may be), and doesn't
actually trigger sending of data.

So, adjust the check, introduce a new action flag, and
invoke it properly.

Fixes traffic stalls caused by waiting for the
persist timeout to occur.

This amends hrev51540 (yes, from 2017.)

Change-Id: I6344463938cfaa0134bb8cf3e224789cded0987c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7285
Reviewed-by: waddlesplash <[email protected]>
2023-12-31 03:36:27 +00:00
Augustin Cavalier d7c71d7b49 TCP: Coalesce more ACKs in DelayedAcknowledge.
First, we don't need to generate ACKs for every other
segment received, only every second full-size segment
or within 500ms, as the comment notes. So check the
receive window size before deciding to send an ACK
immediately.

Second, let the timeout routine handle sending the ACK
even in the immediate invocation case. This way, we
don't spend time in receive routines waiting for the
send path locks, and also multiple packets received in
quick succession will have one ACK generated instead of
many.

Also, following the previous commit, the timeout routine
will avoid generating duplicate ACKs now. In the case
where a duplicate ACK really needs to be generated,
DelayedAcknowledge won't be used anyway.

Inspired by ambroff's remarks and patch in
comment:14 of #18203.

Greatly reduces the number of ACKs generated,
and increases throughput due to less duplicate ACKs
causing congestion logic to kick in.

Change-Id: I37991464b1a802aceb3e2b453df8dc4cb2e14ce5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7284
Reviewed-by: Alex von Gluck IV <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2023-12-31 03:36:27 +00:00
Augustin Cavalier 5e7d399ef4 TCP: Check state in Persist and DelayedAcknowledge timeouts.
As the comment already notes, it's possible that we wind up
in the timeout routine despite the timer being cancelled, if
the cancellation was done after execution was in progress.

In either case, do not invoke Send if there is nothing to do,
as invoking Send...(force = true) will generate a duplicate ACK.
Duplicate ACKs will be noticed by the remote end as a sign of
congestion, so we don't want that to happen.

Change-Id: Iac30c140c322ccf0b0477e434459e7674bc24e1a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7283
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Alex von Gluck IV <[email protected]>
2023-12-31 03:36:27 +00:00
Augustin Cavalier 265e1e4d6a TCP: Update implementation comment at the top of the file.
A variety of things marked "not implemented" actually are,
at least partially, but the comment was not adjusted.

Change-Id: I760cca8ef3f601d27c0143f7dc75f5049d02f899
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7282
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Alex von Gluck IV <[email protected]>
2023-12-31 03:36:27 +00:00
Augustin Cavalier 6b7fde3300 tcp_shell: Don't include dropped packets in the dump.
Otherwise it's just confusing.

Change-Id: Ic88550c05a957b06917cfc08d1163ffe5b2e0652
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7281
Reviewed-by: Alex von Gluck IV <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2023-12-31 03:36:27 +00:00
Augustin Cavalier dc8bc8c1ce tcp_shell: Add send_loop command.
Useful for sending more data than fits in one buffer.
With "send_loop 100m", the traffic stalls are readily
reproduced.
2023-12-30 16:30:14 -05:00
Augustin Cavalier dbb0ad7129 tcp_shell: Fix crash on close. 2023-12-30 16:29:37 -05:00
Augustin Cavalier 87cfc3b883 tcp_shell: Support dumping packets to a pcap file.
For analysis in Wireshark (and other tools.)
It should be possible to use this mode with
a FIFO for real-time analysis, too.
2023-12-30 15:55:09 -05:00
Augustin Cavalier 295124473f tcp_shell: Fix build and revive.
It works!

I think this was last used in 2008 or thereabouts.
The various TCP refactors in the interim likely
would have profited from it...
2023-12-29 15:51:26 -05:00
Augustin Cavalier 819c51084f network: Update device statistics (mostly) in the stack.
We bypass device logic in datalink_send_routed_data() in the case
of RTF_LOCAL, so if we don't update the stats there, they'll never
get updated. Furthermore, there's places packets can be dropped
inside the device reader thread. So, we might as well consolidate
the stats-updating logic and get it out of drivers.

(The only remaining case where drivers need to update stats is when
they drop a packet in receive(), as the stack can't tell when an error
from receive() is due to a dropped packet or not.)

Fixes a potential leak on packet drops in the device reader thread,
and fixes loopback statistics for TCP/UDP/etc.
2023-12-29 12:59:24 -05:00
Augustin Cavalier 45b72f4c60 pkgman: Use natural sorting in "search" output.
Fixes #18676.
2023-12-23 23:05:08 -05:00
Augustin Cavalier 0387c6accb Network: Do not default to Wi-Fi icons in the Interfaces preflet.
At least TUN/TAP don't appear with the "wireless" icon anymore.
2023-12-23 22:36:51 -05:00
Augustin Cavalier 094f638456 kernel/vm: Perform area ownership check before protection check.
This way we do not "leak" area protection status (not really a
significant concern at the moment, but might as well while I
was looking at this.)
2023-12-23 22:31:28 -05:00
Augustin Cavalier 04f148c74a kernel/vm: Allow B_CLONEABLE_AREA flag to be added through set_area_protection. 2023-12-23 22:28:57 -05:00
Augustin Cavalier 64408be772 acpi: Fix copy/paste error in GlobalLock functions.
Should fix #18701.
2023-12-07 16:08:44 -05:00
Augustin Cavalier f7fb846f5b Tracker: Store the correct time value in the thumbnail creation attribute.
We were storing real_time_clock_usecs() but comparing against
BStatable::GetModificationTime() which is just a time_t. The
values were thus displayed wrongly in the "Get Info" window,
but also thumbnails would not have been updated when the file was.

Should fix #18691 and possibly some other tickets.
2023-11-30 17:42:08 -05:00
Augustin Cavalier b6c24e6b40 network: Overhaul TUN/TAP subsystem.
* Rename the "tun" network device to "tunnel". FreeBSD calls theirs
   "tuntap" but speaks of both TUN and TAP devices as interfaces for
   tunnels. The other BSDs seem to do likewise.

 * Fold the "tun" driver into the "tunnel" network device. The
   network device now publishes entries in devfs when interfaces
   are created, and unpublishes them when interfaces are destroyed.

   This removes the need for the driver and device to communicate
   through a file descriptor, and thus allows the receive queue
   to be totally eliminated, massively simplifying that logic.

 * Use standard net-stack FIFOs instead of TCP BufferQueue, which is
   specialized to TCP's needs in far too many ways. Thanks to the
   previous commit adding support for interrupting semaphore waits,
   we can use the FIFO wait mechanisms, too.

 * Restructure the TAP logic, and generate MAC addresses more like
   Linux does.

 * Actually set type = IFT_TUN, and use the "loopback" frame handler
   instead of the "ethernet" frame handler. This allows significant
   cleanup of the header handling logic.

 * In TUN mode, reject packets that don't look like IP packets.

 * Delete "tunconfig"; it was mostly stubs and is now unnecessary.

TUN mode tested and confirmed as working by kallisti5 with OpenVPN.
TAP mode partially tested, but not yet confirmed as working.

Fixes #18673.

Change-Id: Ibd803139474e8db556a4f567901da15ee4083621
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7143
Reviewed-by: Alex von Gluck IV <[email protected]>
2023-11-30 20:44:44 +00:00
Augustin Cavalier daf1dd9c40 kernel/sem: Use "count" as thread_unblock status in B_RELEASE_ALL.
Previously, "count" did nothing for B_RELEASE_ALL. Now, if it is
< 0, it will be the error code returned by acquire_sem() of any
waiting threads.

As B_RELEASE_ALL is a Haiku extension, this change should not
cause any compatibility problems that we cannot fix.

This will be useful in implementing some features of TUN/TAP
with network FIFOs.

Change-Id: I2dbccedefac2024fe740b87543ff3b80f5257e20
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7163
Reviewed-by: waddlesplash <[email protected]>
2023-11-30 20:44:44 +00:00
Augustin Cavalier 255314f734 libroot: Make stpncpy compatible with GCC2. 2023-11-28 21:47:39 -05:00
Augustin Cavalier 611d3d7803 BSocket: Fix swapped parameters in Bind().
Spotted by X512.
2023-11-28 20:41:02 -05:00
Augustin Cavalier 15a3f4c540 libroot: Add stpncpy.
Imported from musl.

It is in POSIX.1-2017.
2023-11-28 20:37:15 -05:00
Augustin Cavalier 783aa308c3 network/stack: Clean up socket_receive.
* Reshuffle variable declarations, most are placed much
   closer to first usages now.

 * Turn a confusingly worded comment into an ASSERT(),
   and remove another one that was outdated.

 * Fix some minor code style problems.

 * Make the copying logic more consistent between first
   and then subsequent copies.

 * Make it possible for B_BAD_ADDRESS (EFAULT) to be
   returned. This is not listed in POSIX, but as per
   online sources, at least Linux does do this.

Change-Id: Idcfbed30531c1ab4796c4ee37f7f4ce8078e535b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7147
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2023-11-27 17:10:19 +00:00
Augustin Cavalier 2926dfaa3f network/stack: Fix handling of MSG_TRUNC in socket_receive.
This is a Linux extension (which at least FreeBSD has also
adopted.) It's used in the Haiku port of libpcap (where it's
a necessity) and wpa_supplicant (where it wasn't, and I
removed it.) It seems that we've had it for quite some time.

Fixes tcpdump following addition of flag checks.
2023-11-24 23:07:18 -05:00
Augustin Cavalier ceeea27b72 freebsd_wlan: Fix compilation of ieee80211_ioctl.h under GCC2 in C mode.
GCC2 tolerates [] FLAs in C++ mode but not in C mode, as discovered
when trying to build wpa_supplicant against R1/beta4. A workaround
was added there for now, but this is the more general solution.
2023-11-24 12:57:07 -05:00
Augustin Cavalier 459fa41f17 network/stack: Get rid of socket_readv and socket_writev.
These have not been used in years (maybe since the redesign of the
network stack?). Only socket_writev had an implementation, which was
mostly just an incomplete version of socket_send.

Scatter/gather I/O is already supported via msghdr's msg_iov/len fields,
so this is redundant anyway.

Change-Id: If41c4f4ee021856f6db49c7cb95422a9c1aa7700
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7127
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2023-11-24 16:28:38 +00:00
Augustin Cavalier 5188904bfa loopback: Actually update device statistics.
ifconfig shows numbers other than 0 for the loopback interface now.
2023-11-23 15:03:21 -05:00
Augustin Cavalier 75874bab1a ethernet: Device statistics must be updated using atomic operations.
Both send and receive can be called concurrently, and there aren't
any locks protecting these fields, so they must be updated with atomics.
2023-11-23 15:02:45 -05:00
Augustin Cavalier 6461885e2e TUN: Remove redundant comments.
They only described things that the function names and parameters
already indicated. As per the Coding Guidelines, such excessive
commenting is to be removed.

Also fix some other (minor) code style issues while at it.
2023-11-23 14:27:40 -05:00
Augustin Cavalier c1f1032016 network/stack: Enumerate TUN after loopback. 2023-11-23 14:24:35 -05:00
Augustin Cavalier a1d837369f lgtm.yml: Delete.
"LGTM" code scanning was bought out and merged into GitHub Actions.
The code scanning setup there has a different mechanism for configuration,
and so this file is not useful anymore.
2023-11-23 13:46:19 -05:00
Augustin Cavalier e1480b40af ext2: Adjust short and pretty names to just be "ext" and not "ext2".
The filesystem name returned by read_fs_info will be correct (i.e.
returning "ext3" or "ext4" as appropriate), but some things just list
the filesystem driver's name, which can cause confusion.

Change-Id: Ic4acf497fc5db5c167131aeb323b45eeb78594d6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7126
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
2023-11-23 18:20:04 +00:00
Augustin Cavalier 973f6d3320 network: Migrate SIGPIPE generation into the socket module.
This removes the burden of determining whether to and then
actually sending SIGPIPE from the protocol modules, meaning
the MSG_NOSIGNAL flag can now be implemented entirely in
the socket module and not even passed further down the chain.

Change-Id: I9ba976c4aff60d533cb4b390bbba1560c0de423f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7124
Reviewed-by: Jérôme Duval <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2023-11-23 06:51:39 +00:00
Augustin Cavalier da2f2c65b7 network/stack: Mask off MSG_NOSIGNAL at the top of socket_receive.
Fixes WebKitGTK spinning endlessly and spawning lots of
short-lived worker processes following the addition of
flag checks and EOPNOTSUPP to the various socket modules.

Change-Id: I6d944b4d0235eea9e8a9333645fcb531805f340f
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7123
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2023-11-23 06:23:12 +00:00
Augustin Cavalier e7371da8b5 network/stack: Add back a #pragma mark. 2023-11-22 12:04:38 -05:00
Augustin Cavalier 407d3f1046 network/stack: De-templatize base_fifo methods.
Following the removal of the "Fifo" class, they
do not need to be templated anymore.
2023-11-22 12:00:02 -05:00
Augustin Cavalier 0b829b1151 network/stack: Remove unused "Fifo" class.
Its declarations were moved from another header to this file
in 2008, with a comment in the commit message and a TODO here
questioning whether it was needed for anything. In the 15 years
since then, nothing has used it.
2023-11-22 11:47:52 -05:00
Augustin Cavalier 4100480724 network/stack: Return EOPNOTSUPP when unhandled flags are specified.
This method is invoked directly in some protocols, e.g. L2cap (Bluetooth.)
2023-11-22 11:41:18 -05:00
Augustin Cavalier 73eb03214e net/ProtocolUtilities: Return EOPNOTSUPP when unhandled flags are specified.
Same as has already been done for UNIX domain sockets and TCP
(this is used in the implementation of UDP.)
2023-11-22 11:40:02 -05:00
Augustin Cavalier 42e4cb759a net/ProtocolUtilities: Correct implementation of MSG_DONTWAIT.
We don't want to restore the timeout from a restarted syscall
if MSG_DONTWAIT has been specified.
2023-11-22 11:39:29 -05:00
Augustin Cavalier fca1b0ec50 protocols/tcp: Return EOPNOTSUPP when unhandled flags are specified.
Same as was done for UNIX domain sockets in 74a44f5aed.
2023-11-21 23:36:07 -05:00
Augustin Cavalier 93a6528df8 protocols/tcp: Correct implementation of MSG_DONTWAIT.
Waiting for state changes correctly checked MSG_DONTWAIT,
but the overall data timeout only did in ReadData, not
SendData. This corrects that and makes the implementation
more consistent overall.
2023-11-21 23:34:59 -05:00
Augustin Cavalier f860cfc76c protocols/tcp: Correct implementation of MSG_NOSIGNAL.
The other send_signal invocation correctly checked NOSIGNAL already.
2023-11-21 23:34:33 -05:00
Augustin Cavalier 3bae07fc29 protocols/unix: Implement MSG_NOSIGNAL.
Same logic as in the TCP protocol module.

This fixes a regression from hrev57383: curl now works
again. (Perhaps it shouldn't be called a "regression",
though, but instead an uncovered bug / missing feature.)

Fixes #18666.
2023-11-16 12:08:47 -05:00
Augustin Cavalier 74a44f5aed protocols/unix: Return EOPNOTSUPP when unhandled flags are specified.
Fixes the "bug" part of #18653 (however the flags still need to
actually be implemented.)

Change-Id: Icd296af8b409416317ba3d02735504729949fd08
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7109
Reviewed-by: Niels Sascha Reedijk <[email protected]>
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Jérôme Duval <[email protected]>
Reviewed-by: waddlesplash <[email protected]>
2023-11-15 16:33:38 +00:00
Augustin Cavalier eb4d2229f0 Debugger: Select "local" interface if none specified in MSG_DEBUG_THIS_TEAM.
The debug_server sends MSG_DEBUG_THIS_TEAM but of course it doesn't
have a way to specify the internal interface pointer. We should thus
assume the local one is implied.

Fixes #18645, which is not a regression but has been the case since
the initial host-interface refactors years ago, apparently.

Change-Id: I48078232f154f2f8f7cdf28792d39ae58471ce19
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7074
Reviewed-by: Jérôme Duval <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2023-10-30 23:57:14 +00:00
Augustin Cavalier e8d328979c ICUTimeConversion: Fix buffer overflows and add more error handling.
* Declare databridge buffer lengths in LocaleBackend.
 * Use strcpy instead of strlcpy when writing to databridge buffers
   (this is the first fix for #18598.)
 * Check for overflows and error out when they happen.
 * Verify that ICU actually knows the timezone in question
   and fall back to GMT if it does not (this would also fix that crash.)

Fixes #18598.
2023-10-28 16:36:12 -04:00
Augustin Cavalier c199c568de DebugAnalyzer: Fix -Werror=mismatched-new-delete. 2023-10-28 14:20:31 -04:00
Augustin Cavalier bb2808d615 bootloader: Implement TSC calibration via hypervisor CPUID leaf.
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 <[email protected]>
2023-10-25 00:53:55 +00:00
Augustin Cavalier b8fbb723ea fs_shell: Use UINTPTR_MAX not LONG_MAX.
Fixes the build after the previous commit.
2023-10-24 19:16:19 -04:00
Augustin Cavalier 5c040b731c People: Fix buffer overflow in string handling.
Also move some variable declarations closer to their usages.

Fixes #18618.
2023-10-23 22:15:27 -04:00
Augustin Cavalier de9f473cda Terminal: Colors are stored using untranslated names.
The previous code did not work on non-English locales,
a problem readily detectable when running in Terminal
inside a Terminal session, e.g.:

PrefHandler::getRGB(Hintergrund) - key not found

Fixes #18614.
2023-10-23 21:29:12 -04:00
Augustin Cavalier 8764a29843 build/jam: Only add C++ header directories to include path for C++ code.
There are now some system headers (e.g. <stdatomic.h>) that have outright
different versions for C and C++ which are not compatible with each other.

Change-Id: Ibf797e0817f0fe4d5241424d7d06023b19888c02
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6991
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
2023-10-13 16:18:47 +00:00