mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Add implicit auto qualifiers in Syscalls
This commit is contained in:
parent
f5b495d92c
commit
c860e0ab95
Notes:
sideshowbarker
2024-07-17 22:39:42 +09:00
Author: https://github.com/Hendiadyoin1 Commit: https://github.com/SerenityOS/serenity/commit/c860e0ab954 Pull-request: https://github.com/SerenityOS/serenity/pull/11294
10 changed files with 24 additions and 24 deletions
|
@ -47,9 +47,9 @@ static bool validate_stack_size(NonnullOwnPtrVector<KString> 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<FlatPtr> make_userspace_context_for_main_thread([[maybe_unused]]
|
|||
};
|
||||
|
||||
Vector<FlatPtr> 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<FlatPtr> 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<void> Process::do_exec(NonnullRefPtr<OpenFileDescription> 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<RefPtr<OpenFileDescription>> 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<void> Process::exec(NonnullOwnPtr<KString> path, NonnullOwnPtrVector<KSt
|
|||
|
||||
if (nread < sizeof(ElfW(Ehdr)))
|
||||
return ENOEXEC;
|
||||
auto main_program_header = (ElfW(Ehdr)*)first_page;
|
||||
auto const* main_program_header = (ElfW(Ehdr)*)first_page;
|
||||
|
||||
if (!ELF::validate_elf_header(*main_program_header, metadata.size)) {
|
||||
dbgln("exec({}): File has invalid ELF header", path);
|
||||
|
@ -834,7 +834,7 @@ ErrorOr<void> Process::exec(NonnullOwnPtr<KString> path, NonnullOwnPtrVector<KSt
|
|||
VERIFY_INTERRUPTS_DISABLED();
|
||||
VERIFY(Processor::in_critical());
|
||||
|
||||
auto current_thread = Thread::current();
|
||||
auto* current_thread = Thread::current();
|
||||
if (current_thread == new_main_thread) {
|
||||
// We need to enter the scheduler lock before changing the state
|
||||
// and it will be released after the context switch into that
|
||||
|
|
|
@ -43,7 +43,7 @@ ErrorOr<FlatPtr> Process::sys$inode_watcher_add_watch(Userspace<const Syscall::S
|
|||
auto description = TRY(fds().open_file_description(params.fd));
|
||||
if (!description->is_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())
|
||||
|
|
|
@ -88,7 +88,7 @@ ErrorOr<void> 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);
|
||||
|
||||
|
|
|
@ -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<Memory::InodeVMObject const&>(region.vmobject());
|
||||
auto& inode = inode_vm.inode();
|
||||
auto const& inode_vm = static_cast<Memory::InodeVMObject const&>(region.vmobject());
|
||||
auto const& inode = inode_vm.inode();
|
||||
|
||||
ElfW(Ehdr) header;
|
||||
auto buffer = UserOrKernelBuffer::for_kernel_buffer((u8*)&header);
|
||||
|
@ -310,7 +310,7 @@ ErrorOr<FlatPtr> Process::sys$mprotect(Userspace<void*> 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<FlatPtr> Process::sys$mremap(Userspace<const Syscall::SC_mremap_params*>
|
|||
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<FlatPtr> Process::sys$allocate_tls(Userspace<const char*> 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;
|
||||
|
|
|
@ -59,7 +59,7 @@ ErrorOr<FlatPtr> Process::sys$poll(Userspace<const Syscall::SC_poll_params*> 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)
|
||||
|
|
|
@ -170,7 +170,7 @@ ErrorOr<FlatPtr> Process::sys$ptrace(Userspace<const Syscall::SC_ptrace_params*>
|
|||
*/
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ ErrorOr<FlatPtr> Process::sys$sigprocmask(int how, Userspace<const sigset_t*> 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<void> 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);
|
||||
|
|
|
@ -58,7 +58,7 @@ ErrorOr<FlatPtr> 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;
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ void Process::sys$exit_thread(Userspace<void*> exit_value, Userspace<void*> 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<FlatPtr> Process::sys$join_thread(pid_t tid, Userspace<void**> 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;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ ErrorOr<FlatPtr> Process::sys$ttyname(int fd, Userspace<char*> 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<FlatPtr> Process::sys$ptsname(int fd, Userspace<char*> 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));
|
||||
|
|
Loading…
Reference in a new issue