Kernel: Mark Process::jail() method as const

We really don't want callers of this function to accidentally change
the jail, or even worse - remove the Process from an attached jail.
To ensure this never happens, we can just declare this method as const
so nobody can mutate it this way.
This commit is contained in:
Liav A 2023-01-06 10:08:22 +02:00 committed by Ali Mohammad Pur
commit 04221a7533
Notes: sideshowbarker 2024-07-17 04:34:25 +09:00
6 changed files with 13 additions and 13 deletions

View file

@ -39,7 +39,7 @@ LockRefPtr<Jail> JailManagement::find_jail_by_index(JailIndex index)
ErrorOr<void> JailManagement::for_each_in_same_jail(Function<ErrorOr<void>(Jail&)> callback)
{
return Process::current().jail().with([&](auto& my_jail) -> ErrorOr<void> {
return Process::current().jail().with([&](auto const& my_jail) -> ErrorOr<void> {
// Note: If we are in a jail, don't reveal anything about the outside world,
// not even the fact that we are in which jail...
if (my_jail)