1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:27:35 +00:00

Kernel: Put a bunch of debug spam behind #ifdefs.

This commit is contained in:
Andreas Kling 2019-03-27 15:07:12 +01:00
parent 56f7b392c1
commit 44e1e7423f
5 changed files with 22 additions and 2 deletions

View file

@ -6,6 +6,8 @@
#include <LibC/signal_numbers.h>
#include <LibC/sys/ioctl_numbers.h>
//#define MASTERPTY_DEBUG
MasterPTY::MasterPTY(unsigned index)
: CharacterDevice(10, index)
, m_slave(adopt(*new SlavePTY(*this, index)))
@ -17,7 +19,9 @@ MasterPTY::MasterPTY(unsigned index)
MasterPTY::~MasterPTY()
{
#ifdef MASTERPTY_DEBUG
dbgprintf("~MasterPTY(%u)\n", m_index);
#endif
PTYMultiplexer::the().notify_master_destroyed(Badge<MasterPTY>(), m_index);
}
@ -55,7 +59,9 @@ bool MasterPTY::can_write(Process&) const
void MasterPTY::notify_slave_closed(Badge<SlavePTY>)
{
#ifdef MASTERPTY_DEBUG
dbgprintf("MasterPTY(%u): slave closed, my retains: %u, slave retains: %u\n", m_index, retain_count(), m_slave->retain_count());
#endif
// +1 retain for my MasterPTY::m_slave
// +1 retain for FileDescriptor::m_device
if (m_slave->retain_count() == 2)

View file

@ -630,20 +630,24 @@ Retained<Region> Region::clone()
{
ASSERT(current);
if (m_shared || (m_readable && !m_writable)) {
#ifdef MM_DEBUG
dbgprintf("%s<%u> Region::clone(): sharing %s (L%x)\n",
current->process().name().characters(),
current->pid(),
m_name.characters(),
laddr().get());
#endif
// Create a new region backed by the same VMObject.
return adopt(*new Region(laddr(), size(), m_vmo.copy_ref(), m_offset_in_vmo, String(m_name), m_readable, m_writable));
}
#ifdef MM_DEBUG
dbgprintf("%s<%u> Region::clone(): cowing %s (L%x)\n",
current->process().name().characters(),
current->pid(),
m_name.characters(),
laddr().get());
#endif
// Set up a COW region. The parent (this) region becomes COW as well!
for (size_t i = 0; i < page_count(); ++i)
m_cow_map.set(i, true);

View file

@ -3,6 +3,8 @@
#include <Kernel/Process.h>
#include <LibC/errno_numbers.h>
//#define PTMX_DEBUG
static const unsigned s_max_pty_pairs = 8;
static PTYMultiplexer* s_the;
@ -33,7 +35,9 @@ KResultOr<Retained<FileDescriptor>> PTYMultiplexer::open(int options)
return KResult(-EBUSY);
auto master_index = m_freelist.take_last();
auto master = adopt(*new MasterPTY(master_index));
#ifdef PTMX_DEBUG
dbgprintf("PTYMultiplexer::open: Vending master %u\n", master->index());
#endif
return VFS::the().open(move(master), options);
}
@ -41,5 +45,7 @@ void PTYMultiplexer::notify_master_destroyed(Badge<MasterPTY>, unsigned index)
{
LOCKER(m_lock);
m_freelist.append(index);
#ifdef PTMX_DEBUG
dbgprintf("PTYMultiplexer: %u added to freelist\n", index);
#endif
}

View file

@ -27,8 +27,8 @@
#include <Kernel/ARP.h>
//#define DEBUG_IO
#define TASK_DEBUG
#define FORK_DEBUG
//#define TASK_DEBUG
//#define FORK_DEBUG
#define SIGNAL_DEBUG
#define MAX_PROCESS_GIDS 32
//#define SHARED_BUFFER_DEBUG

View file

@ -3,6 +3,8 @@
#include "DevPtsFS.h"
#include <Kernel/Process.h>
//#define SLAVEPTY_DEBUG
SlavePTY::SlavePTY(MasterPTY& master, unsigned index)
: TTY(11, index)
, m_master(master)
@ -16,7 +18,9 @@ SlavePTY::SlavePTY(MasterPTY& master, unsigned index)
SlavePTY::~SlavePTY()
{
#ifdef SLAVEPTY_DEBUG
dbgprintf("~SlavePTY(%u)\n", m_index);
#endif
DevPtsFS::the().unregister_slave_pty(*this);
}