Commit Graph

65598 Commits

Author SHA1 Message Date
PulkoMandy
30e762a797 bluetooth: fix unused but set variable
Change-Id: Ie63b0a28c352bc9997a2a70b3e335af2b3cc1bc3
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6714
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-07-29 15:56:19 +00:00
Augustin Cavalier
3386b8b785 libbsd: Add a basic kqueue implementation.
It only supports file descriptors and processes (threads),
and a few flags (not all) to go with them.

This has been tested extensively against libuv.

Change-Id: I6fc5930fa7273698172c9c695965842b5df44f03
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6746
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2023-07-29 15:53:15 +00:00
Augustin Cavalier
f66d2b46a8 kernel: Add event queue implementation to wait for objects efficiently.
Based on hamishm's original patch from 2015, but heavily modified,
refactored, and reworked.

From the original commit message:

> When an object is deleted, a B_EVENT_INVALID event is delivered,
> and the object is unregistered from the queue.
>
> The special event flag B_EVENT_ONE_SHOT can be passed in when adding
> an object so that the object is automatically unregistered when an
> event is delivered.

Modifications to the original change include:

 * Removed the public interface (syscalls remain private for the moment)

 * Event list queueing/dequeueing almost entirely rewritten, including:
  - Clear events field when dequeueing.

  - Have B_EVENT_QUEUED actually indicate whether the event has been
    appended to the linked list (or not), based around lock state.
    The previous logic was prone to races and double-insertions.

  - "Modify" is now just "Deselect + Select" performed at once;
    previously it could cause use-after-frees.

  - Unlock for deselect only once at the end of dequeue.

  - Handle INVALID events still in the queue upon destruction,
    fixing memory leaks.

 * Deduplified code with wait_for_objects.

 * Use of C++ virtual dispatch instead of C-style enum + function calls,
   and BReferenceable plus destructors for teardown.

 * Removed select/modify/delete flags. Select/Modify are now the same
   operation on the syscall interface, and "Delete" is done when 0
   is passed for "events". Additionally, the events selected can be fetched
   by passing -1 for "events".

 * Implemented level-triggered mode.

 * Use of BStackOrHeapArray and other convenience routines in syscalls.

Change-Id: I1d2f094fd981c95215a59adbc087523c7bbbe40b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6745
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2023-07-29 15:53:15 +00:00
Autocomitter
a3f83f646c Update translations from Pootle 2023-07-29 08:25:08 +00:00
PulkoMandy
c75dc6af6b pci and usb header scripts: avoid generating trigraphs
Change-Id: Ifd10f039cebdd3995397ad380b7a2c6ddd437775
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6738
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2023-07-28 09:11:43 +00:00
PulkoMandy
7e80a0ba59 PSD translator: fix mismatched types compiler warnings
Change-Id: I12f0cc2b7f4fea43726425af558641d8e6789a14
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6736
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2023-07-28 09:11:43 +00:00
PulkoMandy
16a112ae7b ext2: fix unused-but-set variable
This variable was introduced in hrev38573 which is the conclusion of
a GSoC project by jvff to add write support to the ext2 driver.
It has been unused for 13 years, I think it is safe to remove.

Change-Id: I8ae4635dbc39f108b769d90b92e5545f8183a10d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6715
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2023-07-28 09:11:43 +00:00
Augustin Cavalier
8b018d9a9f NTFS: Fetch the mount point path during initialization.
Fixes #18490.

Change-Id: I06d4b268f2088ac49ef3bc5d895ab94f219e2177
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6741
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-07-26 19:06:13 +00:00
Augustin Cavalier
387fe2d9a7 userlandfs: Adjust following ConditionVariable changes. 2023-07-25 17:12:10 -04:00
Augustin Cavalier
f64c46e636 kernel & libroot: Implement per-team unnamed semaphores.
This requires breaking syscall ABI to add the "flags" parameter
to _kern_mutex_sem_release.

Resolves a TODO.
2023-07-25 16:26:22 -04:00
Augustin Cavalier
b3b7b89334 kernel/user_mutex: Check that a thread was actually unblocked during handoff.
Otherwise, we will deadlock.

I don't know that this has ever actually occurred; it is very unlikely
due to the write-lock acquisition before unblocking. It could only
occur if a SIGINT was delivered or timeout+wakeup occurred at just
the right moment.
2023-07-25 15:33:07 -04:00
Augustin Cavalier
aca21731ff kernel/condition_variable: Return the count of unblocked threads from Notify.
No reason not to, and it's needed in user_mutex to avoid a very rare
potential race, anyway.
2023-07-25 15:27:40 -04:00
Augustin Cavalier
2cc89328fa kernel/user_mutex: Fix race in user_mutex_sem_release.
We need to be sure nothing will start waiting before marking the
semaphore as uncontended.

Fixes a deadlock observed in libuv.
2023-07-25 15:21:00 -04:00
X512
ae65daec10 kernel/riscv64: remove unused code
Change-Id: Ia140c962b3ae70faac3c9ae19125b0e245326586
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6743
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-07-24 21:18:04 +00:00
Augustin Cavalier
528d532174 userlandfs: Adjust path to Notifications.cpp. 2023-07-24 17:11:45 -04:00
X512
eb4b22adca virtio_mmio: fix logic
- Use separate descriptor count. Queue length and descriptor count do not need to be the same.

- Assotiate cookies with descriptors, not used queue index.

- Use mask instead of modulo operator for better efficiency (queue length is always power of 2).

Change-Id: I5f053287e2a0cfad8da25053c63c42aa06fb238d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6710
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-07-24 21:00:56 +00:00
X512
0235c04759 util/Bitmap: add more utility methods
Change-Id: I021c2fafa01266e8a38c1cb2fd748fd89a4b75bd
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6742
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-07-24 21:00:56 +00:00
Augustin Cavalier
ddde98b06d kernel: Move some source files around.
* stack_protector.cpp now lives with other files in "lib".

 * Notifications.cpp, wait_for_objects.cpp go to a new "events" directory,
   which will soon contain more files related to the event_queue.

No functional change.
2023-07-24 16:23:41 -04:00
Augustin Cavalier
c6cd9b51a2 DoublyLinkedList: Add a RemoveAllBefore convenience function.
Extracted from hamishm's event queue patches.
2023-07-24 16:09:42 -04:00
Augustin Cavalier
a2efc7ec03 AVLTree: Unify removal implementations.
Extracted from hamishm's eventqueue patches.
2023-07-24 16:09:21 -04:00
PulkoMandy
a2b91af97b highpoint_ide: fix unused-but-set variable
Change-Id: I2b6769779682978b5e61166bc4032291bb02bea2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6713
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2023-07-24 18:42:51 +00:00
PulkoMandy
70d3b1028a ps2: mark unused-but-set variable unused to avoid warning
Change-Id: If0073d878cfe4c37ea61bc10459e698ebbb47897
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6712
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2023-07-24 18:42:51 +00:00
PulkoMandy
69657d9d4f ACPI: remove unused-but-set variable
Change-Id: I8095cb13c51c3891cc36dca1b7667041cb6c9df0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6711
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
2023-07-24 18:13:52 +00:00
PulkoMandy
45311bd6f9 usb_rndis: synchronize writes
The write function can be called concurrently by multiple threads. The
way it is implemented now means this desn't work, since there is no
guarantee the correct thread will be released from the semaphore by the
USB completion callback.

I tried to allow mutiple requests to run "in parallel" (really letting
the USB stack schedule them) by having he callback track which thread to
wake up (using send_message/receive_message as a synchronization tool)
but that still resulted in lockups.

The simplest solution is to ensure there is only a single thread doing a
write transaction at a time, which is achieved here with an extra mutex.

Fixes #18521.

Change-Id: I0b737acab6f5665cbe5b0e40a20ce99c16bdf21c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6707
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
2023-07-24 14:47:23 +00:00
Niels Sascha Reedijk
fef51dedd8 mail_daemon: warn about unused return value
GCC 13 warns that using the `begin()` method on a container is marked as
`[[nodiscard]]`. This makes sure that this warning is not treated as an error.

The code actually looks like it does not do much if anything of use. As a
follow-up ticket #18478 is raised.

Change-Id: Ie149f7e02cacda2bcd0be59617583605d5905747
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6655
Reviewed-by: Niels Sascha Reedijk <niels.reedijk@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-07-23 16:48:21 +00:00
Autocomitter
26bda37ca5 Update translations from Pootle 2023-07-22 08:20:18 +00:00
Humdinger
a4e4beafe5 IOM: Localization/String improvements
* Switching mis-used B_TRANSLATE_CONTEXT to B_TRANSLATE_COMMENT
* Use B_TRANSLATE_SYSTEM_NAME for "Icon-O-Matic"
* Remove remnants of old localization system
* Rename "Control Points" to vertex/vertices
* Add a ":" after Undo/Redo
* Sentence casing
* Avoid Yes/No buttons in BAlert

Change-Id: Ibb299925bce1f6ca1cf03216a36df7c44f10bdc6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6704
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-07-21 20:07:46 +00:00
Jérôme Duval
18d6122240 Terminal: support for underline color and styles
the text is now printed above the underline.

Change-Id: I1a3a7713bf514830106532e1534793e0fe158bc2
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6706
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-07-21 18:12:41 +00:00
Zardshard
c5abd6a796 libicon: Notify Shape on transformer addition/removal
hrev57144 accidentally made Shape be notified only if the library was
compiled for Icon-O-Matic.
Also includes some miscellanious improvements.

Fixes #18510

Change-Id: Ie4ae7f9b8b1a5b39f87db2dbf79064fa875b644c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6705
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-07-19 18:04:23 +00:00
Trung Nguyen
b7b57869e8 unix: Implement datagram sockets
Implement `SOCK_DGRAM` sockets for `AF_UNIX` family.

Change-Id: If3d6f408a7d881635ccf04b080391905fdc94b13
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6617
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-07-19 17:16:16 +00:00
PulkoMandy
5a86b40e33 xres: fix extracting resources
Regression introduced in hrev51641 which added braces to fix a
misleading indentation warning. The code was behaving correctly and the
indentation was wrong.

Change-Id: I378ff3ed6209917b44387fc29459b6e492c5eb9c
2023-07-18 21:26:03 +02:00
Trung Nguyen
8e8250e9dd headers: Explicitly hide BAlert functions
Explicitly hide some BAlert functions that ought to have been
deleted. This prevents binding generators from thinking that these
functions are available, causing undefined symbol errors during
link time.

Change-Id: I56f53808851b82a10f31015d2351d4e2c29b6f33
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6718
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-07-18 16:43:33 +00:00
Pascal Abresch
f11b304632 Document Launch flags and Preference directory for findpath
Change-Id: I150c0ca1e0deb5749689bb1019a48efdcdc99def
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6701
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: nephele nephele <nep-git@packageloss.eu>
2023-07-18 16:43:20 +00:00
Alexander von Gluck IV
425ac1b60a refactor: Swap %Ld for %lld in all format usages
* %Ld is an undocumented alias for %lld in glibc.
* muslc doesn't implement it for this reason.
* While we will likely never drop %Ld support,
  lets clean house and set a better example.

Change-Id: Id46dad3104abae483e80cc5c05d1464d3ecd8030
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6636
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-07-17 11:26:21 +00:00
Joachim Mairböck
d110ee8cc1 Icon-O-Matic: properly pluralize command names using BStringFormat
There are languages which have different plural forms than singular for one
and plural for everything else, and even if the number is not shown, having
the correct form looks nicer.

For NudgePointsCommand a helper function was introduced because there the name
is given as a constructor parameter.

Change-Id: I19a4984cf83af6612f2eafbf0920c9ad947d52ce
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6703
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-07-17 11:21:10 +00:00
Augustin Cavalier
71bba69f8a Interface Kit: Add casts to int32 following previous commit. 2023-07-15 09:29:08 -04:00
X512
da70563f7f interface/Size: fix -Wdeprecated-enum-float-conversion warning
Change-Id: I8ca131f57495f974a79292a42ba5ce42a47d2437
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6702
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-07-15 13:10:33 +00:00
Autocomitter
5c868338ec Update translations from Pootle 2023-07-15 08:19:41 +00:00
Augustin Cavalier
1efb33617f Move DeviceList class to hid_shared.
It was shared among 3 different HID drivers, now
there is just one common copy.
2023-07-14 17:07:40 -04:00
Vladimir Serbinenko
e16045db2c i2c_elan: Support I2C Elan devices
They are not HID devices as they need special polling and interpreting. As
a result only descriptor is shared with other i2c HID devices. So it's easier
to have it as a separate driver.

Partially based on FreeBSD ietp driver

Change-Id: Iddc64d216eefeda235a1b15521cba9189dd2ffd8
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6660
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-07-14 20:58:01 +00:00
Zardshard
6427935280 Icon-O-Matic: Generalize some classes
* Turns PathContainer, ShapeContainer, StyleContainer into Container.
* Makes Shape use Container for storing Tansformers instead of
  reinventing the wheel yet again.
* Moves common logic from AddPathsCommand, AddStylesCommand,
  AddShapesCommand, and AddTransformersCommand to AddCommand.
* Factors out common logic from two more commands similar to above.
  This adds the MoveCommand and RemoveCommand classes.
* Cleans up some code style.

Change-Id: I59eca94a1c45eac608514f269f6e5f8628f93fab
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6640
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
2023-07-14 20:56:49 +00:00
Zardshard
a75a222b35 Icon-O-Matic: Remove dead homebrew translation system
Icon-O-Matic uses Locale.h now.

Change-Id: I9722ee76fda47821bf27e6195f8f6ec3d3e1b43e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6700
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-07-11 18:27:10 +00:00
X512
1d9ad3fad7 mmu/riscv64: implement global page mapping support
ASID allocation is not supported yet, so always use ASID 0 for user pages for now.

Change-Id: I021e77dae692c22984bc625dd0588362bece45b7
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6698
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
2023-07-11 17:34:31 +00:00
Augustin Cavalier
ed3d3b1023 drivers/pty: Destroy TTYs when usage is complete.
Otherwise, they will be "reused" and persist settings
and buffers, which we don't want.

Fixes the remaining part of #18488.
2023-07-11 11:33:00 -04:00
Augustin Cavalier
4b02e067a6 generic/tty: Add an assertion and a comment about references.
No functional change.
2023-07-11 11:32:59 -04:00
Augustin Cavalier
5193c8cd2f drivers/pty: Close "slave" TTYs when the "master" is closed.
The old TTY driver did this, but it was not properly carried
over into this new driver.

Fixes the first part of #18488: the child bash process from the
first session is properly closed, but the TTY state isn't reset
and there can still be stale things left in its buffer, it appears.
2023-07-11 11:32:59 -04:00
Trung Nguyen
3cb845283e headers/os: Make headers generator-friendly
Make Haiku headers a bit more friendly to binding generators by:
- Giving some `enum`s names (especially those that appear in
default arguments).
- Converting an internal `inline` function into a macro so that
the result could be evaluated in compile time.

Change-Id: I770674ad8fa7b24ac30b6b447d52a4b4c2530b8a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6716
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-07-11 14:40:02 +00:00
jiceland
14a0c87fd9 Tracker: Set and clear background image when switching directories.
Fixes #15784 and #16436.

Change-Id: Ia9baff083b3a8d4f4e8c5314f12fafeef6d01f7a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6717
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-07-11 14:35:15 +00:00
Humdinger
623fc35a33 Mail: Slightly improved attachment handling, layout, strings
* In case the dropped file is a symlink, attach the actual file instead.
* Don't add a file, if it's already in the list of attachments.
* Add file size in brackets after the filename in the list of attacments.
* Add some spacing before the "Attachments" label.
* Consistently use "attachment" instead of the mixed in "enclosure".
  "Attachment" also seems a more common term for this.

Change-Id: Id36d900216ce25c96ac1815889b8c7b6ec0e5f2c
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6699
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
2023-07-11 02:53:26 +00:00
Humdinger
a8030ecec6 Mail: Accept dropped files on window
Currently only files dropped on the mail contents view are added as
attachments. Since dropped text files get inserted into the contents,
it only worked for non-text files.

With this change, the header area and the empty space of the tool bar
react to file drops as well.

* Accept dropped files on the whole window area
* Forward dropped files on the address text controls to the
  main window (if they aren't people files)

Change-Id: Ia92f1e34aaf98a3089b318947668f3df41af00ce
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6697
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2023-07-11 02:53:03 +00:00