Andreas Kling
d6fe5e1e5b
Kernel/KCOV: Use TRY() in KCOVInstance::buffer_allocate()
2021-09-06 20:33:35 +02:00
Andreas Kling
0d44cdb7a2
Kernel: Wrap two VirtualFileSystem directory traversals in TRY()
2021-09-06 20:30:18 +02:00
Andreas Kling
1101994fad
Kernel: Wrap ISO9660FS directory traversal in TRY()
2021-09-06 20:28:40 +02:00
Andreas Kling
a2bf8244fe
Kernel: Use TRY() once more in LocalSocket::try_create_connected_pair()
2021-09-06 20:26:03 +02:00
Andreas Kling
704a2bfad5
Kernel: Use TRY() in TmpFSInode::write_bytes()
2021-09-06 20:24:38 +02:00
Andreas Kling
274d535d0e
Kernel: Use TRY() in sys$module_load() and sys$module_unload()
2021-09-06 20:23:08 +02:00
Andreas Kling
56a2594de7
Kernel: Make KString factories return KResultOr + use TRY() everywhere
...
There are a number of places that don't have an error propagation path
right now, so I've added FIXME's about that.
2021-09-06 19:25:36 +02:00
Andreas Kling
69b9b2888c
Kernel: Don't allocate so much when generating coredumps
...
Instead of creating a bunch of ByteBuffers and concatenating them to
generate the "notes" segment, we now simply create a KBufferBuilder
and tell each of the notes generator helpers to write into the builder.
This allows the code to flow more naturally, with some bonus additional
error propagation. :^)
2021-09-06 18:56:51 +02:00
Andreas Kling
9db8a14264
Kernel: Make SysFS and ProcFS generator functions return KResult
...
This allows us to propagate a whole bunch of KBufferBuilder errors.
2021-09-06 18:56:51 +02:00
Andreas Kling
2065ced8f6
Kernel: Make KBufferBuilder::append() & friends return KResult
...
This allows callers to react to a failed append (due to OOM.)
2021-09-06 18:56:51 +02:00
Andreas Kling
60eea6940f
Kernel: Tidy up Coredump construction
...
- Use KResultOr and TRY to propagate errors
- Return more specific errors now that they have a path out from here
2021-09-06 18:56:51 +02:00
Andreas Kling
c11c0fe453
Kernel: Use TRY() in Coredump
2021-09-06 18:56:51 +02:00
Andreas Kling
f16b9a691f
Kernel: Rename ProcessPagingScope => ScopedAddressSpaceSwitcher
2021-09-06 18:56:51 +02:00
Andreas Kling
cd8d52e6ae
Kernel: Improve API names for switching address spaces
...
- enter_space => enter_address_space
- enter_process_paging_scope => enter_process_address_space
2021-09-06 18:56:51 +02:00
Andreas Kling
298cd57fe7
Kernel: Allocate signal trampoline before committing to a sys$execve()
...
Once we commit to a new executable image in sys$execve(), we can no
longer return with an error to whoever called us from userspace.
We must make sure to surface any potential errors before that point.
This patch moves signal trampoline allocation before the commit.
A number of other things remain to be moved.
2021-09-06 18:56:51 +02:00
Andreas Kling
6863d015ec
Kernel: Use TRY() more in sys$execve()
...
I just keep finding more and more places to make use of this. :^)
2021-09-06 18:56:51 +02:00
Andreas Kling
009ea5013d
Kernel: Use TRY() in find_elf_interpreter_for_executable()
2021-09-06 18:56:51 +02:00
Andreas Kling
511ebffd94
Kernel: Improve find_elf_interpreter_for_executable() parameter names
2021-09-06 18:56:51 +02:00
Andreas Kling
645e29a88b
Kernel: Don't turn I/O errors during sys$execve() into ENOEXEC
...
Instead, just propagate whatever the real error was.
2021-09-06 13:06:05 +02:00
Andreas Kling
84addef10f
Kernel: Improve arguments retrieval error propagation in sys$execve()
...
Instead of turning any arguments related error into an EFAULT, we now
propagate the innermost error during arguments retrieval.
2021-09-06 13:06:05 +02:00
Andreas Kling
6e3381ac32
Kernel: Use KResultOr and TRY() for {Shared,Private}InodeVMObject
2021-09-06 13:06:05 +02:00
Andreas Kling
e3a716ceff
Kernel: Make Memory::Region::map() return KResult
...
..and use TRY() at the call sites to propagate errors. :^)
2021-09-06 13:06:05 +02:00
Andreas Kling
7981422500
Kernel: Make Threads always have a name
...
We previously allowed Thread to exist in a state where its m_name was
null, and had to work around that in various places.
This patch removes that possibility and forces those who would create a
thread (or change the name of one) to provide a NonnullOwnPtr<KString>
with the name.
2021-09-06 13:06:05 +02:00
Andreas Kling
cda2b9e71c
Kernel: Improvements to Custody absolute path serialization
...
- Renamed try_create_absolute_path() => try_serialize_absolute_path()
- Use KResultOr and TRY() to propagate errors
- Don't call this when it's only for debug logging
2021-09-06 13:06:05 +02:00
Andreas Kling
f173f73f10
Kernel/USB: Use TRY() and adopt_nonnull_own_or_enomem() some more
2021-09-06 13:06:05 +02:00
Andreas Kling
e3b063581e
Kernel: Use TRY() in sys$alarm()
2021-09-06 13:06:05 +02:00
Andreas Kling
b083b165a7
Kernel/Ext2FS: Wrap calls to traverse_as_directory() in TRY()
...
Nothing says we can't TRY() a multi-line function call. :^)
2021-09-06 13:06:05 +02:00
Andreas Kling
18dbafec85
Kernel: Use TRY() more in Plan9FS
2021-09-06 13:06:05 +02:00
Andreas Kling
d34f2b643e
Kernel: Tidy up Plan9FS construction a bit
2021-09-06 13:06:05 +02:00
Andreas Kling
36725228fa
Kernel: Tidy up Ext2FS construction a bit
2021-09-06 13:06:05 +02:00
Andreas Kling
47bfbe343b
Kernel: Tidy up SysFS construction
...
- Use KResultOr and TRY() to propagate errors
- Check for OOM errors
- Move allocation out of constructors
There's still a lot more to do here, as SysFS is still quite brittle
in the face of memory pressure.
2021-09-06 13:06:05 +02:00
Andreas Kling
788b91a65c
Kernel: Tidy up DevFS construction and handle OOM errorso
...
- Use KResultOr and TRY() to propagate errors
- Check for OOM
- Move allocations out of the DevFS constructor
2021-09-06 13:06:05 +02:00
Andreas Kling
efe4e230ee
Kernel: Tidy up DevPtsFS construction and handle OOM errors
...
- Use KResultOr and TRY() to propagate errors
- Check for OOM when creating new inodes
2021-09-06 13:06:05 +02:00
Andreas Kling
f2512071f2
Kernel: Use TRY() in sys$getrandom()
2021-09-06 02:36:21 +02:00
Andreas Kling
a8516681b7
Kernel: Tidy up TmpFS and TmpFSInode construction
...
- Use KResultOr<NonnullRefPtr<T>>
- Propagate errors
- Use TRY() at call sites
2021-09-06 02:36:21 +02:00
Andreas Kling
398f8e7c96
Kernel: Use TRY() more in process-specific ProcFS code
2021-09-06 02:14:22 +02:00
Andreas Kling
f4a6b60570
Kernel: Use TRY() in Graphics::VirtIOGPU::FrameBufferDevice
2021-09-06 02:11:46 +02:00
Andreas Kling
17a12c8a30
Kernel: Use TRY() in FramebufferDevice
2021-09-06 02:10:01 +02:00
Andreas Kling
7a8061ba0c
Kernel: Use TRY() in ISO9660FileSystem
2021-09-06 02:06:49 +02:00
Andreas Kling
a994f11f10
Kernel: Make AddressSpace::add_region() return KResultOr<Region*>
...
This allows us to use TRY() in a few places.
2021-09-06 02:02:06 +02:00
Andreas Kling
062cc804e7
Kernel: Use TRY() some more in Memory::AddressSpace
2021-09-06 01:59:30 +02:00
Andreas Kling
75564b4a5f
Kernel: Make kernel region allocators return KResultOr<NOP<Region>>
...
This expands the reach of error propagation greatly throughout the
kernel. Sadly, it also exposes the fact that we're allocating (and
doing other fallible things) in constructors all over the place.
This patch doesn't attempt to address that of course. That's work for
our future selves.
2021-09-06 01:55:27 +02:00
Andreas Kling
cb71a73708
Kernel/USB: Tidy up UHCIDescriptorPool construction
...
- Use KResultOr<NonnullRefPtr<UHCIDescriptorPool<T>>
- Make the constructor private
- Use TRY() at call sites
2021-09-06 01:55:27 +02:00
Andreas Kling
91fe6b6552
Kernel/KCOV: Bring closer to typical SerenityOS coding style
...
- Remove a bunch of redundant `this->`
- Make class data members private and provide accessors instead
2021-09-06 01:55:27 +02:00
Andreas Kling
79fbad6df9
Kernel/USB: Tidy up USB::Transfer construction
2021-09-06 01:55:27 +02:00
Andreas Kling
f4a9a0d561
Kernel: Make VirtualRangeAllocator return KResultOr<VirtualRange>
...
This achieves two things:
- The allocator can report more specific errors
- Callers can (and now do) use TRY() :^)
2021-09-06 01:55:27 +02:00
Andreas Kling
21f7932ae2
Kernel: Use TRY() and adopt_nonnull_ref_or_enomem() in AnonymousVMObject
2021-09-06 01:55:27 +02:00
Andreas Kling
52cbbe1dc5
Kernel: Actually share committed CoW pages
...
Due to a double-move mistake, we were always clearing the shared
committed CoW pages in the parent when forking.
2021-09-06 01:55:27 +02:00
Andreas Kling
2f790cf78f
Kernel: Make MM.commit_user_physical_pages() return KResultOr
...
..and use TRY() at call sites. :^)
2021-09-06 01:55:27 +02:00
Andreas Kling
98dc08fe56
Kernel: Use KResultOr better in ProcessGroup construction
...
This allows us to use TRY() more.
2021-09-06 01:55:27 +02:00