1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:27:43 +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.
This commit is contained in:
asynts 2021-01-15 00:18:55 +01:00 committed by Andreas Kling
parent a348ab55b0
commit 7b0a1a98d9
12 changed files with 81 additions and 71 deletions

View file

@ -27,13 +27,12 @@
#include "MasterPTY.h"
#include "PTYMultiplexer.h"
#include "SlavePTY.h"
#include <AK/Debug.h>
#include <Kernel/Process.h>
#include <LibC/errno_numbers.h>
#include <LibC/signal_numbers.h>
#include <LibC/sys/ioctl_numbers.h>
//#define MASTERPTY_DEBUG
namespace Kernel {
MasterPTY::MasterPTY(unsigned index)
@ -54,9 +53,7 @@ MasterPTY::MasterPTY(unsigned index)
MasterPTY::~MasterPTY()
{
#ifdef MASTERPTY_DEBUG
dbg() << "~MasterPTY(" << m_index << ")";
#endif
dbgln<debug_masterpty>("~MasterPTY({})", m_index);
PTYMultiplexer::the().notify_master_destroyed({}, m_index);
}
@ -94,9 +91,7 @@ bool MasterPTY::can_write(const FileDescription&, size_t) const
void MasterPTY::notify_slave_closed(Badge<SlavePTY>)
{
#ifdef MASTERPTY_DEBUG
dbg() << "MasterPTY(" << m_index << "): slave closed, my retains: " << ref_count() << ", slave retains: " << m_slave->ref_count();
#endif
dbgln<debug_masterpty>("MasterPTY({}): slave closed, my retains: {}, slave retains: {}", m_index, ref_count(), m_slave->ref_count());
// +1 ref for my MasterPTY::m_slave
// +1 ref for FileDescription::m_device
if (m_slave->ref_count() == 2)

View file

@ -26,13 +26,12 @@
#include "PTYMultiplexer.h"
#include "MasterPTY.h"
#include <AK/Debug.h>
#include <AK/Singleton.h>
#include <Kernel/FileSystem/FileDescription.h>
#include <Kernel/Process.h>
#include <LibC/errno_numbers.h>
//#define PTMX_DEBUG
namespace Kernel {
static const unsigned s_max_pty_pairs = 8;
@ -62,9 +61,7 @@ KResultOr<NonnullRefPtr<FileDescription>> PTYMultiplexer::open(int options)
return EBUSY;
auto master_index = m_freelist.take_last();
auto master = adopt(*new MasterPTY(master_index));
#ifdef PTMX_DEBUG
dbg() << "PTYMultiplexer::open: Vending master " << master->index();
#endif
dbgln<debug_ptmx>("PTYMultiplexer::open: Vending master {}", master->index());
auto description = FileDescription::create(move(master));
if (!description.is_error()) {
description.value()->set_rw_mode(options);
@ -77,9 +74,7 @@ void PTYMultiplexer::notify_master_destroyed(Badge<MasterPTY>, unsigned index)
{
LOCKER(m_lock);
m_freelist.append(index);
#ifdef PTMX_DEBUG
dbg() << "PTYMultiplexer: " << index << " added to freelist";
#endif
dbgln<debug_ptmx>("PTYMultiplexer: {} added to freelist", index);
}
}

View file

@ -26,11 +26,10 @@
#include "SlavePTY.h"
#include "MasterPTY.h"
#include <AK/Debug.h>
#include <Kernel/FileSystem/DevPtsFS.h>
#include <Kernel/Process.h>
//#define SLAVEPTY_DEBUG
namespace Kernel {
SlavePTY::SlavePTY(MasterPTY& master, unsigned index)
@ -48,9 +47,7 @@ SlavePTY::SlavePTY(MasterPTY& master, unsigned index)
SlavePTY::~SlavePTY()
{
#ifdef SLAVEPTY_DEBUG
dbg() << "~SlavePTY(" << m_index << ")";
#endif
dbgln<debug_slavepty>("~SlavePTY({})", m_index);
DevPtsFS::unregister_slave_pty(*this);
}