Commit graph

556 commits

Author SHA1 Message Date
Zaggy1024
e0a75d5084 LibCore: Implement polling for events on Windows 2025-10-22 17:32:45 -05:00
Undefine
abe536652f Meta+LibCore: Disable --no-undefined on FreeBSD and remove LibCore hack
It turns out it's much cleaner to just allow undefined symbols like we
already do for sanitizer Clang and remove the weak symbol definition.
2025-10-22 13:54:54 +02:00
Timothy Flynn
e433dee543 LibCore: Add a system wrapper to pipe a file
This uses splice on Linux and mmap+write elsewhere to transfer a file to
a pipe. Note we cannot use sendfile because (at least on macOS) the
receiving fd must be a socket.
2025-10-14 13:40:33 +02:00
Timothy Flynn
62e52640d0 LibCore: Add a standard path for cache data 2025-10-14 13:40:33 +02:00
ayeteadoe
f4c8fd4bef LibCore+LibWebView+UI/Qt: Support TimeZoneWatcher on Windows
To detect system time zone changes on Windows, the event we need to look
for is WM_TIMECHANGE. The problem is how the callback with said message
actually gets invoked is very particular. (1) We must have an active
message pump (event loop) for the message to ever be processed. (2) We
must be a GUI application as WM_TIMECHANGE messages are seemingly sent
to top level windows only. It doesn't say that in the docs for the
event, but attempts of creating a LibTest-based application with a
message pump and a message only window and never receiving the event
point to that probably being true.

This workaround is built off the fact that Qt's message pump defined
internally in QEventDispatcherWin32::processEvents does in fact receive
WM_TIMECHANGE events, even though it is not exposed as a QEvent::Type.
Given the requirements stated above it makes sense that it works here as
the message pump is executing in a QGuiApplication context. So we use a
native event filter to hook into the unexposed WM_TIMECHANGE event and
forward it along to the on_time_zone_changed() callback.

Note that if a Windows GUI framework is done in the future, we'll have
to re-add support to ensure the TimeZoneWatcher still gets invoked.
2025-10-05 15:46:15 +02:00
ayeteadoe
ba9c8b8462 LibCore: Remove unused macOS FileWatcher implementation 2025-10-05 15:46:15 +02:00
Andreas Kling
1ec72de0a6 AK: Remove unnecessary StringBuilder::create() factory 2025-10-05 11:24:46 +02:00
Zaggy1024
592be4ecad LibCore: Allow Promise to be resolved if it has a non-Error error type 2025-10-02 14:50:04 +02:00
Tomasz Strejczek
a010557205 LibCore: Remove DateTime
Remove DateTime and its dependencies as it's not longer used.
2025-09-30 12:39:01 +02:00
Rocco Corsi
892e75ddfb LibCore: Fix ThreadedPromise issues found with ThreadSanitizer 2025-09-24 21:05:54 -05:00
Aliaksandr Kalenik
de3f32a5c9 LibCore: Make timer firing order stable for equal deadlines
Timers scheduled with identical `fire_time` could fire out of order
because the heap is not stable. This change assigns a monotonically
increasing `sequence_id` when a timer is scheduled and extend the heap
comparator to order by (`fire_time`, `sequence_id`). This guarantees
FIFO among timers with the same deadline.

This matches the HTML "run steps after a timeout" ordering requirement:
older invocations with <= delay complete before newer ones.
https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#run-steps-after-a-timeout
2025-09-22 12:34:32 +01:00
ayeteadoe
69e92f69a7 LibCore: Implement SIGTERM-based kill() on Windows
There is no direct Win32 API equivalent, but calling WM_CLOSE on
the top-level windows allows for a graceful shutdown where resources
are able to clean themselves up properly
2025-09-15 09:19:52 +02:00
Nico Weber
9272df7a86 Everywhere: Fix a few unreachable-return / unreachable-break warnings
I was playing with clang's -Wunreachable-code-aggressive a bit.
This fixes a handful uncontroversial things it flags.

No behavior change.
2025-09-12 14:33:14 +01:00
Ali Mohammad Pur
4462348916 Everywhere: Slap some [[clang::lifetimebound]] where appropriate
This first pass only applies to the following two cases:
- Public functions returning a view type into an object they own
- Public ctors storing a view type

This catches a grand total of one (1) issue, which is fixed in
the previous commit.
2025-09-01 11:11:38 +02:00
Luke Wilde
b17783bb10 Everywhere: Change west consts caught by clang-format-21 to east consts 2025-08-29 18:18:55 +01:00
ayeteadoe
ff71efebb6 LibCore: Fix WSAEMSGSIZE error in pending_bytes with proper zero-init
In SocketWindows, the return value for the ioctl call was not
initialized to zero. This was causing test_udp in TesDNSResolver
to fail as UDPSocket::read_some() was incorrectly failing with
WSAEMSGSIZE due the result of pending_bytes being some
unspecified default value for an uninitialized unsigned long
2025-08-23 18:35:45 -06:00
ayeteadoe
84690f432e test-web: Allow help command to succeed
These are required for test-web runtime to actually work
2025-08-23 16:04:36 -06:00
zac
b8f95a091c LibCore: Add AVIF to registered types in MimeData 2025-08-22 08:03:28 -04:00
Jelle Raaijmakers
bc7658d3d3 LibCore: Don't send SIGTRAP when debugger attaches
Both gdb and lldb interrupt execution after attaching to the process, so
no need to send a SIGTRAP immediately after which would require typing
`continue` in the debugger twice.
2025-08-19 06:24:57 -04:00
Jelle Raaijmakers
afda3aba14 LibCore: Remove Command
This went unused.
2025-08-17 16:44:14 -04:00
Andreas Kling
bd7599ccfc LibCore: Remove macro-generated EventReceiver::try_create(...) factories
We can just use the infallible factory everywhere instead.
2025-08-11 16:55:25 +02:00
Andreas Kling
aec1f6aa7e LibCore: Remove unused CustomEvent 2025-08-11 16:55:25 +02:00
Andreas Kling
c47e253c60 LibCore: Remove unused "visible for timer purposes" concept
This was a long-unused leftover from SerenityOS.
2025-08-11 16:55:25 +02:00
Andreas Kling
0037df88d5 LibCore: Remove unused ChildEvent 2025-08-11 16:55:25 +02:00
Andreas Kling
75091016d7 LibCore: Remove parent/child concept from EventReceiver
This ownership model is no longer used.
2025-08-11 16:55:25 +02:00
Andreas Kling
134fd8e413 LibCore: Don't have Promise inherit from EventReceiver
This was only used for parenting promises to each other, but we can do
that with a simple vector of children.
2025-08-11 16:55:25 +02:00
Andreas Kling
b8357bc190 LibCore: Remove unused LocalServer constructor parameter 2025-08-11 16:55:25 +02:00
Andreas Kling
cfcb63239d LibCore: Remove unused ThreadedPromise constructor 2025-08-11 16:55:25 +02:00
Andreas Kling
fa8592b4a9 LibCore: Remove unused UDPServer constructor parameter 2025-08-11 16:55:25 +02:00
Andreas Kling
036aa43a41 LibCore: Remove unused TCPServer constructor parameter 2025-08-11 16:55:25 +02:00
Andreas Kling
d13884e933 LibCore: Remove unused Timer APIs for constructing with a parent 2025-08-11 16:55:25 +02:00
Andreas Kling
4d285d6dce LibCore: Remove an unused Promise constructor 2025-08-11 16:55:25 +02:00
Andreas Kling
ecf0395c27 LibCore: Stop parenting notifiers
There's no need to participate in the ancient EventReceiver parent/child
ownership scheme here. Notifiers are already owned by RefPtrs anyway.
2025-08-11 16:55:25 +02:00
Andreas Kling
34709cc796 LibCore: Remove unused "name" concept from EventReceiver 2025-08-11 16:55:25 +02:00
ayeteadoe
688d0ada97 Tests/LibCore: Enable TestLibCoreStream in Windows CI 2025-08-06 20:24:38 -06:00
ayeteadoe
e01a95f6cd LibCore: Implement UDPSocket::connect() on Windows 2025-08-06 20:24:38 -06:00
ayeteadoe
ba15348d56 LibCore: Implement PosixSocketHelper::pending_bytes() on Windows 2025-08-06 20:24:38 -06:00
ayeteadoe
4d68d28e16 LibCore: Implement PosixSocketHelper::set_receive_timeout() on Windows 2025-08-06 20:24:38 -06:00
ayeteadoe
79594279da LibCore: Make TCPServer::set_blocking() unsupported on Windows
Winsock2 doesn't seem to support blocking sockets, or at least
not in the naiive way.
2025-08-06 20:24:38 -06:00
ayeteadoe
d236e1a509 LibCore: Implement LocalServer on Windows 2025-08-06 20:24:38 -06:00
ayeteadoe
6e7565766d LibCore: Implement LocalSocket::connect() on Windows 2025-08-06 20:24:38 -06:00
ayeteadoe
904f736b95 LibCore: Implement UDPServer on Windows 2025-08-06 20:24:38 -06:00
ayeteadoe
cc3cabc768 LibCore: Implement TCPServer on Windows 2025-08-06 20:24:38 -06:00
ayeteadoe
9d7971c111 Tests/LibCore: Enable several tests in Windows CI
These are the set of tests that were already building and passing
with little to no modifications required.
2025-08-06 20:24:38 -06:00
Luke Wilde
31faf31f6a LibCore: Unmark timer interval being dirty after applying new interval
Previously it was never unmarked, so the timer would constantly stop
and start, which made the timer jittery especially at small intervals.
2025-07-26 10:09:12 -04:00
Timothy Flynn
9582895759 AK+LibJS+LibWeb+LibRegex: Replace AK::Utf16Data with AK::Utf16String 2025-07-18 12:45:38 -04:00
Undefine
2aa8c950ca LibCore+Meta: Workaround some symbols not being exported on FreeBSD
On FreeBSD some symbols like `environ` or `__progname` are not exported
anywhere and are filled in by the dynamic loader. `environ` is
a special case because we make use of it explicitly so we need to mark
it a weak symbol so the linker doesn't complain.
2025-07-15 13:44:54 -06:00
Jelle Raaijmakers
4c88c7445c LibCore: Remove EventReceiver's event filter
This went unused.
2025-07-14 11:54:57 +01:00
Timothy Flynn
af671f58ed LibCore: Revert change to simplify tracking of notifers and poll structs
The issue with that refactor was that the same fd can be used in more
than one notifier. This reverts us back to using 2 members to track the
notifiers in play.
2025-07-08 13:53:27 +01:00
Timothy Flynn
a9f7579738 LibCore: Awaken read notifiers when we receive POLLHUP events
POLLHUP is set when the remote end of the monitored fd is closed. There
may still be some buffered data to read from the socket, however. Some
systems do not set POLLIN in these cases. So we should just always try
to read from fds when we receive this event.
2025-07-07 15:53:15 -06:00