Commit graph

32521 commits

Author SHA1 Message Date
Andreas Kling
a4b3bf1d63 Kernel: Remove empty Ext2FSInode::one_ref_left() 2022-01-11 01:12:16 +01:00
Andreas Kling
b66bb11ed1 Kernel: Remove empty ISO9660Inode::one_ref_left() 2022-01-11 01:12:16 +01:00
Timothy Flynn
09c0324880 LibTimeZone: Begin generating GMT offset rules for each time zone
This is a rather naive implementation, but serves as a first pass at
determining the GMT offset for a time zone at a particular point in
time. This implementation ignores DST (because we are not parsing any
RULE entries yet), and ignores any offset patterns of the form "Mon>4"
or "lastSun".
2022-01-11 00:36:45 +01:00
Timothy Flynn
e9c42d0bc5 LibTimeZone: Add methods to canonicalize a time zone name 2022-01-11 00:36:45 +01:00
Timothy Flynn
1c2c98ac5d LibTimeZone: Add method to convert a time zone to a string 2022-01-11 00:36:45 +01:00
Timothy Flynn
14535fb67a LibTimeZone: Perform time-zone-from-string lookups case insensitively
Time zone names in the TZDB are defined to be case insensitive.
2022-01-11 00:36:45 +01:00
Timothy Flynn
b493c2ca90 LibTimeZone: Add a unit test for generated time zone data 2022-01-11 00:36:45 +01:00
Timothy Flynn
ccce9e5c7f LibTimeZone: Tweak the enumeration generated for parsed time zones
For example, generate "Etc/GMT+12" as "Etc_GMT_Ahead_12" (instead of as
"Etc_GMT_P12"). A little clearer what the name means without having to
know off-hand what "P" was representing.
2022-01-11 00:36:45 +01:00
Timothy Flynn
d627367489 LibTimeZone: Do not separate the generated data from the main library
This CMakeLists.txt was basically copy-pasted from LibUnicode, where the
generated data is separated into its own library. This was to let other
libraries / applications decide if they actually want to link the data
because it is so large. LibTimeZone's generated data is significantly
smaller, so this separation really isn't needed.
2022-01-11 00:36:45 +01:00
Timothy Flynn
b543c3e490 Meta: Don't assume how each generator wants to generate keyed map names
The generate_mapping helper generates a series of structs like:

    Array<SomeType, 1> s_mapping_key_0 {};
    Array<SomeType, 2> s_mapping_key_1 {};
    Array<SomeType, 3> s_mapping_key_2 {};
    Array<Span<SomeType const>> s_mapping { {
        s_mapping_key_0.span(),
        s_mapping_key_1.span(),
        s_mapping_key_2.span(),
    } };

Where the names of the struct were generated by the format_mapping_name
lambda inside the helper. Rather than this lambda making assumptions on
how each generator wants to name its structs, add a parameter for the
caller to provide a naming formatter.

This is because the TimeZoneData generator will want pretty specific
identifier formatting rules.
2022-01-11 00:36:45 +01:00
Timothy Flynn
6da1bfeeea Meta: Support generating case-insensitive value-from-string methods
This also extracts the default parameters for generate_value_from_string
to a structure. This is just to make it cleaner to add new options.
2022-01-11 00:36:45 +01:00
Timothy Flynn
3dccaa39d8 AK: Define a traits helper for case-insensitive StringView hashing
Currently, we define a CaseInsensitiveStringTraits structure for String.
Using this structure for StringView involves allocating a String from
that view, and a second string to convert that intermediate string to
lowercase.

This defines CaseInsensitiveStringViewTraits (and the underlying helper
case_insensitive_string_hash) to avoid allocations.
2022-01-11 00:36:45 +01:00
Timothy Flynn
7d9b6b41c3 LibTimeZone: Remove accidental pluralization of generator variable names 2022-01-11 00:36:45 +01:00
kleines Filmröllchen
9e471353dd Meta: Convert new help page link styles for the man page website
The special URL links (help://man) and the application opening links now
work on the man page website. While the page links are translated
correctly, the application launch can't be implemented. For this reason,
an explanatory error page is shown instead.
2022-01-11 00:24:57 +01:00
kleines Filmröllchen
98c0c5e9e6 Help+Base: Add help://man URLs for links between man pages
The URLs of the form `help://man/<section>/<page>` link to another help
page inside the help application. All previous relative page links are
replaced by this new form. This doesn't change any behavior but it looks
much nicer :^)

Note that man doesn't handle these new links, but the previous relative
links didn't work either.
2022-01-11 00:24:57 +01:00
kleines Filmröllchen
becf74097e Help: Directly launch an app from its help page
Through links in the help page, the user can directly launch the app
whose help page is currently viewed. The idea for this feature came up
in the discussion of #11557
(https://github.com/SerenityOS/serenity/pull/11557#issuecomment-1004830728
). The intention is that the user can simply open the app they are
currently trying to understand, and play around with it, learn by doing,
or follow along with any guide that may be present in the help page. It
feels very great :^)
2022-01-11 00:24:57 +01:00
kleines Filmröllchen
984bae9038 Help: Refactor link handling
Link handling is now split up between open_page and open_url. While
open_page can handle any sort of input and is responsible for handling
history UI, open_url deals in URLs and takes one of a few different
actions depending on the exact URL given. Currently, only file:// URLs
are handled but this will change in the next few commits.

Note that this commit breaks relative URLs on purpose. After the new
help:// URLs, they won't be needed anyways. The reasoning is that many
URLs not specifically pointing to man page directories will cause a
(non-deadly) unveil violation in `real_path_for`. This specifically
concerns the new application launch URLs that are added in the next
commit.
2022-01-11 00:24:57 +01:00
Glenford Williams
6c10e9e121 LibGUI: Make Tableview handle multi-selected indexes when deleting
Previously when the delete key was pressed, only the first selected
cell index would have been deleted. This commit remedies that by first
checking when more than a single index is selected.
2022-01-11 00:18:15 +01:00
kleines Filmröllchen
2f50d8f4d3 AK+LibC+LibPthread: Introduce NoAllocationGuard
NoAllocationGuard is an RAII stack guard that prevents allocations
while it exists. This is done through a thread-local global flag which
causes malloc to crash on a VERIFY if it is false. The guard allows for
recursion.

The intended use case for this class is in real-time audio code. In such
code, allocations are really bad, and this is an easy way of dynamically
enforcing the no-allocations rule while giving the user good feedback if
it is violated. Before real-time audio code is executed, e.g. in LibDSP,
a NoAllocationGuard is instantiated. This is not done with this commit,
as currently some code in LibDSP may still incorrectly allocate in real-
time situations.

Other use cases for the Kernel have also been added, so this commit
builds on the previous to add the support both in Userland and in the
Kernel.
2022-01-11 00:08:58 +01:00
kleines Filmröllchen
e2c9578390 Kernel: Allow preventing kmalloc and kfree
For "destructive" disallowance of allocations throughout the system,
Thread gains a member that controls whether allocations are currently
allowed or not. kmalloc checks this member on both allocations and
deallocations (with the exception of early boot) and panics the kernel
if allocations are disabled. This will allow for critical sections that
can't be allowed to allocate to fail-fast, making for easier debugging.

PS: My first proper Kernel commit :^)
2022-01-11 00:08:58 +01:00
Linus Groh
b8d640c3f9 Ports: Remove wireguard-tools strsep() replacement patch 2022-01-10 23:47:30 +01:00
Linus Groh
471b798eb0 LibC: Implement strsep() 2022-01-10 23:47:30 +01:00
Daniel Bertalan
78fa430ca1 Ports: Update bash port to version 5.1.16
The `remove-conflicting-declaration-in-glob` patch seems to not be
needed anymore.
2022-01-10 23:03:24 +01:00
Linus Groh
d099527dbb Ports: Add wireguard-tools
What will it take to port WireGuard to SerenityOS? No idea. But this is
a start :^)
2022-01-10 21:22:41 +01:00
kleines Filmröllchen
60ace37713 Documentation: Add a method for 7zip and other archive tools
Some archive tools can open ext2 images like an archive, which is very
convenient for people that already have such tools like 7zip.

This also contains information for WSL users on where to find the
_disk_image in Explorer.
2022-01-10 21:18:07 +01:00
Linus Groh
7204861e8f Meta: Add Marcus Nilsson to the contributors list :^) 2022-01-10 19:13:05 +01:00
Linus Groh
f2e8026f00 Meta: Add Tim Schumacher to the contributors list :^) 2022-01-10 19:12:17 +01:00
Linus Groh
1b73c7af5f Meta: Add Leon Albrecht to the contributors list :^) 2022-01-10 19:10:50 +01:00
Linus Groh
49471b63f8 Kernel: Fix indentation in CMakeLists.txt 2022-01-10 19:10:02 +01:00
Andreas Kling
24ecf1d021 Kernel: Remove redundant hash map of page tables in PageDirectory
The purpose of the PageDirectory::m_page_tables map was really just
to act as ref-counting storage for PhysicalPage objects that were
being used for the directory's page tables.

However, this was basically redundant, since we can find the physical
address of each page table from the page directory, and we can find the
PhysicalPage object from MemoryManager::get_physical_page_entry().
So if we just manually ref() and unref() the pages when they go in and
out of the directory, we no longer need PageDirectory::m_page_tables!

Not only does this remove a bunch of kmalloc() traffic, it also solves
a race condition that would occur when lazily adding a new page table
to a directory:

Previously, when MemoryManager::ensure_pte() would call HashMap::set()
to insert the new page table into m_page_tables, if the HashMap had to
grow its internal storage, it would call kmalloc(). If that kmalloc()
would need to perform heap expansion, it would end up calling
ensure_pte() again, which would clobber the page directory mapping used
by the outer invocation of ensure_pte().

The net result of the above bug would be that any invocation of
MemoryManager::ensure_pte() could erroneously return a pointer into
a kernel page table instead of the correct one!

This whole problem goes away when we remove the HashMap, as ensure_pte()
no longer does anything that allocates from the heap.
2022-01-10 16:22:37 +01:00
Andreas Kling
bdbff9df24 Kernel: Don't relock MM lock for every page when remapping region
Make sure that callers already hold the MM lock, and we don't have to
worry about reacquiring it every time.
2022-01-10 16:22:37 +01:00
Andreas Kling
d7475449cc Taskbar: Tweak taskbar button progress bar rendering
The rects didn't take the "thin cap" button style into account, causing
in-button progress bars to look a little off.
2022-01-10 16:22:37 +01:00
Timothy Flynn
05de9b82b8 LibJS: Include hour-cycle in DateTimeFormat options
This is a normative change to the Intl spec:
https://github.com/tc39/ecma402/commit/20e5c26

Note that this doesn't actually affect us. Its purpose is to provide the
hour-cycle to BestFitFormatMatcher. This AO is implementation defined,
and ours just invokes BasicFormatMatcher, which doesn't use this field.
We could now have LibUnicode generate this field and use it to find a
better format pattern, though.
2022-01-10 16:18:05 +01:00
Timothy Flynn
15947aa1f0 LibUnicode: Add an hour-cycle field to DateTimeFormat's format pattern 2022-01-10 16:18:05 +01:00
Michel Hermier
e1685b6b69 Lagom: Avoid declaring Time in the global namespace
When compiled using clang, an ambiguity error is detected between
`class AK::Time` aliased to `::Time` and the `struct ::Time` provided
in `GenerateTimeZoneData.cpp`. Solve this by moving most of the code in
an anonymous namespace.
2022-01-10 15:57:59 +01:00
Marcus Nilsson
4459cb33ed LibGUI+AK: Add DRAG_DEBUG opt and put drag operations behind dbgln_if
No need to have this enabled all the time.
2022-01-10 14:23:04 +01:00
Brandon
f43b69f8e2 Documentation: Document how to transfer files from QEMU to the host
Document how to transfer files from QEMU to the host
2022-01-10 10:31:54 +01:00
Dylan Katz
79cdb5e3c8 2048: Add action icons for New Game and Settings 2022-01-10 00:58:40 -08:00
Dylan Katz
fe3bd062b7 2048: Simplify dialog box when target reached
Previously, upon reaching the target, the player is presented with
potentially two dialog boxes: one asking if the user wants to
continue endlessly and another showing the player's statistics,
which would only be shown if the user does not want to continue.

This commit consolidates these into a single dialog box that shows
the relevant statistics and asks the user if they want to continue
endlessly.
2022-01-10 00:58:40 -08:00
Dylan Katz
0fda98dfb3 2048: Fix off-by-1 when opening settings
When opening 2048's settings, it translates the target tile into
a power of 2. Previously, it was done incorrectly, causing the
resulting value to be off by one, and the number would increase
every time one opens, saves and closes the settings. With this
change, it now works as expected.
2022-01-10 00:58:40 -08:00
Hendiadyoin1
2b206b1854 Meta: Disable readability-use-anyofallof clang-tidy check 2022-01-09 23:29:57 -08:00
Hendiadyoin1
1cdace7898 Kernel: Add implied auto qualifiers in Memory 2022-01-09 23:29:57 -08:00
electrikmilk
ae8c7eebbd Base: Add Hebrew Characters 2022-01-09 22:33:27 -08:00
Daniel Bertalan
162606f358 Toolchain+CI: Link LLVM with LLD if available
According to most benchmarks, LLD is faster than GNU ld and the macOS
linker, so let's use it if possible in order to speed up the toolchain
build.
2022-01-10 09:55:45 +03:30
Daniel Bertalan
d21c38a72d CI: Hash only relevant files for the key of the compiler cache
In the last few commits, a second patch was added to the LLVM toolchain,
and it no longer uses our binutils patch. This commit changes the CI
cache keys accordingly, in order to prevent unnecessary rebuilds of both
toolchains when only one is changed.

The Clang toolchain's cache now only takes into account patches that
begin with `llvm`, and the GNU toolchain excludes those from the hash
calculation. We now also hash the two CMake cache files that we use for
building LLVM and its runtime libraries.
2022-01-10 09:55:45 +03:30
Daniel Bertalan
43008267b2 Toolchain: Do not overwrite libraries with stubs when rebuilding LLVM
We erroneously appended ".so" after the base name for the library,
so we ended up checking for the existence of e.g. `libc.so.so`,
which obviously didn't exist, so we overwrote the existing libraries
when we rebuilt the toolchain.
2022-01-10 09:55:45 +03:30
Daniel Bertalan
b3dbf204fc Toolchain: Don't use GNU objcopy in the LLVM toolchain
Our build of LLVM's objcopy now supports the single missing feature
(--update-section) that previously forced us to use the one from GNU
Binutils. This means that there is no reason anymore to build Binutils
alongside LLVM's tools.
2022-01-10 09:55:45 +03:30
Daniel Bertalan
b19cc3cdcb Toolchain: Backport --update-section support to llvm-objcopy
This commit backports the LLVM commit that adds support for the
`--update-section` flag to llvm-objcopy. We use this feature of GNU
objcopy to embed the symbol map in the kernel.

The corresponding LLVM Phabricator Differential Revision can be found
here: https://reviews.llvm.org/D112116

This patch is identical to the upstream commit, except for two hunks
that had to be changed as they didn't apply cleanly.
2022-01-10 09:55:45 +03:30
Rafał Babiarz
3132ce1d36 LibGUI: Show hours and minutes in "unsaved changes" dialogs 2022-01-09 20:25:48 -08:00
Rafał Babiarz
0012c03eb5 AK: Added human_readable_time() method for "unsaved changes" dialogs 2022-01-09 20:25:48 -08:00