summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-12-09 21:03:39 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-12-09 21:03:39 +0100
commite9dda8d59261d021d046074f39bc2c0a140a723a (patch)
tree06007eabddb48417a93183b15b8281e6ee95c2ce
parentbe459acaea138102f97d25c355b12025836ab003 (diff)
downloadserenity-e9dda8d59261d021d046074f39bc2c0a140a723a.zip
Kernel: Give PTY's *actually* unique major ID's
Okay, one "dunce hat" point for me. The new PTY majors conflicted with PATAChannel. Now they are 200 for master and 201 for slave, not used by anything else.. I hope!
-rw-r--r--Kernel/Devices/Device.cpp4
-rw-r--r--Kernel/FileSystem/DevPtsFS.cpp2
-rw-r--r--Kernel/TTY/MasterPTY.cpp2
-rw-r--r--Kernel/TTY/SlavePTY.cpp2
4 files changed, 7 insertions, 3 deletions
diff --git a/Kernel/Devices/Device.cpp b/Kernel/Devices/Device.cpp
index 94f02331b7..ed83cfa2ea 100644
--- a/Kernel/Devices/Device.cpp
+++ b/Kernel/Devices/Device.cpp
@@ -30,6 +30,10 @@ Device::Device(unsigned major, unsigned minor)
, m_minor(minor)
{
u32 device_id = encoded_device(major, minor);
+ auto it = all_devices().find(device_id);
+ if (it != all_devices().end()) {
+ dbg() << "Already registered " << major << "," << minor << ": " << it->value->class_name();
+ }
ASSERT(!all_devices().contains(device_id));
all_devices().set(device_id, this);
}
diff --git a/Kernel/FileSystem/DevPtsFS.cpp b/Kernel/FileSystem/DevPtsFS.cpp
index 73d2113e51..02bce17d14 100644
--- a/Kernel/FileSystem/DevPtsFS.cpp
+++ b/Kernel/FileSystem/DevPtsFS.cpp
@@ -69,7 +69,7 @@ RefPtr<Inode> DevPtsFS::get_inode(InodeIdentifier inode_id) const
return m_root_inode;
unsigned pty_index = inode_index_to_pty_index(inode_id.index());
- auto* device = Device::get_device(11, pty_index);
+ auto* device = Device::get_device(201, pty_index);
ASSERT(device);
auto inode = adopt(*new DevPtsFSInode(const_cast<DevPtsFS&>(*this), inode_id.index()));
diff --git a/Kernel/TTY/MasterPTY.cpp b/Kernel/TTY/MasterPTY.cpp
index 04a8fc47de..a7715a1678 100644
--- a/Kernel/TTY/MasterPTY.cpp
+++ b/Kernel/TTY/MasterPTY.cpp
@@ -9,7 +9,7 @@
//#define MASTERPTY_DEBUG
MasterPTY::MasterPTY(unsigned index)
- : CharacterDevice(100, index)
+ : CharacterDevice(200, index)
, m_slave(adopt(*new SlavePTY(*this, index)))
, m_index(index)
{
diff --git a/Kernel/TTY/SlavePTY.cpp b/Kernel/TTY/SlavePTY.cpp
index 0a5a389ae5..fb005b424f 100644
--- a/Kernel/TTY/SlavePTY.cpp
+++ b/Kernel/TTY/SlavePTY.cpp
@@ -6,7 +6,7 @@
//#define SLAVEPTY_DEBUG
SlavePTY::SlavePTY(MasterPTY& master, unsigned index)
- : TTY(101, index)
+ : TTY(201, index)
, m_master(master)
, m_index(index)
{