Commit graph

31286 commits

Author SHA1 Message Date
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
ryanb-dev
3a6f550b24 Terminal: Fix broken selection after dbl/trp click
This commit resets the terminal triple click timer when appropriate.
2021-12-16 18:49:46 +01:00
Brian Gianforcaro
fb53eacefd Toolchain: Update BuildQemu.sh to qemu-6.2
QEMU 6.2 was released on December 14th.
Release Notes: https://wiki.qemu.org/ChangeLog/6.2
2021-12-16 03:15:40 -08:00
Kenneth Myhra
a32cbf1df3 expr: Use StringView literals more (instead of raw C strings) 2021-12-16 02:10:47 -08:00
Kenneth Myhra
c5c0c7c620 expr: Port to LibMain 2021-12-16 02:10:47 -08:00
Kenneth Myhra
0edceb91c4 functrace: Port to LibMain and move away from raw C strings
Ports to LibMain and uses StringView more (rather than raw C strings).
2021-12-16 02:10:47 -08:00
Kenneth Myhra
160f3224a5 flock: Port to LibMain 2021-12-16 02:10:47 -08:00
Kenneth Myhra
11578c623c LibCore: Add waitpid() wrapper that return ErrorOr<pid_t> 2021-12-16 02:10:47 -08:00
Kenneth Myhra
123e49994d LibCore: Add posix_spawnp() wrapper that return ErrorOr<pid_t> 2021-12-16 02:10:47 -08:00
Kenneth Myhra
54f6829533 file: Port to LibMain 2021-12-16 02:10:47 -08:00
Kenneth Myhra
27e63d40f1 fdtdump: Port to LibMain 2021-12-16 02:10:47 -08:00
Kenneth Myhra
a35f51f0f0 dirname: Port to LibMain 2021-12-16 02:10:47 -08:00
Kenneth Myhra
4726532735 diff: Port to LibMain 2021-12-16 02:10:47 -08:00
Kenneth Myhra
cd8bd27835 df: Port to LibMain 2021-12-16 02:10:47 -08:00
Kenneth Myhra
156899a63f ddate: Port to LibMain 2021-12-16 02:10:47 -08:00
Ben Wiederhake
208d85e707 AK+Tests: Use less space in ErrorOr 2021-12-16 09:32:51 +01:00
Hendiadyoin1
c673b7220a AK: Enable fast path for removal by hash-compatible key in HashMap/Table 2021-12-15 23:35:14 -08:00