Commit graph

33262 commits

Author SHA1 Message Date
Tom f021baf255 AK: Add Formatter<FixedPoint<...>> without floating point
Rather than casting the FixedPoint to double, format the FixedPoint
directly. This avoids using floating point instruction, which in
turn enables this to be used even in the kernel.
2022-01-23 22:45:21 +00:00
Tom 77b3230c80 AK: Loosen FixedPoint template contraints and forward-declare it
Because AK/Concepts.h includes AK/Forward.h and concepts cannot be
forward declared, slightly losen the FixedPoint template arguments
so that we can forward declare it in AK/Forward.h
2022-01-23 22:45:21 +00:00
Tobias Christiansen 92e337de21 LibGUI: Fix typo in TextEditor 2022-01-23 22:12:05 +00:00
Tobias Christiansen 9a28c8dc74 LibGUI: Fix broken text rendering in TextEditor
This patch reintroduces the translation previously mistakenly removed
when adding support for different underline-styles.

Thanks for reporting the bug, kennethmyhra!
2022-01-23 22:12:05 +00:00
Timothy Flynn 9684ae460c RequestServer: Unveil /etc/timezone for date-time usage 2022-01-23 20:57:01 +00:00
Liav A fc2c2c8a6d Kernel/Storage: Remove NVMeQueue DMA buffer create method
Instead, try to allocate the DMA buffer before trying to construct the
NVMeQueue. This allows us to fail early if we can't allocate the DMA
buffer before allocating and creating the heavier NVMeQueue object.
2022-01-23 20:56:28 +00:00
Liav A 0778043d73 Kernel: Use generic string when allocating DMA buffer to NVMeQueue
We don't necessarily create a DMA buffer just for "Admin CQ queue", so
don't hardcode it when allocating such buffer.
2022-01-23 20:56:28 +00:00
Liav A 0536079ad8 Kernel/Storage: Use StringView when allocating DMA buffer in NVMeQueue 2022-01-23 20:56:28 +00:00
Liav A e0aaac970c Kernel/Storage: Don't declare NVMeQueue constructor explicit
Also, declare it as a private method.
2022-01-23 20:56:28 +00:00
Liav A 4597e980fe Kernel/Storage: Remove duplicate private declaration in NVMeQueue class
Also, the override of handle_irq method can be private too.
2022-01-23 20:56:28 +00:00
Liav A 64adb2ef96 Kernel/Storage: Declare NVMeQueue handle_irq virtual as it should be 2022-01-23 20:56:28 +00:00
Rummskartoffel 5f639493f0 gunzip: Don't truncate output filename when input file suffix is omitted
Before this commit, `$ gunzip abcd` would incorrectly uncompress
`abcd.gz` to `a` instead of to `abcd`.
2022-01-23 20:52:16 +00:00
Lenny Maiorani e8ae0541d9 Meta: Add myself to the mailmap 2022-01-23 20:50:25 +00:00
Lenny Maiorani 3143c4b1df LibSoftGPU: Add const to Clipper where possible 2022-01-23 20:42:07 +00:00
Lenny Maiorani 0da3a2ddde LibSoftGPU: Switch to using east const in Clipper.[h,cpp] 2022-01-23 20:42:07 +00:00
mnlrsn 66216d3af6 LibSQL: Add simple REGEXP match
The implementation of LIKE uses regexes under the hood, and this
implementation of REGEXP takes the same approach. It employs
PosixExtended from LibRegex with case insensitive and Unicode flags
set. The implementation of LIKE is based on SQLlite specs, but SQLlite
does not offer directions for a built-in regex functionality, so this
one uses LibRegex.
2022-01-23 22:34:53 +03:30
Idan Horowitz ace36681ff LibJS+LibIMAP: Use the new Optional<U>(Optional<T>) constructor
These look much nicer than these repeated ternaries :^)
2022-01-23 18:53:42 +02:00
Idan Horowitz a3a4d0aea2 AK: Make Optional<T> explicitly constructible from Optional<U>
As long as T is constructible from U. This allows us to avoid patterns
like `abc.has_value() ? Optional<U>(abc.value()) : Optional<U>()`.
2022-01-23 18:53:42 +02:00
David Lindbom fb06d494f0 find: Fix crash on missing arguments
Fixes #12075
2022-01-23 16:29:06 +01:00
mjz19910 61cf1c066e LibJS: Remove VM::call() 2022-01-23 15:24:45 +00:00
mjz19910 1ef633472b Everywhere: Convert VM::call() to JS::call() 2022-01-23 15:24:45 +00:00
mjz19910 d436746c95 LibJS: Add some overloads for JS::call() and JS::call_impl()
Overloads added:
- JS::call for FunctionObject&
- JS::call_impl for FunctionObject&
2022-01-23 15:24:45 +00:00
David Briggs cf45370c47 Kernel: Use ErrorOr in BlockBased and Ext2 filesystem raw read and write
These functions used to return booleans which withheld useful
error information for callers. Internally they would suppress
and convert Error objects. We now log or propagate these errors
up the stack.
2022-01-23 14:36:01 +00:00
kleines Filmröllchen df6b9cdb0c LibCore+LibC: Enforce the global event loop ban in code
It's a bad idea to have a global event loop in a client application as
that will cause an initialization-order fiasco in ASAN. Therefore, LibC
now has a flag "s_global_initializers_ran" which is false until _entry
in crt0 runs, which in turn only gets called after all the global
initializers were actually executed. The EventLoop constructor checks
the flag and crashes the program if it is being called as a global
constructor. A note next to the VERIFY_NOT_REACHED() informs the
developer of these things and how we usually instantiate event loops.

The upshot of this is that global event loops will cause a crash before
any undefined behavior is hit.
2022-01-23 15:21:10 +01:00
kleines Filmröllchen 888faa3c9f LibCore: Fix signal handling race condition in EventLoop
The event loop is responsible for handling POSIX signals while it's
running. The signal handler adds the signals to a wake pipe which is
then read after the select'ing code in wait_for_event. Problems happen,
however, when another signal comes in after the select wake: the signal
will interrupt the next syscall, the `read` from the wake pipe, and the
resulting EINTR in wait_for_event causes the program to crash. This is
undesirable. Instead, we want to retry reading as long as we're
interrupted.
2022-01-23 15:21:10 +01:00
kleines Filmröllchen a501b9c7df LibCore: Create wake pipe on each thread
After the previous change, the wake pipe was only being created on the
main thread by the main event loop. This change utilizes a flag to
always initialize the wake pipe on other threads. Because the pipe is
quite expensive (it will count towards the file descriptor limit, for
instance), we do the initialization "lazily": Only when an event loop is
constructed and it notices that there hasn't been a wake pipe created on
its thread, it will create the pipe. Conversely, this means that there
are no pipes on threads that never use an event loop.
2022-01-23 15:21:10 +01:00
kleines Filmröllchen 69c1910037 LibCore: Allow EventLoops to run on multiple threads safely
The event loop system was previously very singletony to the point that
there's only a single event loop stack per process and only one event
loop (the topmost) can run at a time. This commit simply makes the event
loop stack and related structures thread-local so that each thread has
an isolated event loop system.

Some things are kept at a global level and synchronized with the new
MutexProtected: The main event loop needs to still be obtainable from
anywhere, as it closes down the application when it exits. The ID
allocator is global as IDs should not be shared even between threads.
And for the inspector server connection, the same as for the main loop
holds.

Note that currently, the wake pipe is only created by the main thread,
so notifications don't work on other threads.

This removes the temporary mutex fix for notifiers, introduced in
0631d3fed5 .
2022-01-23 15:21:10 +01:00
kleines Filmröllchen 3d6e08156d LibThreading: Introduce MutexProtected generic synchronization primitive
MutexProtected mirrors the identically-named Kernel primitive and can be
used to synchronize access to any object that might not be thread safe
on its own. Synchronization is done with a simple mutex, so access to a
MutexProtected object is potentially blocking.

Mutex now has an internal nesting variable which is there to harden it
against lock-unlock ordering issues (e.g. double unlocking).
2022-01-23 15:21:10 +01:00
Marco Cutecchia a7ce0c2297 Kernel: Add missing #include <AK/Badge.h> to MemoryManager.h
This missing header broke the aarch64 build
2022-01-23 14:31:50 +01:00
Timothy Flynn d365559839 ClockSettings: Add a GUI application to set the system time zone
This application can be expanded with other clock-related options. For
an initial iteration, it has just an option to change the time zone.
2022-01-23 12:48:26 +00:00
Timothy Flynn 6057a2ca30 timezone: Add a command line utility to set the system time zone 2022-01-23 12:48:26 +00:00
Timothy Flynn 2bdc3aec42 LibC: Use LibTimeZone to offset localtime() for the system time zone 2022-01-23 12:48:26 +00:00
Timothy Flynn 7f1404b870 LibTimeZone: Use /etc/timezone as the basis for the system time zone
This changes LibTimeZone to read the current time zone from the file
/etc/timezone rather than using tzset/tzname. Instead, in a subsequent
commit, LibC's time methods will be changed to used LibTimeZone to
retrieve the system time zone.

Also add an API to set the system time zone. This method is only allowed
when running within Serenity.
2022-01-23 12:48:26 +00:00
Timothy Flynn bcf4ec9c61 Userland: Add promises to programs that will read /etc/timezone
This will require unveiling /etc/timezone itself for reading, as well as
the rpath pledge promise.
2022-01-23 12:48:26 +00:00
Timothy Flynn da27937144 LibTimeZone: Add an API to retrieve a list of all known IANA time zones 2022-01-23 12:48:26 +00:00
Timothy Flynn 0a4430fc41 LibJS+LibTimeZone+LibUnicode: Remove direct linkage to LibTimeZone
This is no longer needed now that LibTimeZone is included within LibC.
Remove the direct linkage so that others do not mistakenly copy-paste
the CMakeLists text elsewhere.
2022-01-23 12:48:26 +00:00
Timothy Flynn 6988403d59 DynamicLoader+LibC+LibTimeZone: Include LibTimeZone sources in LibC
LibTimeZone will be needed directly within LibC for functions such as
localtime(). This change adds LibTimeZone directly within LibC, so that
LibTimeZone isn't its own .so library anymore.

LibTimeZone itself is compiled as an object library to make it easier to
give it generator-specific compilation flags.
2022-01-23 12:48:26 +00:00
Timothy Flynn b873a222d7 AK: Implement AK::Time's seconds_since_epoch_to_year without LibM
In order for this method to be used within LibC itself, avoid using the
floor() method from LibM, which is not available from within LibC. This
header similarly avoids other standard headers as well.
2022-01-23 12:48:26 +00:00
Michel Hermier e986ce961a AK: Avoid impl initialization before assignment in Stringconstructor 2022-01-23 13:29:12 +01:00
Tobias Christiansen 3b877c889b LibWeb: Consider TextDecorationStyle when rendering text
For now only Wavy is additionally supported, but the infrastructure is
there.
2022-01-23 15:48:27 +03:30
Tobias Christiansen 69aac6ecd7 LibWeb: Add new property 'text-decoration-style'
This patch makes the property 'text-decoration-style' known throughout
all the places in LibWeb that care.
2022-01-23 15:48:27 +03:30
Tobias Christiansen 5348c67ba4 LibGUI: Expand underline support for Spans in TextEditor
To achieve this, some of the lambdas got shifted around and the new
attributes are respected.
2022-01-23 15:48:27 +03:30
Tobias Christiansen ece59948c3 LibGfx: Expand TextAttributes with more information about underlining
This adds a seperate Color to be used for underlines as well as support
for different underline styles.
2022-01-23 15:48:27 +03:30
Tobias Christiansen 0277118cb4 LibGfx: Add Painter::draw_triangle_wave()
This patch adds support for drawing triangular waves.
For now those can only be horizontal, but as they are intended for
underlining text, it's an okay way to handle this.
2022-01-23 15:48:27 +03:30
Nico Weber 7b51102495 Base: Add a <pre> test page 2022-01-23 12:08:37 +01:00
Στέφανος a4031c89e1 Keymaps: Add Greek keymap 2022-01-23 00:46:14 +00:00
Nico Weber fd7de68d07 LibHTTP+AK: Rename CNETWORKJOB_DEBUG to NETWORKJOB_DEBUG 2022-01-23 00:45:22 +00:00
Nico Weber a17b2248f2 LibHTTP+AK: Rename CHTTPJOB_DEBUG to HTTPJOB_DEBUG 2022-01-23 00:45:22 +00:00
Liav A b0790260f8 Base: Add a note on the possibility of failure with the beep utility 2022-01-23 00:40:54 +00:00
Liav A 24efc74318 LibCore: Print the actual errno if sysbeep failed 2022-01-23 00:40:54 +00:00