mirror of
https://github.com/RGBCube/serenity
synced 2025-05-17 03:45:07 +00:00
Add a PTY multiplexer (/dev/ptmx) device.
When you open /dev/ptmx, you get a file descriptor pointing to one of the available MasterPTY's. If none are available, you get an EBUSY. This makes it possible to open multiple (up to 4) Terminals. :^) To support this, I also added a CharacterDevice::open() that gets control when VFS is opening a CharacterDevice. This is useful when we want to return a custom FileDescriptor like we do here.
This commit is contained in:
parent
b46ae2bf09
commit
9dd29f9aa9
13 changed files with 75 additions and 37 deletions
|
@ -128,11 +128,12 @@ void VFS::traverse_directory_inode(Inode& dir_inode, Function<bool(const FS::Dir
|
|||
});
|
||||
}
|
||||
|
||||
RetainPtr<FileDescriptor> VFS::open(CharacterDevice& device, int options)
|
||||
RetainPtr<FileDescriptor> VFS::open(RetainPtr<CharacterDevice>&& device, int& error, int options)
|
||||
{
|
||||
// FIXME: Respect options.
|
||||
(void) options;
|
||||
return FileDescriptor::create(device);
|
||||
(void) error;
|
||||
return FileDescriptor::create(move(device));
|
||||
}
|
||||
|
||||
RetainPtr<FileDescriptor> VFS::open(const String& path, int& error, int options, InodeIdentifier base)
|
||||
|
@ -148,7 +149,7 @@ RetainPtr<FileDescriptor> VFS::open(const String& path, int& error, int options,
|
|||
kprintf("VFS::open: no such character device %u,%u\n", metadata.majorDevice, metadata.minorDevice);
|
||||
return nullptr;
|
||||
}
|
||||
return FileDescriptor::create((*it).value);
|
||||
return (*it).value->open(error, options);
|
||||
}
|
||||
return FileDescriptor::create(move(inode));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue