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
Andreas Kling
b01e4b171d
Kernel: Use TRY() in sys$mknod()
2021-09-05 16:25:40 +02:00
Andreas Kling
2658ab4a80
Kernel: Use TRY() in sys$mkdir()
2021-09-05 16:25:40 +02:00
Andreas Kling
e899ea459c
Kernel: Use TRY() in sys$lseek()
2021-09-05 16:25:40 +02:00
Andreas Kling
f605cd04b6
Kernel: Use TRY() in sys$fork()
...
There's a lot of work to do on improving error propagation in the
fork system call. This just scratches the surface.
2021-09-05 16:25:40 +02:00
Andreas Kling
29bafec43b
Kernel: Use is_error() in sys$fcntl()
2021-09-05 16:25:40 +02:00
Andreas Kling
c767e20f91
Kernel: Use TRY() in sys$chown()
2021-09-05 16:25:40 +02:00
Andreas Kling
24e8ad5ade
Kernel: Use TRY() in sys$chmod()
2021-09-05 16:25:40 +02:00
Andreas Kling
3631ebe963
Kernel: Use TRY() in AnonymousVMObject
2021-09-05 16:25:40 +02:00
Andreas Kling
abb43468dc
Kernel: Use TRY() in FileDescription::attach()
2021-09-05 16:25:40 +02:00
Andreas Kling
aa4d5817af
Kernel: Use TRY() in sys$ptrace()
2021-09-05 16:25:40 +02:00