Andreas Kling
e6929835d2
Kernel: Make copy_time_from_user() helpers use KResultOr<Time>
...
...and use TRY() for smooth error propagation everywhere.
2021-09-07 01:18:02 +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
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
e3b063581e
Kernel: Use TRY() in sys$alarm()
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
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
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
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
98dc08fe56
Kernel: Use KResultOr better in ProcessGroup construction
...
This allows us to use TRY() more.
2021-09-06 01:55:27 +02:00
Andreas Kling
12d9a6c1fa
Kernel: Use TRY() in sys$waitid()
2021-09-05 18:42:32 +02:00
Andreas Kling
c076d765c4
Kernel: Simplify sys$inode_watcher_remove_watch() a little bit
2021-09-05 18:41:28 +02:00
Andreas Kling
d912bfdf38
Kernel: Use TRY() in sys$create_inode_watcher() and friends
2021-09-05 18:41:01 +02:00
Andreas Kling
a9204510a4
Kernel: Make file description lookup return KResultOr
...
Instead of checking it at every call site (to generate EBADF), we make
file_description(fd) return a KResultOr<NonnullRefPtr<FileDescription>>.
This allows us to wrap all the calls in TRY(). :^)
The only place that got a little bit messier from this is sys$mount(),
and there's a whole bunch of things there in need of cleanup.
2021-09-05 18:36:13 +02:00
Andreas Kling
2d2ea05c97
Kernel: Use TRY() in sys$sethostname()
2021-09-05 18:22:18 +02:00
Andreas Kling
963f847579
Kernel: Use TRY() in sys$mount()
2021-09-05 18:20:57 +02:00
Andreas Kling
3580c5a72e
Kernel: Use TRY() in sys$umount()
2021-09-05 18:18:23 +02:00
Andreas Kling
76f2596ce8
Kernel: Use TRY() in sys$set_process_name()
2021-09-05 18:17:06 +02:00
Andreas Kling
53aa01384d
Kernel: Use TRY() in sys$set_coredump_metadata()
2021-09-05 18:15:42 +02:00
Andreas Kling
bfe4c84541
Kernel: Use TRY() in sys$create_thread()
2021-09-05 18:15:05 +02:00
Andreas Kling
257fa80312
Kernel: Use TRY() in sys$set_thread_name()
2021-09-05 18:15:05 +02:00
Andreas Kling
afc5bbd56b
Kernel: Use TRY() in sys$write()
2021-09-05 18:15:05 +02:00
Andreas Kling
17933b193a
Kernel: Use TRY() in sys$perf_register_string()
2021-09-05 18:15:05 +02:00
Andreas Kling
77b7a44691
Kernel: Use TRY() in sys$recvfd()
2021-09-05 18:15:05 +02:00
Andreas Kling
ea911bc125
Kernel: Use TRY() in sys$pledge()
2021-09-05 18:15:05 +02:00
Andreas Kling
95e74d1776
Kernel: Use TRY() even more in sys$mmap() and friends :^)
2021-09-05 18:15:05 +02:00
Andreas Kling
cf2c04eb13
Kernel: Use TRY() in sys$dbgputstr()
2021-09-05 18:15:05 +02:00
Andreas Kling
6dddd500bf
Kernel: Use TRY() in sys$map_time_page()
2021-09-05 18:15:05 +02:00
Andreas Kling
d53c60fd9f
Kernel: Use TRY() in sys$setkeymap()
2021-09-05 18:15:05 +02:00
Andreas Kling
1f475f7bbc
Kernel: Use TRY() in sys$realpath()
2021-09-05 18:15:05 +02:00
Andreas Kling
4ea3dc77f0
Kernel: Use TRY() in sys$statvfs()
2021-09-05 18:15:05 +02:00
Andreas Kling
7efa742a39
Kernel: Use TRY() in sys$stat()
2021-09-05 17:58:08 +02:00
Andreas Kling
de2c1bc5c3
Kernel: Use TRY() in sys$unlink()
2021-09-05 17:56:40 +02:00