mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 01:20:25 +00:00
Everywhere: Replace a bundle of dbg with dbgln.
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.Everything:
This commit is contained in:
parent
872f2a3b90
commit
dca6f1f49b
Notes:
sideshowbarker
2024-07-18 23:56:44 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/dca6f1f49b3 Pull-request: https://github.com/SerenityOS/serenity/pull/4887
9 changed files with 53 additions and 38 deletions
|
@ -268,7 +268,7 @@ KResult Inode::prepare_to_write_data()
|
|||
return KResult(-EROFS);
|
||||
auto metadata = this->metadata();
|
||||
if (metadata.is_setuid() || metadata.is_setgid()) {
|
||||
dbg() << "Inode::prepare_to_write_data(): Stripping SUID/SGID bits from " << identifier();
|
||||
dbgln("Inode::prepare_to_write_data(): Stripping SUID/SGID bits from {}", identifier());
|
||||
return chmod(metadata.mode & ~(04000 | 02000));
|
||||
}
|
||||
return KSuccess;
|
||||
|
|
|
@ -76,3 +76,11 @@ inline const LogStream& operator<<(const LogStream& stream, const InodeIdentifie
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
template<>
|
||||
struct AK::Formatter<Kernel::InodeIdentifier> : AK::Formatter<FormatString> {
|
||||
void format(FormatBuilder& builder, Kernel::InodeIdentifier value)
|
||||
{
|
||||
return AK::Formatter<FormatString>::format(builder, "{}:{}", value.fsid(), value.index());
|
||||
}
|
||||
};
|
||||
|
|
|
@ -229,7 +229,7 @@ bool Plan9FS::initialize()
|
|||
u32 msize;
|
||||
StringView remote_protocol_version;
|
||||
version_message >> msize >> remote_protocol_version;
|
||||
dbg() << "Remote supports msize=" << msize << " and protocol version " << remote_protocol_version;
|
||||
dbgln("Remote supports msize={} and protocol version {}", msize, remote_protocol_version);
|
||||
m_remote_protocol_version = parse_protocol_version(remote_protocol_version);
|
||||
m_max_message_size = min(m_max_message_size, (size_t)msize);
|
||||
|
||||
|
@ -602,7 +602,7 @@ KResult Plan9FS::read_and_dispatch_one_message()
|
|||
m_completions.remove(header.tag);
|
||||
m_completion_blocker.unblock_completed(header.tag);
|
||||
} else {
|
||||
dbg() << "Received a 9p message of type " << header.type << " with an unexpected tag " << header.tag << ", dropping";
|
||||
dbgln("Received a 9p message of type {} with an unexpected tag {}, dropping", header.type, header.tag);
|
||||
}
|
||||
|
||||
return KSuccess;
|
||||
|
@ -625,7 +625,7 @@ KResult Plan9FS::post_message_and_wait_for_a_reply(Message& message)
|
|||
return KResult(-EINTR);
|
||||
|
||||
if (completion->result.is_error()) {
|
||||
dbg() << "Plan9FS: Message was aborted with error " << completion->result;
|
||||
dbgln("Plan9FS: Message was aborted with error {}", completion->result.error());
|
||||
return KResult(-EIO);
|
||||
}
|
||||
|
||||
|
@ -642,13 +642,12 @@ KResult Plan9FS::post_message_and_wait_for_a_reply(Message& message)
|
|||
// numerical errno in an unspecified encoding; we ignore those too.
|
||||
StringView error_name;
|
||||
message >> error_name;
|
||||
dbg() << "Plan9FS: Received error name " << error_name;
|
||||
dbgln("Plan9FS: Received error name {}", error_name);
|
||||
return KResult(-EIO);
|
||||
} else if ((u8)reply_type != (u8)request_type + 1) {
|
||||
// Other than those error messages. we only expect the matching reply
|
||||
// message type.
|
||||
dbg() << "Plan9FS: Received unexpected message type " << (u8)reply_type
|
||||
<< " in response to " << (u8)request_type;
|
||||
dbgln("Plan9FS: Received unexpected message type {} in response to {}", (u8)reply_type, (u8)request_type);
|
||||
return KResult(-EIO);
|
||||
} else {
|
||||
return KSuccess;
|
||||
|
|
|
@ -1185,7 +1185,7 @@ void ProcFSInode::did_seek(FileDescription& description, off_t new_offset)
|
|||
auto result = refresh_data(description);
|
||||
if (result.is_error()) {
|
||||
// Subsequent calls to read will return EIO!
|
||||
dbg() << "ProcFS: Could not refresh contents: " << result.error();
|
||||
dbgln("ProcFS: Could not refresh contents: {}", result.error());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,7 +77,11 @@ KResult VFS::mount(FS& file_system, Custody& mount_point, int flags)
|
|||
LOCKER(m_lock);
|
||||
|
||||
auto& inode = mount_point.inode();
|
||||
dbg() << "VFS: Mounting " << file_system.class_name() << " at " << mount_point.absolute_path() << " (inode: " << inode.identifier() << ") with flags " << flags;
|
||||
dbgln("VFS: Mounting {} at {} (inode: {}) with flags {}",
|
||||
file_system.class_name(),
|
||||
mount_point.absolute_path(),
|
||||
inode.identifier(),
|
||||
flags);
|
||||
// FIXME: check that this is not already a mount point
|
||||
Mount mount { file_system, &mount_point, flags };
|
||||
m_mounts.append(move(mount));
|
||||
|
@ -88,7 +92,7 @@ KResult VFS::bind_mount(Custody& source, Custody& mount_point, int flags)
|
|||
{
|
||||
LOCKER(m_lock);
|
||||
|
||||
dbg() << "VFS: Bind-mounting " << source.absolute_path() << " at " << mount_point.absolute_path();
|
||||
dbgln("VFS: Bind-mounting {} at {}", source.absolute_path(), mount_point.absolute_path());
|
||||
// FIXME: check that this is not already a mount point
|
||||
Mount mount { source.inode(), mount_point, flags };
|
||||
m_mounts.append(move(mount));
|
||||
|
@ -99,7 +103,7 @@ KResult VFS::remount(Custody& mount_point, int new_flags)
|
|||
{
|
||||
LOCKER(m_lock);
|
||||
|
||||
dbg() << "VFS: Remounting " << mount_point.absolute_path();
|
||||
dbgln("VFS: Remounting {}", mount_point.absolute_path());
|
||||
|
||||
Mount* mount = find_mount_for_guest(mount_point.inode());
|
||||
if (!mount)
|
||||
|
@ -112,7 +116,7 @@ KResult VFS::remount(Custody& mount_point, int new_flags)
|
|||
KResult VFS::unmount(Inode& guest_inode)
|
||||
{
|
||||
LOCKER(m_lock);
|
||||
dbg() << "VFS: unmount called with inode " << guest_inode.identifier();
|
||||
dbgln("VFS: unmount called with inode {}", guest_inode.identifier());
|
||||
|
||||
for (size_t i = 0; i < m_mounts.size(); ++i) {
|
||||
auto& mount = m_mounts.at(i);
|
||||
|
@ -122,7 +126,7 @@ KResult VFS::unmount(Inode& guest_inode)
|
|||
dbgln("VFS: Failed to unmount!");
|
||||
return result;
|
||||
}
|
||||
dbg() << "VFS: found fs " << mount.guest_fs().fsid() << " at mount index " << i << "! Unmounting...";
|
||||
dbgln("VFS: found fs {} at mount index {}! Unmounting...", mount.guest_fs().fsid(), i);
|
||||
m_mounts.unstable_take(i);
|
||||
return KSuccess;
|
||||
}
|
||||
|
@ -374,7 +378,7 @@ KResult VFS::mknod(StringView path, mode_t mode, dev_t dev, Custody& base)
|
|||
return KResult(-EROFS);
|
||||
|
||||
LexicalPath p(path);
|
||||
dbg() << "VFS::mknod: '" << p.basename() << "' mode=" << mode << " dev=" << dev << " in " << parent_inode.identifier();
|
||||
dbgln("VFS::mknod: '{}' mode={} dev={} in {}", p.basename(), mode, dev, parent_inode.identifier());
|
||||
return parent_inode.create_child(p.basename(), mode, dev, current_process->uid(), current_process->gid()).result();
|
||||
}
|
||||
|
||||
|
@ -609,10 +613,10 @@ KResult VFS::chown(Custody& custody, uid_t a_uid, gid_t a_gid)
|
|||
if (custody.is_readonly())
|
||||
return KResult(-EROFS);
|
||||
|
||||
dbg() << "VFS::chown(): inode " << inode.identifier() << " <- uid:" << new_uid << " gid:" << new_gid;
|
||||
dbgln("VFS::chown(): inode {} <- uid={} gid={}", inode.identifier(), new_uid, new_gid);
|
||||
|
||||
if (metadata.is_setuid() || metadata.is_setgid()) {
|
||||
dbg() << "VFS::chown(): Stripping SUID/SGID bits from " << inode.identifier();
|
||||
dbgln("VFS::chown(): Stripping SUID/SGID bits from {}", inode.identifier());
|
||||
auto result = inode.chmod(metadata.mode & ~(04000 | 02000));
|
||||
if (result.is_error())
|
||||
return result;
|
||||
|
@ -718,7 +722,7 @@ KResult VFS::symlink(StringView target, StringView linkpath, Custody& base)
|
|||
return KResult(-EROFS);
|
||||
|
||||
LexicalPath p(linkpath);
|
||||
dbg() << "VFS::symlink: '" << p.basename() << "' (-> '" << target << "') in " << parent_inode.identifier();
|
||||
dbgln("VFS::symlink: '{}' (-> '{}') in {}", p.basename(), target, parent_inode.identifier());
|
||||
auto inode_or_error = parent_inode.create_child(p.basename(), S_IFLNK | 0644, 0, current_process->uid(), current_process->gid());
|
||||
if (inode_or_error.is_error())
|
||||
return inode_or_error.error();
|
||||
|
@ -862,21 +866,21 @@ KResult VFS::validate_path_against_process_veil(StringView path, int options)
|
|||
|
||||
auto* unveiled_path = find_matching_unveiled_path(path);
|
||||
if (!unveiled_path) {
|
||||
dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled.";
|
||||
dbgln("Rejecting path '{}' since it hasn't been unveiled.", path);
|
||||
dump_backtrace();
|
||||
return KResult(-ENOENT);
|
||||
}
|
||||
|
||||
if (options & O_CREAT) {
|
||||
if (!(unveiled_path->permissions() & UnveilAccess::CreateOrRemove)) {
|
||||
dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled with 'c' permission.";
|
||||
dbgln("Rejecting path '{}' since it hasn't been unveiled with 'c' permission.", path);
|
||||
dump_backtrace();
|
||||
return KResult(-EACCES);
|
||||
}
|
||||
}
|
||||
if (options & O_UNLINK_INTERNAL) {
|
||||
if (!(unveiled_path->permissions() & UnveilAccess::CreateOrRemove)) {
|
||||
dbg() << "Rejecting path '" << path << "' for unlink since it hasn't been unveiled with 'c' permission.";
|
||||
dbgln("Rejecting path '{}' for unlink since it hasn't been unveiled with 'c' permission.", path);
|
||||
dump_backtrace();
|
||||
return KResult(-EACCES);
|
||||
}
|
||||
|
@ -885,13 +889,13 @@ KResult VFS::validate_path_against_process_veil(StringView path, int options)
|
|||
if (options & O_RDONLY) {
|
||||
if (options & O_DIRECTORY) {
|
||||
if (!(unveiled_path->permissions() & (UnveilAccess::Read | UnveilAccess::Browse))) {
|
||||
dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled with 'r' or 'b' permissions.";
|
||||
dbgln("Rejecting path '{}' since it hasn't been unveiled with 'r' or 'b' permissions.", path);
|
||||
dump_backtrace();
|
||||
return KResult(-EACCES);
|
||||
}
|
||||
} else {
|
||||
if (!(unveiled_path->permissions() & UnveilAccess::Read)) {
|
||||
dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled with 'r' permission.";
|
||||
dbgln("Rejecting path '{}' since it hasn't been unveiled with 'r' permission.", path);
|
||||
dump_backtrace();
|
||||
return KResult(-EACCES);
|
||||
}
|
||||
|
@ -899,14 +903,14 @@ KResult VFS::validate_path_against_process_veil(StringView path, int options)
|
|||
}
|
||||
if (options & O_WRONLY) {
|
||||
if (!(unveiled_path->permissions() & UnveilAccess::Write)) {
|
||||
dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled with 'w' permission.";
|
||||
dbgln("Rejecting path '{}' since it hasn't been unveiled with 'w' permission.", path);
|
||||
dump_backtrace();
|
||||
return KResult(-EACCES);
|
||||
}
|
||||
}
|
||||
if (options & O_EXEC) {
|
||||
if (!(unveiled_path->permissions() & UnveilAccess::Execute)) {
|
||||
dbg() << "Rejecting path '" << path << "' since it hasn't been unveiled with 'x' permission.";
|
||||
dbgln("Rejecting path '{}' since it hasn't been unveiled with 'x' permission.", path);
|
||||
dump_backtrace();
|
||||
return KResult(-EACCES);
|
||||
}
|
||||
|
|
|
@ -242,7 +242,7 @@ void* kmalloc_impl(size_t size)
|
|||
++g_kmalloc_call_count;
|
||||
|
||||
if (g_dump_kmalloc_stacks && Kernel::g_kernel_symbols_available) {
|
||||
dbg() << "kmalloc(" << size << ")";
|
||||
dbgln("kmalloc({})", size);
|
||||
Kernel::dump_backtrace();
|
||||
}
|
||||
|
||||
|
|
|
@ -152,9 +152,9 @@ void InterruptManagement::switch_to_pic_mode()
|
|||
ASSERT(irq_controller);
|
||||
if (irq_controller->type() == IRQControllerType::i82093AA) {
|
||||
irq_controller->hard_disable();
|
||||
dbg() << "Interrupts: Detected " << irq_controller->model() << " - Disabled";
|
||||
dbgln("Interrupts: Detected {} - Disabled", irq_controller->model());
|
||||
} else {
|
||||
dbg() << "Interrupts: Detected " << irq_controller->model();
|
||||
dbgln("Interrupts: Detected {}", irq_controller->model());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ void InterruptManagement::switch_to_ioapic_mode()
|
|||
return;
|
||||
}
|
||||
|
||||
dbg() << "Interrupts: MADT @ P " << m_madt.as_ptr();
|
||||
dbgln("Interrupts: MADT @ P {}", m_madt.as_ptr());
|
||||
locate_apic_data();
|
||||
m_smp_enabled = true;
|
||||
if (m_interrupt_controllers.size() == 1) {
|
||||
|
@ -183,9 +183,9 @@ void InterruptManagement::switch_to_ioapic_mode()
|
|||
ASSERT(irq_controller);
|
||||
if (irq_controller->type() == IRQControllerType::i8259) {
|
||||
irq_controller->hard_disable();
|
||||
dbg() << "Interrupts: Detected " << irq_controller->model() << " Disabled";
|
||||
dbgln("Interrupts: Detected {} - Disabled", irq_controller->model());
|
||||
} else {
|
||||
dbg() << "Interrupts: Detected " << irq_controller->model();
|
||||
dbgln("Interrupts: Detected {}", irq_controller->model());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ void InterruptManagement::locate_apic_data()
|
|||
size_t entry_length = madt_entry->length;
|
||||
if (madt_entry->type == (u8)ACPI::Structures::MADTEntryType::IOAPIC) {
|
||||
auto* ioapic_entry = (const ACPI::Structures::MADTEntries::IOAPIC*)madt_entry;
|
||||
dbg() << "IOAPIC found @ MADT entry " << entry_index << ", MMIO Registers @ " << PhysicalAddress(ioapic_entry->ioapic_address);
|
||||
dbgln("IOAPIC found @ MADT entry {}, MMIO Registers @ {}", entry_index, PhysicalAddress(ioapic_entry->ioapic_address));
|
||||
m_interrupt_controllers.resize(1 + irq_controller_count);
|
||||
m_interrupt_controllers[irq_controller_count] = adopt(*new IOAPIC(PhysicalAddress(ioapic_entry->ioapic_address), ioapic_entry->gsi_base));
|
||||
irq_controller_count++;
|
||||
|
@ -225,7 +225,11 @@ void InterruptManagement::locate_apic_data()
|
|||
interrupt_override_entry->source,
|
||||
interrupt_override_entry->global_system_interrupt,
|
||||
interrupt_override_entry->flags);
|
||||
dbg() << "Interrupts: Overriding INT 0x" << String::format("%x", interrupt_override_entry->source) << " with GSI " << interrupt_override_entry->global_system_interrupt << ", for bus 0x" << String::format("%x", interrupt_override_entry->bus);
|
||||
|
||||
dbgln("Interrupts: Overriding INT {:#x} with GSI {}, for bus {:#x}",
|
||||
interrupt_override_entry->source,
|
||||
interrupt_override_entry->global_system_interrupt,
|
||||
interrupt_override_entry->bus);
|
||||
}
|
||||
madt_entry = (ACPI::Structures::MADTEntryHeader*)(VirtualAddress(madt_entry).offset(entry_length).get());
|
||||
entries_length -= entry_length;
|
||||
|
|
|
@ -34,13 +34,13 @@ UnhandledInterruptHandler::UnhandledInterruptHandler(u8 interrupt_vector)
|
|||
|
||||
void UnhandledInterruptHandler::handle_interrupt(const RegisterState&)
|
||||
{
|
||||
dbg() << "Interrupt: Unhandled vector " << interrupt_number() << " was invoked for handle_interrupt(RegisterState&).";
|
||||
dbgln("Interrupt: Unhandled vector {} was invoked for handle_interrupt(RegisterState&).", interrupt_number());
|
||||
Processor::halt();
|
||||
}
|
||||
|
||||
[[noreturn]] bool UnhandledInterruptHandler::eoi()
|
||||
{
|
||||
dbg() << "Interrupt: Unhandled vector " << interrupt_number() << " was invoked for eoi().";
|
||||
dbgln("Interrupt: Unhandled vector {} was invoked for eoi().", interrupt_number());
|
||||
Processor::halt();
|
||||
}
|
||||
|
||||
|
|
|
@ -114,7 +114,7 @@ KResult IPv4Socket::bind(Userspace<const sockaddr*> user_address, socklen_t addr
|
|||
auto requested_local_port = ntohs(address.sin_port);
|
||||
if (!Process::current()->is_superuser()) {
|
||||
if (requested_local_port < 1024) {
|
||||
dbg() << "UID " << Process::current()->uid() << " attempted to bind " << class_name() << " to port " << requested_local_port;
|
||||
dbgln("UID {} attempted to bind {} to port {}", Process::current()->uid(), class_name(), requested_local_port);
|
||||
return KResult(-EACCES);
|
||||
}
|
||||
}
|
||||
|
@ -300,7 +300,7 @@ KResultOr<size_t> IPv4Socket::receive_packet_buffered(FileDescription& descripti
|
|||
}
|
||||
if (!packet.data.has_value()) {
|
||||
if (protocol_is_disconnected()) {
|
||||
dbg() << "IPv4Socket{" << this << "} is protocol-disconnected, returning 0 in recvfrom!";
|
||||
dbgln("IPv4Socket({}) is protocol-disconnected, returning 0 in recvfrom!", this);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -394,7 +394,7 @@ bool IPv4Socket::did_receive(const IPv4Address& source_address, u16 source_port,
|
|||
if (buffer_mode() == BufferMode::Bytes) {
|
||||
size_t space_in_receive_buffer = m_receive_buffer.space_for_writing();
|
||||
if (packet_size > space_in_receive_buffer) {
|
||||
dbg() << "IPv4Socket(" << this << "): did_receive refusing packet since buffer is full.";
|
||||
dbgln("IPv4Socket({}): did_receive refusing packet since buffer is full.", this);
|
||||
ASSERT(m_can_read);
|
||||
return false;
|
||||
}
|
||||
|
@ -408,7 +408,7 @@ bool IPv4Socket::did_receive(const IPv4Address& source_address, u16 source_port,
|
|||
set_can_read(!m_receive_buffer.is_empty());
|
||||
} else {
|
||||
if (m_receive_queue.size() > 2000) {
|
||||
dbg() << "IPv4Socket(" << this << "): did_receive refusing packet since queue is full.";
|
||||
dbgln("IPv4Socket({}): did_receive refusing packet since queue is full.", this);
|
||||
return false;
|
||||
}
|
||||
m_receive_queue.append({ source_address, source_port, packet_timestamp, move(packet) });
|
||||
|
|
Loading…
Reference in a new issue