diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp index eb7946f6fa..a825c9b72c 100644 --- a/Kernel/Syscalls/execve.cpp +++ b/Kernel/Syscalls/execve.cpp @@ -47,9 +47,9 @@ static bool validate_stack_size(NonnullOwnPtrVector const& arguments, N size_t total_arguments_size = 0; size_t total_environment_size = 0; - for (auto& a : arguments) + for (auto const& a : arguments) total_arguments_size += a.length() + 1; - for (auto& e : environment) + for (auto const& e : environment) total_environment_size += e.length() + 1; total_arguments_size += sizeof(char*) * (arguments.size() + 1); @@ -98,13 +98,13 @@ static ErrorOr make_userspace_context_for_main_thread([[maybe_unused]] }; Vector argv_entries; - for (auto& argument : arguments) { + for (auto const& argument : arguments) { push_string_on_new_stack(argument.view()); TRY(argv_entries.try_append(new_sp)); } Vector env_entries; - for (auto& variable : environment) { + for (auto const& variable : environment) { push_string_on_new_stack(variable.view()); TRY(env_entries.try_append(new_sp)); } @@ -464,7 +464,7 @@ ErrorOr Process::do_exec(NonnullRefPtr main_program_d interpreter_description = nullptr; auto signal_trampoline_range = TRY(load_result.space->try_allocate_range({}, PAGE_SIZE)); - auto signal_trampoline_region = TRY(load_result.space->allocate_region_with_vmobject(signal_trampoline_range, g_signal_trampoline_region->vmobject(), 0, "Signal trampoline", PROT_READ | PROT_EXEC, true)); + auto* signal_trampoline_region = TRY(load_result.space->allocate_region_with_vmobject(signal_trampoline_range, g_signal_trampoline_region->vmobject(), 0, "Signal trampoline", PROT_READ | PROT_EXEC, true)); signal_trampoline_region->set_syscall_region(true); // (For dynamically linked executable) Allocate an FD for passing the main executable to the dynamic loader. @@ -734,7 +734,7 @@ ErrorOr> Process::find_elf_interpreter_for_executabl if (nread < sizeof(ElfW(Ehdr))) return ENOEXEC; - auto elf_header = (ElfW(Ehdr)*)first_page; + auto* elf_header = (ElfW(Ehdr)*)first_page; if (!ELF::validate_elf_header(*elf_header, interp_metadata.size)) { dbgln("exec({}): Interpreter ({}) has invalid ELF header", path, interpreter_path); return ENOEXEC; @@ -816,7 +816,7 @@ ErrorOr Process::exec(NonnullOwnPtr path, NonnullOwnPtrVector Process::exec(NonnullOwnPtr path, NonnullOwnPtrVector Process::sys$inode_watcher_add_watch(Userspaceis_inode_watcher()) return EBADF; - auto inode_watcher = description->inode_watcher(); + auto* inode_watcher = description->inode_watcher(); auto path = TRY(get_syscall_path_argument(params.user_path)); auto custody = TRY(VirtualFileSystem::the().resolve_path(path->view(), current_directory())); if (!custody->inode().fs().supports_watchers()) diff --git a/Kernel/Syscalls/kill.cpp b/Kernel/Syscalls/kill.cpp index 1d2ff248d1..a9199153ab 100644 --- a/Kernel/Syscalls/kill.cpp +++ b/Kernel/Syscalls/kill.cpp @@ -88,7 +88,7 @@ ErrorOr Process::do_killself(int signal) if (signal == 0) return {}; - auto current_thread = Thread::current(); + auto* current_thread = Thread::current(); if (!current_thread->should_ignore_signal(signal)) current_thread->send_signal(signal, this); diff --git a/Kernel/Syscalls/mmap.cpp b/Kernel/Syscalls/mmap.cpp index ef380d3db8..eeaabc98be 100644 --- a/Kernel/Syscalls/mmap.cpp +++ b/Kernel/Syscalls/mmap.cpp @@ -47,8 +47,8 @@ static bool should_make_executable_exception_for_dynamic_loader(bool make_readab if (!region.vmobject().is_private_inode()) return false; - auto& inode_vm = static_cast(region.vmobject()); - auto& inode = inode_vm.inode(); + auto const& inode_vm = static_cast(region.vmobject()); + auto const& inode = inode_vm.inode(); ElfW(Ehdr) header; auto buffer = UserOrKernelBuffer::for_kernel_buffer((u8*)&header); @@ -310,7 +310,7 @@ ErrorOr Process::sys$mprotect(Userspace addr, size_t size, int p auto adjacent_regions = TRY(address_space().try_split_region_around_range(*region, range_to_mprotect)); size_t new_range_offset_in_vmobject = region->offset_in_vmobject() + (range_to_mprotect.base().get() - region->range().base().get()); - auto new_region = TRY(address_space().try_allocate_split_region(*region, range_to_mprotect, new_range_offset_in_vmobject)); + auto* new_region = TRY(address_space().try_allocate_split_region(*region, range_to_mprotect, new_range_offset_in_vmobject)); new_region->set_readable(prot & PROT_READ); new_region->set_writable(prot & PROT_WRITE); new_region->set_executable(prot & PROT_EXEC); @@ -483,7 +483,7 @@ ErrorOr Process::sys$mremap(Userspace old_region->unmap(Memory::Region::ShouldDeallocateVirtualRange::No); address_space().deallocate_region(*old_region); - auto new_region = TRY(address_space().allocate_region_with_vmobject(range, move(new_vmobject), old_offset, old_name->view(), old_prot, false)); + auto* new_region = TRY(address_space().allocate_region_with_vmobject(range, move(new_vmobject), old_offset, old_name->view(), old_prot, false)); new_region->set_mmap(true); return new_region->vaddr().get(); } @@ -520,7 +520,7 @@ ErrorOr Process::sys$allocate_tls(Userspace initial_data, return EINVAL; auto range = TRY(address_space().try_allocate_range({}, size)); - auto region = TRY(address_space().allocate_region(range, String("Master TLS"), PROT_READ | PROT_WRITE)); + auto* region = TRY(address_space().allocate_region(range, String("Master TLS"), PROT_READ | PROT_WRITE)); m_master_tls_region = region->make_weak_ptr(); m_master_tls_size = size; diff --git a/Kernel/Syscalls/poll.cpp b/Kernel/Syscalls/poll.cpp index 8465553bf5..6b914cdc8c 100644 --- a/Kernel/Syscalls/poll.cpp +++ b/Kernel/Syscalls/poll.cpp @@ -59,7 +59,7 @@ ErrorOr Process::sys$poll(Userspace use TRY(fds_info.try_append({ move(description), block_flags })); } - auto current_thread = Thread::current(); + auto* current_thread = Thread::current(); u32 previous_signal_mask = 0; if (params.sigmask) diff --git a/Kernel/Syscalls/ptrace.cpp b/Kernel/Syscalls/ptrace.cpp index 8f246d29aa..d9dd531f8c 100644 --- a/Kernel/Syscalls/ptrace.cpp +++ b/Kernel/Syscalls/ptrace.cpp @@ -170,7 +170,7 @@ ErrorOr Process::sys$ptrace(Userspace */ bool Process::has_tracee_thread(ProcessID tracer_pid) { - if (auto tracer = this->tracer()) + if (auto const* tracer = this->tracer()) return tracer->tracer_pid() == tracer_pid; return false; } diff --git a/Kernel/Syscalls/sigaction.cpp b/Kernel/Syscalls/sigaction.cpp index 0b4ca0db42..a7c4627f3d 100644 --- a/Kernel/Syscalls/sigaction.cpp +++ b/Kernel/Syscalls/sigaction.cpp @@ -15,7 +15,7 @@ ErrorOr Process::sys$sigprocmask(int how, Userspace se { VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this) REQUIRE_PROMISE(sigaction); - auto current_thread = Thread::current(); + auto* current_thread = Thread::current(); u32 previous_signal_mask; if (set) { auto set_value = TRY(copy_typed_from_user(set)); @@ -172,7 +172,7 @@ ErrorOr Process::remap_range_as_stack(FlatPtr address, size_t size) auto adjacent_regions = TRY(address_space().try_split_region_around_range(*region, range_to_remap)); size_t new_range_offset_in_vmobject = region->offset_in_vmobject() + (range_to_remap.base().get() - region->range().base().get()); - auto new_region = TRY(address_space().try_allocate_split_region(*region, range_to_remap, new_range_offset_in_vmobject)); + auto* new_region = TRY(address_space().try_allocate_split_region(*region, range_to_remap, new_range_offset_in_vmobject)); new_region->unsafe_clear_access(); new_region->set_readable(true); new_region->set_writable(true); diff --git a/Kernel/Syscalls/statvfs.cpp b/Kernel/Syscalls/statvfs.cpp index 314f0afd94..93121fe0d1 100644 --- a/Kernel/Syscalls/statvfs.cpp +++ b/Kernel/Syscalls/statvfs.cpp @@ -58,7 +58,7 @@ ErrorOr Process::sys$fstatvfs(int fd, statvfs* buf) REQUIRE_PROMISE(stdio); auto description = TRY(fds().open_file_description(fd)); - auto inode = description->inode(); + auto const* inode = description->inode(); if (inode == nullptr) return ENOENT; diff --git a/Kernel/Syscalls/thread.cpp b/Kernel/Syscalls/thread.cpp index 84c9830857..0ac77a487d 100644 --- a/Kernel/Syscalls/thread.cpp +++ b/Kernel/Syscalls/thread.cpp @@ -82,7 +82,7 @@ void Process::sys$exit_thread(Userspace exit_value, Userspace stac this->sys$exit(0); } - auto current_thread = Thread::current(); + auto* current_thread = Thread::current(); current_thread->set_profiling_suppressed(); PerformanceManager::add_thread_exit_event(*current_thread); @@ -120,7 +120,7 @@ ErrorOr Process::sys$join_thread(pid_t tid, Userspace exit_valu if (!thread || thread->pid() != pid()) return ESRCH; - auto current_thread = Thread::current(); + auto* current_thread = Thread::current(); if (thread == current_thread) return EDEADLK; diff --git a/Kernel/Syscalls/ttyname.cpp b/Kernel/Syscalls/ttyname.cpp index 123a02498b..e251890757 100644 --- a/Kernel/Syscalls/ttyname.cpp +++ b/Kernel/Syscalls/ttyname.cpp @@ -18,7 +18,7 @@ ErrorOr Process::sys$ttyname(int fd, Userspace buffer, size_t si auto description = TRY(fds().open_file_description(fd)); if (!description->is_tty()) return ENOTTY; - auto& tty_name = description->tty()->tty_name(); + auto const& tty_name = description->tty()->tty_name(); if (size < tty_name.length() + 1) return ERANGE; TRY(copy_to_user(buffer, tty_name.characters(), tty_name.length() + 1)); @@ -33,7 +33,7 @@ ErrorOr Process::sys$ptsname(int fd, Userspace buffer, size_t si auto* master_pty = description->master_pty(); if (!master_pty) return ENOTTY; - auto& pts_name = master_pty->pts_name(); + auto const& pts_name = master_pty->pts_name(); if (size < pts_name.length() + 1) return ERANGE; TRY(copy_to_user(buffer, pts_name.characters(), pts_name.length() + 1));