summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-27 15:07:12 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-27 15:07:12 +0100
commit44e1e7423f0a5e7344ea5b8fdb70051f971fedc0 (patch)
tree93d4009dc0475a16350efae6b8d429e6a3f190d9
parent56f7b392c1868df085a39310148daa85a67e5e53 (diff)
downloadserenity-44e1e7423f0a5e7344ea5b8fdb70051f971fedc0.zip
Kernel: Put a bunch of debug spam behind #ifdefs.
-rw-r--r--Kernel/MasterPTY.cpp6
-rw-r--r--Kernel/MemoryManager.cpp4
-rw-r--r--Kernel/PTYMultiplexer.cpp6
-rw-r--r--Kernel/Process.cpp4
-rw-r--r--Kernel/SlavePTY.cpp4
5 files changed, 22 insertions, 2 deletions
diff --git a/Kernel/MasterPTY.cpp b/Kernel/MasterPTY.cpp
index b727830612..9c643183fb 100644
--- a/Kernel/MasterPTY.cpp
+++ b/Kernel/MasterPTY.cpp
@@ -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)
diff --git a/Kernel/MemoryManager.cpp b/Kernel/MemoryManager.cpp
index e5720473e7..e348f5561d 100644
--- a/Kernel/MemoryManager.cpp
+++ b/Kernel/MemoryManager.cpp
@@ -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);
diff --git a/Kernel/PTYMultiplexer.cpp b/Kernel/PTYMultiplexer.cpp
index 3fcaa7b130..35852474df 100644
--- a/Kernel/PTYMultiplexer.cpp
+++ b/Kernel/PTYMultiplexer.cpp
@@ -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
}
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 21f219dda8..0179e84ae4 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -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
diff --git a/Kernel/SlavePTY.cpp b/Kernel/SlavePTY.cpp
index 93d2a0b652..980ac598e0 100644
--- a/Kernel/SlavePTY.cpp
+++ b/Kernel/SlavePTY.cpp
@@ -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);
}