Commit graph

27093 commits

Author SHA1 Message Date
Liav A 009feefee0 Kernel/Devices: Ensure appropriate locking on the Device map singleton
Devices might be removed and inserted at anytime, so let's ensure we
always do these kind of operations with a good known state of the
HashMap.

The VirtIO code was modified to create devices outside the IRQ handler,
so now it works with the new locking of the devices singleton, but a
better approach might be needed later on.
2021-09-08 00:42:20 +02:00
Liav A 21b6d84ff0 Kernel/Devices: Remove required_mode and device_name methods
These methods are no longer needed because SystemServer is able to
populate the DevFS on its own.

Device absolute_path no longer assume a path to the /dev location,
because it really should not assume any path to a Device node.

Because StorageManagement still needs to know the storage name, we
declare a virtual method only for StorageDevices to override, but this
technique should really be removed later on.
2021-09-08 00:42:20 +02:00
Liav A 4f04cb98c1 Kernel/VFS: Silence mknod debug spam
Since we populate the DevFS now in userspace, this creates a bunch of
unnecessary noise in the kernel log.
2021-09-08 00:42:20 +02:00
Liav A e0d712c6f7 Kernel+SystemServer: Defer creation of device nodes to userspace
Don't create these device nodes in the Kernel, so we essentially enforce
userspace (SystemServer) to take control of this operation and to decide
how to create these device nodes.

This makes the DevFS to resemble linux devtmpfs, and allows us to remove
a bunch of unneeded overriding implementations of device name creation
in the Kernel.
2021-09-08 00:42:20 +02:00
Liav A fcc046047f Kernel/DevFS: Simplify nodes insertion and lookup
Use IntrusiveList instead of a Vector to add inodes to a directory.
2021-09-08 00:42:20 +02:00
sin-ack f633fb706e AK: Add note about an internal compile error with Optional in GCC 10.3+
This bit me because I accidentally made the destructor for a class which
was wrapped in an Optional private. This causes none of the Optional
destructors to be able to be deduced, which when combined with concepts
causes an internal compile error in GCC 10.3.0+. This commit adds a note
here to make sure that future encounters of this bug does not surprise
people.
2021-09-08 00:37:19 +02:00
Hendiadyoin1 93ce8fc985 UserspaceEmulator: Handle SO_ERROR in getsockopt
This makes GUI applications work again
2021-09-07 21:26:21 +00:00
Andreas Kling 5017cc2bd3 Meta: Add Idan Horowitz as a project maintainer :^) 2021-09-07 22:16:25 +02:00
Andreas Kling 6696d414d4 Meta: Add Brian Gianforcaro as a project maintainer :^) 2021-09-07 22:16:25 +02:00
Andreas Kling 5159f64117 Kernel: Stop leaking TmpFS inodes
TmpFS inodes rely on the call to Inode::one_ref_left() to unregister
themselves from the inode cache in TmpFS.

When moving various kernel classes to ListedRefCounted for safe unref()
while participating on lists, I forgot to make ListedRefCounted check
for (and call) one_ref_left() & will_be_destroyed() on the CRTP class.
2021-09-07 22:16:25 +02:00
Andreas Kling 049d846eb9 Kernel/TmpFS: Stop leaking directory entry metadata
When creating and removing a child to a TmpFS directory, we were
forgetting to delete the TmpFSInode::Child struct.
2021-09-07 22:16:25 +02:00
Andreas Kling e550d53c0f Kernel: Remove a bunch of unused TimerQueue functions 2021-09-07 22:16:25 +02:00
Andreas Kling 905065f8c8 Kernel: Make PerformanceEventBuffer::to_json() return a KResult
There's a ton of things inside to_json() that could go wrong but we
don't know about it yet. One step at a time.
2021-09-07 22:16:25 +02:00
Andreas Kling 6f992d784f Kernel: Add const variant of Process::perf_events()
This lets us get rid of some const_casts.
2021-09-07 22:16:25 +02:00
Andreas Kling ec4b814c9a Kernel: Use OOM-safe absolute path serialization in InodeFile::mmap()
Switch from OpenFileDescription::absolute_path() to the OOM-safe
try_serialize_absolute_path() (and propagate any errors to the caller.)
2021-09-07 22:16:25 +02:00
Luke Wilde 1a28fc3cb5 LibWeb: Add preceding and following Node cases in tree constraints
This also does some east-const changes in TreeNode.
2021-09-07 22:06:39 +02:00
Idan Horowitz 24ed8511dd CI+Meta: Add Signed-off-by tag filter to the commit message linter 2021-09-07 20:46:34 +01:00
Nico Weber 17ab44e7d7 Meta: Make BuildClang.sh produce less output when running in a TTY
Ninja disables its fancy output mode when it's not writing to a TTY.
So don't pipe its output into something else, so that it writes to
a TTY if the invoking terminal is a TTY.
2021-09-07 20:29:22 +01:00
Nico Weber eb7b8a7bbe Meta: Don't pass LLVM_LLVM_BUILD_LLVM_DYLIB to cmake
`LLVM_LLVM_BUILD_LLVM_DYLIB` does not exist, so passing this does
nothing but make CMake warn.

However, since we pass `LLVM_LINK_LLVM_DYLIB`, `LLVM_BUILD_LLVM_DYLIB`
(the correct spelling) defaults to true anyways.  So let's pass fewer
flags.

No behavior change, but fixes a CMake warning.
2021-09-07 20:29:22 +01:00
Nico Weber 1ed1a57707 Meta: Make serenity.sh rebuild-toolchain aarch64 clang work 2021-09-07 20:29:22 +01:00
Ernests Kuzņecovs 82cb885966 Documentation: Add missing dependencies for Nix
I was building serenity on quite a fresh NixOS system and it turns
out `unzip` and `qemu` were missing from this nix expression to
compile and run serenity.
2021-09-07 20:23:23 +01:00
Nico Weber a8d96df8e0 Kernel: Build MiniStdLib.cpp in aarch64 builds 2021-09-07 20:15:15 +01:00
Nico Weber 208aa05cf3 Kernel: Build UBSanitizer.cpp in aarch64 builds
All these symbols will be needed once we build MiniStdLib.cpp.
2021-09-07 20:15:15 +01:00
Nico Weber d0b0c45690 Kernel: Remove two unused includes from Prekernel/UBSanitizer.cpp 2021-09-07 20:15:15 +01:00
Ali Mohammad Pur 7fefb8148b LibRegex: Use the correct capture group index in ERE bytecode generation
Otherwise the left and right capture instructions wouldn't point to the
same capture group if there was another nested group there.
2021-09-07 20:01:58 +02:00
Luke Wilde 44b8afdbc4 LibWeb: Don't trim whitespace when checking for "module" type on scripts
No major engine allows whitespace in the type when checking for
"module".

This was also reflected in the relevant web platform test, but not in
the spec.

The spec has been changed to match this behaviour: 23c723e3e9
2021-09-07 17:22:24 +02:00
Mustafa Quraish 405b282bc3 PixelPaint: Show mouse position in statusbar without active tool
Showing the position only with an active tool seems a bit confusing,
if you've opened up an image just to find out the coordinates of
a pixel for instance, there shouldn't be a need to have to select
a tool first.
2021-09-07 16:53:40 +02:00
Mustafa Quraish 736ab4f83a PixelPaint: Add Menu action/shortcut to close current image tab
Ctrl+W now closes the current Image tab.
2021-09-07 16:53:40 +02:00
Mustafa Quraish 255f729c1f PixelPaint: Register RectangleTool thickness slider as primary
... So we can use `[` and `]` shortcuts to change the size.
2021-09-07 16:53:40 +02:00
Mustafa Quraish d6348e1b32 PixelPaint: Use correct thickness in RectangleTool::on_second_paint()
Previously, we were ignoring the scale of the editor in the second
paint step. If you were zoomed in, the size while you were drawing
was not the same as the size of the final shape.
2021-09-07 16:53:40 +02:00
Mustafa Quraish 603d3a5dc6 PixelPaint: Use correct thickness in LineTool::on_second_paint()
Previously, we were ignoring the scale of the editor in the second
paint step. If you were zoomed in, the size while you were drawing
was not the same as the size of the final shape.
2021-09-07 16:53:40 +02:00
Mustafa Quraish 0a9c64a4f5 PixelPaint: Use correct thickness in EllipseTool::on_second_paint()
Previously, we were ignoring the scale of the editor in the second
paint step. If you were zoomed in, the size while you were drawing
was not the same as the size of the final shape.
2021-09-07 16:53:40 +02:00
Andreas Kling 9669bf29f6 Kernel: Make Device request creation return KResultOr
This allows us to propagate errors in a bunch of new places.
2021-09-07 16:42:03 +02:00
Andreas Kling a01b19c878 Kernel: Remove KBuffer::try_copy() in favor of try_create_with_bytes()
These were already equivalent, so let's only have one of them.
2021-09-07 16:22:29 +02:00
Andreas Kling 8ded4ad88c Kernel: Simplify KBuffer by removing KBufferImpl
This patch moves everything from KBufferImpl into KBuffer instead.
One layer of indirection is removed, and the whole thing is massively
simplified. :^)
2021-09-07 16:20:47 +02:00
Andreas Kling 60b892772f Kernel: Remove more unused KBuffer API 2021-09-07 16:11:31 +02:00
Andreas Kling 881923dd47 Kernel: Remove KBuffer::is_null() and bogus call sites :^) 2021-09-07 16:00:39 +02:00
Andreas Kling 1a04dc9cba Kernel: Enforce the fact that KBuffer always has internal storage
There are no remaining code paths where KBuffer can end up with a null
internal storage pointer, so let's make it a NonnullRefPtr.
2021-09-07 15:59:34 +02:00
Andreas Kling 16cd86b845 Kernel: Remove some unused KBuffer functions 2021-09-07 15:58:18 +02:00
Andreas Kling 300402cc14 Kernel: Make it possible for KBufferBuilder creation to fail
This patch adds KBufferBuilder::try_create() and treats it like anything
else that can fail. And so, failure to allocate the initial internal
buffer of the builder will now propagate an ENOMEM to the caller. :^)
2021-09-07 15:54:23 +02:00
Andreas Kling be613b9ef6 Kernel: Remove unused KBufferImpl::expand() 2021-09-07 15:45:36 +02:00
Andreas Kling 2c262ddf0f Kernel: Make KBufferBuilder use KBuffer instead of KBufferImpl
This was the last remaining direct client of the KBufferImpl class
outside of KBuffer.
2021-09-07 15:44:45 +02:00
Andreas Kling b300f9aa2f Kernel: Convert KBuffer::copy() => KBuffer::try_copy()
This was a weird KBuffer API that assumed failure was impossible.
This patch converts it to a modern KResultOr<NonnullOwnPtr<KBuffer>> API
and updates the two clients to the new style.
2021-09-07 15:36:39 +02:00
Andreas Kling 250b52d6e5 Kernel: Make KBuffer::try_create_with_bytes() return KResultOr 2021-09-07 15:22:24 +02:00
Andreas Kling 899cee8185 Kernel: Make KBuffer::try_create_with_size() return KResultOr
This allows us to use TRY() in a lot of new places.
2021-09-07 15:15:08 +02:00
Andreas Kling c69035c630 Kernel: TCPSocket always has a scratch buffer
Let's encode this in the constructor signature.
2021-09-07 15:11:49 +02:00
Andreas Kling 308773ffda Kernel/Net: Add a special SOCKET_TRY() and use it in socket code
Sockets remember their last error code in the SO_ERROR field, so we need
to take special care to remember this when returning an error.

This patch adds a SOCKET_TRY() that works like TRY() but also calls
set_so_error() on the failure path.

There's probably a lot more code that should be using this, but that's
outside the scope of this patch.
2021-09-07 15:05:51 +02:00
Andreas Kling 3c44e381d4 Kernel: Use TRY() some more in Socket 2021-09-07 14:55:44 +02:00
Andreas Kling cd5d483bbd Kernel: Use KResultOr and TRY() for ThreadTracer
Also make the constructor private, since it's only called by the static
factory function.
2021-09-07 14:48:13 +02:00
Andreas Kling ededd6aac6 Kernel: Make TCPSocket client construction use KResultOr and TRY()
We don't really have anywhere to propagate the error in NetworkTask at
the moment, since it runs in its own kernel thread and has no direct
userspace caller.
2021-09-07 14:44:29 +02:00