mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:27:44 +00:00
Kernel: Put a bunch of debug spam behind #ifdefs.
This commit is contained in:
parent
56f7b392c1
commit
44e1e7423f
5 changed files with 22 additions and 2 deletions
|
@ -6,6 +6,8 @@
|
||||||
#include <LibC/signal_numbers.h>
|
#include <LibC/signal_numbers.h>
|
||||||
#include <LibC/sys/ioctl_numbers.h>
|
#include <LibC/sys/ioctl_numbers.h>
|
||||||
|
|
||||||
|
//#define MASTERPTY_DEBUG
|
||||||
|
|
||||||
MasterPTY::MasterPTY(unsigned index)
|
MasterPTY::MasterPTY(unsigned index)
|
||||||
: CharacterDevice(10, index)
|
: CharacterDevice(10, index)
|
||||||
, m_slave(adopt(*new SlavePTY(*this, index)))
|
, m_slave(adopt(*new SlavePTY(*this, index)))
|
||||||
|
@ -17,7 +19,9 @@ MasterPTY::MasterPTY(unsigned index)
|
||||||
|
|
||||||
MasterPTY::~MasterPTY()
|
MasterPTY::~MasterPTY()
|
||||||
{
|
{
|
||||||
|
#ifdef MASTERPTY_DEBUG
|
||||||
dbgprintf("~MasterPTY(%u)\n", m_index);
|
dbgprintf("~MasterPTY(%u)\n", m_index);
|
||||||
|
#endif
|
||||||
PTYMultiplexer::the().notify_master_destroyed(Badge<MasterPTY>(), m_index);
|
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>)
|
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());
|
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 my MasterPTY::m_slave
|
||||||
// +1 retain for FileDescriptor::m_device
|
// +1 retain for FileDescriptor::m_device
|
||||||
if (m_slave->retain_count() == 2)
|
if (m_slave->retain_count() == 2)
|
||||||
|
|
|
@ -630,20 +630,24 @@ Retained<Region> Region::clone()
|
||||||
{
|
{
|
||||||
ASSERT(current);
|
ASSERT(current);
|
||||||
if (m_shared || (m_readable && !m_writable)) {
|
if (m_shared || (m_readable && !m_writable)) {
|
||||||
|
#ifdef MM_DEBUG
|
||||||
dbgprintf("%s<%u> Region::clone(): sharing %s (L%x)\n",
|
dbgprintf("%s<%u> Region::clone(): sharing %s (L%x)\n",
|
||||||
current->process().name().characters(),
|
current->process().name().characters(),
|
||||||
current->pid(),
|
current->pid(),
|
||||||
m_name.characters(),
|
m_name.characters(),
|
||||||
laddr().get());
|
laddr().get());
|
||||||
|
#endif
|
||||||
// Create a new region backed by the same VMObject.
|
// 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));
|
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",
|
dbgprintf("%s<%u> Region::clone(): cowing %s (L%x)\n",
|
||||||
current->process().name().characters(),
|
current->process().name().characters(),
|
||||||
current->pid(),
|
current->pid(),
|
||||||
m_name.characters(),
|
m_name.characters(),
|
||||||
laddr().get());
|
laddr().get());
|
||||||
|
#endif
|
||||||
// Set up a COW region. The parent (this) region becomes COW as well!
|
// Set up a COW region. The parent (this) region becomes COW as well!
|
||||||
for (size_t i = 0; i < page_count(); ++i)
|
for (size_t i = 0; i < page_count(); ++i)
|
||||||
m_cow_map.set(i, true);
|
m_cow_map.set(i, true);
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
#include <LibC/errno_numbers.h>
|
#include <LibC/errno_numbers.h>
|
||||||
|
|
||||||
|
//#define PTMX_DEBUG
|
||||||
|
|
||||||
static const unsigned s_max_pty_pairs = 8;
|
static const unsigned s_max_pty_pairs = 8;
|
||||||
static PTYMultiplexer* s_the;
|
static PTYMultiplexer* s_the;
|
||||||
|
|
||||||
|
@ -33,7 +35,9 @@ KResultOr<Retained<FileDescriptor>> PTYMultiplexer::open(int options)
|
||||||
return KResult(-EBUSY);
|
return KResult(-EBUSY);
|
||||||
auto master_index = m_freelist.take_last();
|
auto master_index = m_freelist.take_last();
|
||||||
auto master = adopt(*new MasterPTY(master_index));
|
auto master = adopt(*new MasterPTY(master_index));
|
||||||
|
#ifdef PTMX_DEBUG
|
||||||
dbgprintf("PTYMultiplexer::open: Vending master %u\n", master->index());
|
dbgprintf("PTYMultiplexer::open: Vending master %u\n", master->index());
|
||||||
|
#endif
|
||||||
return VFS::the().open(move(master), options);
|
return VFS::the().open(move(master), options);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,5 +45,7 @@ void PTYMultiplexer::notify_master_destroyed(Badge<MasterPTY>, unsigned index)
|
||||||
{
|
{
|
||||||
LOCKER(m_lock);
|
LOCKER(m_lock);
|
||||||
m_freelist.append(index);
|
m_freelist.append(index);
|
||||||
|
#ifdef PTMX_DEBUG
|
||||||
dbgprintf("PTYMultiplexer: %u added to freelist\n", index);
|
dbgprintf("PTYMultiplexer: %u added to freelist\n", index);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,8 @@
|
||||||
#include <Kernel/ARP.h>
|
#include <Kernel/ARP.h>
|
||||||
|
|
||||||
//#define DEBUG_IO
|
//#define DEBUG_IO
|
||||||
#define TASK_DEBUG
|
//#define TASK_DEBUG
|
||||||
#define FORK_DEBUG
|
//#define FORK_DEBUG
|
||||||
#define SIGNAL_DEBUG
|
#define SIGNAL_DEBUG
|
||||||
#define MAX_PROCESS_GIDS 32
|
#define MAX_PROCESS_GIDS 32
|
||||||
//#define SHARED_BUFFER_DEBUG
|
//#define SHARED_BUFFER_DEBUG
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
#include "DevPtsFS.h"
|
#include "DevPtsFS.h"
|
||||||
#include <Kernel/Process.h>
|
#include <Kernel/Process.h>
|
||||||
|
|
||||||
|
//#define SLAVEPTY_DEBUG
|
||||||
|
|
||||||
SlavePTY::SlavePTY(MasterPTY& master, unsigned index)
|
SlavePTY::SlavePTY(MasterPTY& master, unsigned index)
|
||||||
: TTY(11, index)
|
: TTY(11, index)
|
||||||
, m_master(master)
|
, m_master(master)
|
||||||
|
@ -16,7 +18,9 @@ SlavePTY::SlavePTY(MasterPTY& master, unsigned index)
|
||||||
|
|
||||||
SlavePTY::~SlavePTY()
|
SlavePTY::~SlavePTY()
|
||||||
{
|
{
|
||||||
|
#ifdef SLAVEPTY_DEBUG
|
||||||
dbgprintf("~SlavePTY(%u)\n", m_index);
|
dbgprintf("~SlavePTY(%u)\n", m_index);
|
||||||
|
#endif
|
||||||
DevPtsFS::the().unregister_slave_pty(*this);
|
DevPtsFS::the().unregister_slave_pty(*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue