Commit Graph

33544 Commits

Author SHA1 Message Date
Andreas Kling
b56646e293 Kernel: Switch process file descriptor table from spinlock to mutex
There's no reason for this to use a spinlock. Instead, let's allow
threads to block if someone else is using the descriptor table.
2022-01-29 02:17:09 +01:00
Andreas Kling
8ebec2938c Kernel: Convert process file descriptor table to a SpinlockProtected
Instead of manually locking in the various member functions of
Process::OpenFileDescriptions, simply wrap it in a SpinlockProtected.
2022-01-29 02:17:06 +01:00
Timothy Flynn
93e90e16c3 Base: Add a man page for the timezone utility 2022-01-28 23:18:17 +00:00
Ali Mohammad Pur
e72521f286 LibCoredump: Copy out the FooInfo structs to an aligned address
We were handing out unaligned pointers to these, which made UBSAN super
mad, copy them out to avoid that.
2022-01-28 22:51:27 +00:00
Ali Mohammad Pur
e0db9cb876 LibDebug+LibCoredump: Replace remaining reinterpret_casts and C casts
You misused your toys and I'm now taking them away, reflect on what you
did wrong for a bit.
2022-01-28 22:51:27 +00:00
Ali Mohammad Pur
da3c4e5df5 LibDebug+LibCoredump: Use ByteReader to do unaligned reads
The previous solution of "lol whats a UB" was not nice and tripped over
itself when it was run under UBSAN, fix this by doing explicit
byte-by-byte reads where needed.
2022-01-28 22:51:27 +00:00
Ali Mohammad Pur
6d64b13a1b LibDebug+Everywhere: Avoid void* -> FlatPtr -> void* dance
And limit the `void*` to the functions that interface the system (i.e.
ptrace wrappers).
This generally makes the code less riddled with casts.
2022-01-28 22:51:27 +00:00
Andreas Kling
b27b22a68c Kernel: Allocate entire SelectBlocker::FDVector at once
Use try_ensure_capacity() + unchecked_append() instead of repeatedly
doing try_append().
2022-01-28 23:41:18 +01:00
Andreas Kling
a12e19c015 Kernel: Move kernel region checks from x86 page fault handler to MM
Ideally the x86 fault handler would only do x86 specific things and
delegate the rest of the work to MemoryManager. This patch moves some of
the address checks to a more generic place.
2022-01-28 23:41:18 +01:00
Andreas Kling
5092813a45 Kernel: Quickly reject userspace addresses in kernel_region_from_vaddr()
This avoids taking and releasing the MM lock just to reject an address
that we can tell from just looking at it that it won't ever be in the
kernel regions tree.
2022-01-28 23:41:18 +01:00
kleines Filmröllchen
145eeb57ab Userland: Remove a bunch of unnecessary Vector imports
How silly :^)
2022-01-28 23:40:25 +01:00
kleines Filmröllchen
4efe6210ee Applets/Audio: Use Array for the volume level bitmaps 2022-01-28 23:40:25 +01:00
kleines Filmröllchen
cab6384966 HexEditor: Use Array in FindDialog's options 2022-01-28 23:40:25 +01:00
kleines Filmröllchen
1a8c8d2383 Chess: Don't use Vector in a literal iterator 2022-01-28 23:40:25 +01:00
kleines Filmröllchen
a79a9fb692 LibAudio: Use ArrayLike concept to remove duplicate Buffer constructor 2022-01-28 23:40:25 +01:00
kleines Filmröllchen
cfb8eeebe8 AK: Allow constructing a JsonArray from any array-like type 2022-01-28 23:40:25 +01:00
kleines Filmröllchen
2f631f7dc0 AK: Allow constructing a JsonValue from a StringView explicitly
The next commit will destroy overload detection otherwise, so let's add
this constructor. Currently, the same work is already done implicitly
through the implicit `String(StringView)` constructor.
2022-01-28 23:40:25 +01:00
kleines Filmröllchen
07977ad94c AK: Introduce the ArrayLike concept
The ArrayLike type concept focuses on array-like data accesses. This
means the ability to randomly index, obtain size information, as well as
being able to expose the storage pointer. The last two already have the
standard APIs `size` and `data`, respectively.

The ArrayLike concept should always be fulfilled by Vector, FixedArray
and Array as the three main array-like types. C-style arrays themselves
of course can't fulfil ArrayLike (which could be considered ironic), but
as we don't use them much anyways this isn't a problem.
2022-01-28 23:40:25 +01:00
Daniel Bertalan
6003b6f4d3 LibTextCodec: Do not allocate the various decoders
These objects contain no data members, so there is no point in creating
1-byte heap allocations for them. We don't need to have them as static
local variables, as they are trivially constructible, so they can simply
be global variables.
2022-01-28 23:31:00 +01:00
Daniel Bertalan
7d11edbe17 Userland: Fix unnecessary heap allocation of singleton objects
In order to avoid having multiple instances, we were keeping a pointer
to these singleton objects and only allocating them when it was null.

We have `__cxa_guard_{acquire,release}` in the userland, so there's no
need to do this dance, as the compiler will ensure that the constructors
are only called once.
2022-01-28 23:31:00 +01:00
Ali Mohammad Pur
c1184c1fde RequestServer: Replace disconnected sockets in the grace period too
We previously only replaced disconnected sockets on the queued-request
path, leading to attempts to send requests on a disconnected socket if
the disconnection happened in the deletion grace period.
2022-01-28 23:29:32 +01:00
Timothy Flynn
b387ac56b6 LibCore: Change DateTime format strings to be StringViews
There's no need to allocate a String for these. Note the "string"
parameter of DateTime::parse is left as a String for now; the parser is
currently using strtol which needs a NUL-terminated string. This method
can likely be rewritten with GenericLexer.
2022-01-28 20:19:05 +00:00
Timothy Flynn
9c80430eea LibCore: Remove time zone from default format string
The default format string is used in many applications/services like
FileManager/FileSystemAccessServer. Showing the time zone in e.g. the
last modified time for every file in FileManager is feeling a bit over
the top, so let's revert this change and assume the user is smart enough
to know what time zone they are in.
2022-01-28 20:19:05 +00:00
Timothy Flynn
5ca1c54c27 date: Use an explicit time format string for default option
This is to prepare for removing the time zone from DateTime's default
format string. The date utility on most system show time zone by default
so let's keep that.
2022-01-28 20:19:05 +00:00
Ali Mohammad Pur
58ed00f633 run-tests: Dump a backtrace for crashed tests
It only makes sense to see what a crashed test was up to, so generate a
backtrace if we can find the coredump and read it.
2022-01-28 20:18:46 +00:00
Ali Mohammad Pur
1c121d7488 js: Use generic reference instead of Variant<A,B>
As the two types are used in exactly the same way, just make the lambda
generic over the type instead of explicitly moving them into a variant
and then visiting with a generic lambda.
2022-01-28 20:18:46 +00:00
Sergei Reznikov
a9a1d0afb4 Documentation: Document setting UUID for VDI image 2022-01-28 19:46:52 +00:00
Timothy Flynn
74939eb943 LibJS: Implement Intl.PluralRules.prototype.resolvedOptions 2022-01-28 19:38:47 +00:00
Timothy Flynn
8b3f49ff84 LibJS: Implement Intl.PluralRules.supportedLocalesOf 2022-01-28 19:38:47 +00:00
Timothy Flynn
624fad3821 js: Implement pretty-printing of Intl.PluralRules 2022-01-28 19:38:47 +00:00
Timothy Flynn
348059bffd LibJS: Implement the Intl.PluralRules constructor 2022-01-28 19:38:47 +00:00
Timothy Flynn
0087804d10 LibJS: Implement a nearly empty Intl.PluralRules object
This adds plumbing for the Intl.PluralRules object, constructor, and
prototype.
2022-01-28 19:38:47 +00:00
Timothy Flynn
ac3e42a8de LibJS: Move some Intl.NumberFormat fields into a NumberFormatBase class
Other Intl objects, such as PluralRules, are to be treated as a
NumberFormat object in some AOs. There's only a handful of fields which
are to be shared between those objects - move them to a base class for
shared reuse.

This also updates the couple of NumberFormat AOs that are meant to
operate on these NumberFormat-like objects.

Alternatively, we could just have objects like PluralRules inherit from
NumberFormat directly. But that messes up the is<NumberFormat> runtime
checks, so this feels safer.
2022-01-28 19:38:47 +00:00
Idan Horowitz
e1ad9326df Kernel: Remove unimplemented AHCIPort::is_hot_pluggable declaration 2022-01-28 19:05:52 +02:00
Idan Horowitz
5146315a15 Kernel: Convert MemoryManager::allocate_user_physical_page to ErrorOr
This allows is to use the TRY macro at the call sites, instead of using
clunky null checks.
2022-01-28 19:05:52 +02:00
Idan Horowitz
bd5b56cab0 Kernel: Make allocate_supervisor_physical_page OOM-fallible 2022-01-28 19:05:52 +02:00
Idan Horowitz
4d2f1a05ec Kernel: Make allocate_contiguous_supervisor_physical_pages OOM-fallible 2022-01-28 19:05:52 +02:00
Idan Horowitz
956824afe2 Kernel: Use memset instead of fast_u32_fill in MemoryManager zero fills
When the values we're setting are not actually u32s and the size of the
area we're setting is PAGE_SIZE-aligned and a multiple of PAGE_SIZE in
size, there's no point in using fast_u32_fill, as that forces us to use
STOSDs instead of STOSQs.
2022-01-28 19:05:52 +02:00
Idan Horowitz
c131e69748 Kernel: Make UHCIController::spawn_port_process OOM-fallible 2022-01-28 19:05:52 +02:00
Idan Horowitz
ad7d4d9be1 Kernel: Rename UHCIController::{spawn_port_proc => spawn_port_process}
There's no need to use this non-standard shorthand mnemonic.
(This commit also removes the unimplemented do_debug_transfer while
we're here.)
2022-01-28 19:05:52 +02:00
Idan Horowitz
fa7ae7288b zip: Ignore symlinks when recursively zipping files
This prevents infinite loops when symlinks point to a parent directory.
2022-01-28 19:05:52 +02:00
Idan Horowitz
fcdd56633b Meta: Set correct boot drive when running with SERENITY_NVME_ENABLE 2022-01-28 19:05:52 +02:00
Timothy Flynn
bd5662d6f2 CharacterMap: Move display name strings into the search results object
Now that we're passing the display name directly to the search results
structure, let's move() the string instead of copying it.
2022-01-28 15:26:58 +00:00
Timothy Flynn
54d89401df CharacterMap: Change the search widget to display results in a TableView
Code points that have a bidirectional attribute of right-to-left (e.g.
some Arabic and Hebrew code points) were causing the code point to
render at the end of the search result, rather than the beginning. To
keep the results consistent, split the search results into two columns:
the first for the code point, the second for its name.
2022-01-28 15:26:58 +00:00
Timothy Flynn
acfcad0b06 Revert "FileSystemAccessServer: Display times in the local time zone"
This reverts commit fa016a72fd.
2022-01-28 15:13:35 +00:00
Timothy Flynn
55d28a738e Revert "FileManager: Display times in the user's local time zone"
This reverts commit 080b054695.
2022-01-28 15:13:35 +00:00
Timothy Flynn
0a1e717e40 Revert "ls: Display times in the user's local time zone"
This reverts commit 0c13a3a8ff.
2022-01-28 15:13:35 +00:00
Timothy Flynn
8599ee3049 Revert "Userland: Invoke tzset in apps that care about time zones"
This reverts most of commit ede5c9548e.
The one change not reverted is ClockWidget.h, so that the taskbar clock
can continue to notice time zone changes.
2022-01-28 15:13:35 +00:00
Timothy Flynn
6838333f76 LibMain: Invoke tzset in LibMain so all apps can have time zone info
Rather than finding apps that benefit from time zone awareness one-by-
one, and calling tzset in their serenity_main, let's do it in LibMain.
2022-01-28 15:13:35 +00:00
Lenny Maiorani
899f062673 LibSoftGPU: Simplify clipping logic
The clipping logic is not DRY (Don't Repeat Yourself). The same logic
is repeated in multiple parts of an `if-else` statement. This can be
simplified to contain fewer branches and eliminate the redundant code.
2022-01-28 17:02:04 +02:00