Commit Graph

31402 Commits

Author SHA1 Message Date
Andreas Kling
39d9337db5 Kernel: Make sys${ftruncate,pread} take off_t as const pointer
These syscalls don't write back to the off_t value (unlike sys$lseek)
so let's take Userspace<off_t const*> instead of Userspace<off_t*>.
2021-12-18 11:30:10 +01:00
Andreas Kling
9c7659306a Kernel: Fix getsockopt(SO_RCVTIMEO) returning wrong timeout
We were returning the send timeout for both SO_RCVTIMEO and SO_SNDTIMEO.
2021-12-18 11:30:10 +01:00
Andreas Kling
c175cea32d LibJS: Fix typo in MarkedVector::end() 2021-12-18 11:30:10 +01:00
Andreas Kling
5c344f4aee Kernel: Start perf event stack capture at RBP, not EBP on x86_64 2021-12-18 11:16:24 +01:00
Linus Groh
3214e35535 LibJS/Tests: Remove outdated FIXME 2021-12-17 23:22:30 +00:00
kleines Filmröllchen
3891d6d73a AK: Fast path for single-element TypedTransfer::copy
Co-Authored-By: Brian Gianforcaro <bgianf@serenityos.org>
2021-12-17 13:13:00 -08:00
kleines Filmröllchen
d5dce448ea AK: Bypass Buffered's buffer for large reads
Before, if we couldn't read enough data out of the buffer, we would re-
fill the buffer and recursively call read(), which in turn reads data
from the buffer into the resliced target span. This incurs very
intensive superflous memmove's when large chunks of data are read from
a buffered stream.

This commit changes the behavior so that when we exhaust the buffer, we
first read any necessary additional data directly into the target, then
fill up the buffer again. Effectively, this results in drastically
reduced overhead from Buffered when reading large contiguous chunks.
Of course, Buffered is designed to speed up data access patterns with
small frequent reads, but it's nice to be able to combine both access
patterns on one stream without penalties either way.

The final performance gain is about an additional 80% of abench decoding
speed.
2021-12-17 13:13:00 -08:00
kleines Filmröllchen
982529a948 LibAudio: Don't unnecessarily copy the passed decode buffer 2021-12-17 13:13:00 -08:00
kleines Filmröllchen
0d28b6d236 LibAudio: Remove superflous comment
Thanks @alimpfard for pointing that out :^)
2021-12-17 13:13:00 -08:00
kleines Filmröllchen
9fa3aa84e1 LibAudio: Add an adjustable buffer size to FlacLoader
This makes it easier to fine-tune the optimal input buffer size.
2021-12-17 13:13:00 -08:00
Astraeus-
eb1f00a940 AnalogClock: Port to LibMain 2021-12-17 13:09:54 -08:00
Astraeus-
eec6ae0d07 About: Port to LibMain 2021-12-17 13:09:54 -08:00
Astraeus-
61fed26400 LibGUI: Add ErrorOr wrapper for default icon creation 2021-12-17 13:09:54 -08:00
Alexander Ulmer
42b06d5f7d LibCrypto: Declobber AES header from s-box tables 2021-12-17 19:17:12 +03:30
Rafał Babiarz
ef1d4aab73 Ports: Updated lua port to version 5.3.6 2021-12-17 03:25:52 -08:00
Andreas Kling
2f9e07dfdb LibCore: Use correct underlying syscall in seteuid() and setegid()
Thanks to Idan's hawk eyes for spotting this! :^)
2021-12-16 23:02:56 +01:00
Andreas Kling
a409b832fa AK: Make JsonValue::from_string("") return a null JsonValue
This unbreaks the /var/run/utmp system which starts out as an empty
string, and is then turned into an object by the first update.

This isn't necessarily the best way for this to work, but it's how
it used to work, so this just fixes the regression for now.
2021-12-16 22:48:17 +01:00
Andreas Kling
b38f8902d2 LibCore+passwd+usermod: Make Core::Account::sync() return ErrorOr<void> 2021-12-16 22:48:17 +01:00
Andreas Kling
ead9c36c92 LibCore: Add syscall wrapper for rename() 2021-12-16 22:48:17 +01:00
Andreas Kling
fb4ffe22c8 LibCore: Add syscall wrapper for fchmod() 2021-12-16 22:48:17 +01:00
Andreas Kling
aa7e8b5797 LibCore: Add syscall wrapper for mkstemp() 2021-12-16 22:48:17 +01:00
Andreas Kling
87b1ad2356 SystemServer: Use more LibCore syscall wrappers :^) 2021-12-16 22:48:17 +01:00
Andreas Kling
2637a64130 LibCore: Add syscall wrapper for fork() 2021-12-16 22:48:17 +01:00
Andreas Kling
01c2756e9a LibCore: Add syscall wrapper for mkdir() 2021-12-16 22:48:17 +01:00
Andreas Kling
f69bd3bd46 LibCore: Add syscall wrapper for mount() 2021-12-16 22:48:17 +01:00
Andreas Kling
e923762afc SystemServer: Port to LibMain :^) 2021-12-16 22:48:17 +01:00
Andreas Kling
e5a5091b6f su: Port to LibMain :^) 2021-12-16 22:48:17 +01:00
Andreas Kling
411c696057 passwd: Use LibCore syscall wrapper for setegid() 2021-12-16 22:48:17 +01:00
Andreas Kling
99eaeedf4e usermod: Use LibCore syscall wrapper for setegid() 2021-12-16 22:48:17 +01:00
Andreas Kling
ad37ca4815 LibCore: Add syscall wrapper for setgroups() 2021-12-16 22:48:17 +01:00
Andreas Kling
92e6532bf1 LibCore: Add syscall wrapper for isatty() 2021-12-16 22:48:17 +01:00
Andreas Kling
9e9662b695 pls: Port to LibMain :^) 2021-12-16 22:48:17 +01:00
Andreas Kling
2c3699e257 LibCore: Add syscall wrappers for setuid/seteuid/setgid/setegid 2021-12-16 22:48:17 +01:00
Andreas Kling
8bb9fe63b7 LibJS: Add MarkedVector<T>
This abstracts a vector of Cell* with a strongly typed span() accessor
that gives you Span<T*> instead of Span<Cell*>.

It is intended to replace MarkedValueList in situations where you only
need to store pointers to Cell (or an even more specific type of Cell).

The API can definitely be improved, it's just the bare basics for now.
2021-12-16 22:48:17 +01:00
Andreas Kling
c26b58bc53 LibJS: Add JS::make_handle(T&)
I'm not sure why we only had a T* variant of this.
2021-12-16 22:48:17 +01:00
Andreas Kling
13680ae038 Kernel: Build with -O2 by default
We used to build with -Os in order to fit within a certain size, but
there isn't really a good reason for that kind of restriction.

Switching to -O2 yields a significant improvement in throughput,
for example `test-js` is roughly 20% faster on my machine. :^)
2021-12-16 22:48:16 +01:00
Rafał Babiarz
39e3c68e94 Ports: Updated links port to version 2.25 2021-12-16 22:45:05 +01:00
Dmitry Petrov
6f5102f435 LibTextCodec: Add alternate Cyrillic (aka Koi8-r) encoding
Fixes #6840.
2021-12-16 22:44:45 +01:00
Daniel Bertalan
2c1a6ce9a5 Ports: Update gcc patch to match the toolchain 2021-12-16 21:27:03 +02:00
Daniel Bertalan
738e52da56 Toolchain: Link libgcc_s on an as-needed basis
If we pass `-lgcc_s` explicitly to the linker, it will be added as a
dependency even if no functions are used from it. This behavior is not
consistent with other systems. GCC can already handle passing the
correct flags, so let's rely on that instead.

As an added benefit, we now get support for the `-static-libgcc` flag;
and `-static-pie` will no longer mistakenly link us against the dynamic
version of libgcc.

No toolchain rebuild is required.
2021-12-16 21:27:03 +02:00
sin-ack
e0e8fd6384 LibCore: Remove LocalServer::on_ready_to_accept
This is never called in LocalServer and someone might accidentally use
it -- I did. :^)
2021-12-16 22:21:35 +03:30
sin-ack
dfdb52efa7 LibCore+Userland: Convert TCPServer to use the Serenity Stream API
This is intended as a real-usecase test of the Serenity Stream API, and
seemed like a good candidate due to its low amount of users.
2021-12-16 22:21:35 +03:30
sin-ack
2341b0159a Tests: Implement tests for the Serenity Stream API 2021-12-16 22:21:35 +03:30
sin-ack
19e13117ad LibCore: Implement the Serenity Stream API classes
The Serenity Stream API is the name for the new set of classes intended
to replace IODevice and its descendants. It provides more flexibility
for subclasses by allowing each subclass to override all the possible
functionalities according to their wishes.

Stream is the base class which implements majority of the functionality
expected from a readable and writable stream. SeekableStream adds
seeking on top, and provides a couple utility methods which derive from
seek. Socket adds a couple of BSD socket utility functions such as
checking whether there is data available to read and checking the
pending bytes on the socket.

As for the concrete classes, there is File which is a SeekableStream and
is intended to operate on file-like objects; and TCPSocket, UDPSocket
and LocalSocket, which handle TCP, UDP and UNIX sockets respectively.

The concrete classes do not do buffering by default. For buffering
functionality, a set of augmentative classes named BufferedSeekable and
BufferedSocket have been implemented, intended to wrap a SeekableStream
and a Socket, respectively.
2021-12-16 22:21:35 +03:30
sin-ack
69ef211925 Kernel+LibC: Move errno definitions to Kernel/API/POSIX
This fixes at least half of our LibC includes in the kernel. The source
of truth for errno codes and their description strings now lives in
Kernel/API/POSIX/errno.h as an enumeration, which LibC includes.
2021-12-16 22:21:35 +03:30
sin-ack
0cca6cef95 LibCore+LookupServer: Implement and use UDPServer::send 2021-12-16 22:21:35 +03:30
sin-ack
3da0c072f4 Kernel: Return the correct result for FIONREAD on datagram sockets
Before this commit, we only checked the receive buffer on the socket,
which is unused on datagram streams. Now we return the actual size of
the datagram without the protocol headers, which required the protocol
to tell us what the size of the payload is.
2021-12-16 22:21:35 +03:30
sin-ack
e4a1bc1542 AK: Use __builtin_memmove for ByteBuffer and Span's overwrite
__builtin_memcpy will fail when the target area and the source area
overlap. Using __builtin_memmove will handle this case as well.
2021-12-16 22:21:35 +03:30
sin-ack
59eb2d5de4 LibC: Implement serenity_open
This syscall is very much similar to open(2), with the difference of
accepting a string and a length, instead of requiring a null-terminated
string. This way, if the string passed is not null-terminated, we can
still perform the syscall.
2021-12-16 22:21:35 +03:30
Brian Gianforcaro
c710d52afa LibGfx: Handle malformed Platform ID during TTF parsing
This should fix one of the OSS Fuzz crashes that occurs during
TTF file format parsing.

See: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=37263
2021-12-16 18:50:02 +01:00