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
Andreas Kling
540d62d3b2
Kernel: Simplify WatchDescription::create()
2021-09-06 01:55:27 +02:00
Andreas Kling
5e2bae700d
Kernel: Use TRY() in PTYMultiplexer::open()
2021-09-06 01:55:27 +02:00
Andreas Kling
4d961387c1
Kernel: Use TRY() some more in USB::Hub
2021-09-06 01:55:27 +02:00
Andreas Kling
8ceff65161
Kernel: Use TRY() some more in FileDescription
2021-09-06 01:55:27 +02:00
Andreas Kling
5516592748
Kernel: Use TRY() in BlockBasedFileSystem
2021-09-06 01:55:27 +02:00
Ali Mohammad Pur
97e97bccab
Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe
2021-09-06 01:53:26 +02:00
Ali Mohammad Pur
3a9f00c59b
Everywhere: Use OOM-safe ByteBuffer APIs where possible
...
If we can easily communicate failure, let's avoid asserting and report
failure instead.
2021-09-06 01:53:26 +02:00
Brian Gianforcaro
bb58a4d943
Kernel: Make all Spinlocks use u8 for storage, remove template
...
The default template argument is only used in one place, and it
looks like it was probably just an oversight. The rest of the Kernel
code all uses u8 as the type. So lets make that the default and remove
the unused template argument, as there doesn't seem to be a reason to
allow the size to be customizable.
2021-09-05 20:46:02 +02:00
Brian Gianforcaro
472454cded
Kernel: Switch static_asserts of a type size to AK::AssertSize
...
This will provide better debug ability when the size comparison fails.
2021-09-05 20:08:57 +02:00
Andreas Kling
100b3835f0
Kernel: Use TRY() in DevFSLinkInode::write_bytes()
2021-09-05 19:02:57 +02:00
Andreas Kling
667a39df6b
Kernel: Use TRY() in ProcFS
2021-09-05 19:01:38 +02:00
Andreas Kling
caaeae9607
Kernel: Make FileSystem::get_inode() return KResultOr<NRP<Inode>>
...
This allows for natural error propagation in a bunch of new places.
2021-09-05 18:55:55 +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
Andreas Kling
4e4b7c272c
Kernel: Use TRY() in sys$readlink()
2021-09-05 17:55:43 +02:00
Andreas Kling
e0cf9152ca
Kernel: Use TRY() in sys$rmdir()
2021-09-05 17:54:33 +02:00
Andreas Kling
780737de7a
Kernel: Use TRY() in sys$rename()
2021-09-05 17:53:59 +02:00
Andreas Kling
c5d046c23a
Kernel: Use TRY() in sys$utime()
2021-09-05 17:53:28 +02:00
Andreas Kling
789db813d3
Kernel: Use copy_typed_from_user<T> for fetching syscall parameters
2021-09-05 17:51:37 +02:00
Andreas Kling
d7e5768763
Kernel: Add copy_typed_from_userspace<T>(Userspace<T const*>)
...
This allows easy retrieval of typed POD values from userspace with
implicit error propagation.
2021-09-05 17:50:34 +02:00
Andreas Kling
48a0b31c47
Kernel: Make copy_{from,to}_user() return KResult and use TRY()
...
This makes EFAULT propagation flow much more naturally. :^)
2021-09-05 17:38:37 +02:00
Andreas Kling
9903f5c6ef
Kernel: Use TRY() in sys$read() and sys$readv()
2021-09-05 16:25:40 +02:00
Andreas Kling
c1e18befe8
Kernel: Reorder sys$pipe() to fail more nicely
...
Try to do both FD allocations up front instead of interleaved between
assigning them to the descriptor table. This prevents us from failing
in the middle of setting up the pipes.
2021-09-05 16:25:40 +02:00
Andreas Kling
4483110990
Kernel: Use TRY() in sys$open()
2021-09-05 16:25:40 +02:00