Commit graph

20 commits

Author SHA1 Message Date
Zaggy1024
4a5350a2ee LibCore: Use sendfile instead of mmap+write on macOS 2026-01-19 06:53:29 -05:00
Zaggy1024
84c0eb3dbf LibCore+LibHTTP+RequestServer: Send data via sockets instead of pipes
This brings the implementation on Unix in line with Windows, so we can
drop a few ifdefs.
2026-01-19 06:53:29 -05:00
Zaggy1024
a3f0b513b6 LibCore: Remove an unnecessary ifdef from ioctl
Passing argp to ioctl as void* instead of FlatPtr works on Linux, but
Haiku needs a void*, so let's just do that unconditionally.
2026-01-19 06:53:29 -05:00
Jelle Raaijmakers
771a9c9266 LibCore: Simplify anon_create()
After 07630f3b0c, this simplification
became obvious. No functional changes.
2026-01-16 07:26:46 -05:00
Andreas Kling
07630f3b0c LibCore: Fix memory leak in anon_create() on BSD/macOS
The mmap() call here served no purpose - anon_create() is only meant to
create and return a file descriptor. The actual mapping is done later
by AnonymousBufferImpl::create().

This leaked an mmap of `size` bytes for every AnonymousBuffer created,
which includes backing stores, shareable bitmaps, and more.
2026-01-16 08:04:22 +01:00
Timothy Flynn
005e965380 LibCore+RequestServer: Return size_t from system read/write functions
The system uses ssize_t so it can return -1 in case of an error. But in
our case, we will transform that to an AK::Error, thus we never return
-1. Let's return size_t instead.
2025-12-01 16:29:48 +01:00
Timothy Flynn
85fd4d5ea1 LibCore: Accept ReadonlyBytes/Bytes in System::send/recv
Instead of passing in a pointer+size, let's use safer AK types.
2025-12-01 08:55:33 -05:00
Undefine
41d04de1f2 LibCore: Remove unused System::uname
This went unused.
2025-11-07 11:27:51 +01:00
Undefine
17d3b881d3 AK+Everywhere: Remove ifdefs for WASM and Emscripten
Building the Ladybird code for Emscripten doesn't really make sense
and I doubt it is even possible with all the dependencies now.
2025-11-07 11:27:51 +01: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
Andreas Kling
1ec72de0a6 AK: Remove unnecessary StringBuilder::create() factory 2025-10-05 11:24:46 +02:00
Timothy Flynn
f46b721c57 LibCore: Always reset the polled revents field back to 0
One benefit of using `poll` over `select` is that we can re-use the poll
structure list. But there's no guarantee that the underlying system will
reset the `revents` field back to 0. So let's explicitly do so.
2025-07-07 15:53:15 -06:00
Timothy Flynn
dceed08058 AK+LibCore: Avoid double-negation of syscall error values
This is a remnant from SerenityOS. Let's avoid confusion as to why we
negate errno when we call Error::from_syscall just to negate it again
when we store the error code.
2025-05-10 21:19:46 -04:00
Timothy Flynn
24ac5e2eee AK+LibCore: Remove SerenityOS handling from Error and Core::System
This is just to make some syscall error handling changes simpler.
2025-05-10 21:19:46 -04:00
stasoid
2abc792938 LibCore: Implement System::set_close_on_exec 2025-03-19 20:25:24 -06:00
stasoid
a291a7f770 LibCore: Add System::sleep_ms 2025-02-06 15:16:50 -07:00
stasoid
b77016cc34 LibCore: Consistently treat file descriptors as handles on Windows
Also:
 * implement dup and is_socket
 * implement and call init_crt_and_wsa
2025-02-05 19:27:47 -07:00
stasoid
212cea4535 LibCore: Add System::getpid 2024-12-17 11:07:53 +01:00
Andrew Kaster
0075048206 LibCore: Remove SessionManagement utilities
We don't need these, they are only relevant for SerenityOS system
builds of LibCore.
2024-11-26 11:00:48 +01:00
Timothy Flynn
93712b24bf Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
Renamed from Userland/Libraries/LibCore/System.cpp (Browse further)