summaryrefslogtreecommitdiff
path: root/Kernel/TTY
AgeCommit message (Collapse)Author
2021-10-06Kernel: Handle backspace for tab character in TTY cooked modePeter Elliott
Before, serenity would only backspace one character for a tab. This is the only feature that my OS has and serenity doesn't.
2021-10-03Kernel: Use `operator ""sv` in all class_name() implementationsBrian Gianforcaro
Previously there was a mix of returning plain strings and returning explicit string views using `operator ""sv`. This change switches them all to standardized on `operator ""sv` as it avoids a call to strlen.
2021-10-01Kernel: Remove IO.h include from a bunch of placesLiav A
2021-09-17Kernel/Devices: Use try_create_device helper for ConsoleDeviceLiav A
2021-09-17Kernel/Devices: Move ConsoleDevice into the Devices source directoryLiav A
2021-09-17Kernel: Introduce the DeviceManagement singletonLiav A
This singleton simplifies many aspects that we struggled with before: 1. There's no need to make derived classes of Device expose the constructor as public anymore. The singleton is a friend of them, so he can call the constructor. This solves the issue with try_create_device helper neatly, hopefully for good. 2. Getting a reference of the NullDevice is now being done from this singleton, which means that NullDevice no longer needs to use its own singleton, and we can apply the try_create_device helper on it too :) 3. We can now defer registration completely after the Device constructor which means the Device constructor is merely assigning the major and minor numbers of the Device, and the try_create_device helper ensures it calls the after_inserting method immediately after construction. This creates a great opportunity to make registration more OOM-safe.
2021-09-11Kernel/Devices: Defer creation of SysFS component after the constructorLiav A
Instead of doing so in the constructor, let's do immediately after the constructor, so we can safely pass a reference of a Device, so the SysFSDeviceComponent constructor can use that object to identify whether it's a block device or a character device. This allows to us to not hold a device in SysFSDeviceComponent with a RefPtr. Also, we also call the before_removing method in both SlavePTY::unref and File::unref, so because Device has that method being overrided, it can ensure the device is removed always cleanly.
2021-09-10AK+Everywhere: Reduce the number of template parameters of IntrusiveListAli Mohammad Pur
This makes the user-facing type only take the node member pointer, and lets the compiler figure out the other needed types from that.
2021-09-08Kernel/Devices: Remove required_mode and device_name methodsLiav A
These methods are no longer needed because SystemServer is able to populate the DevFS on its own. Device absolute_path no longer assume a path to the /dev location, because it really should not assume any path to a Device node. Because StorageManagement still needs to know the storage name, we declare a virtual method only for StorageDevices to override, but this technique should really be removed later on.
2021-09-07Kernel: Use KResultOr and TRY() for MasterPTYAndreas Kling
2021-09-07Kernel: Make DoubleBuffer::try() return KResultOrAndreas Kling
This tidies up error propagation in a number of places.
2021-09-07Kernel: Rename FileDescription => OpenFileDescriptionAndreas Kling
Dr. POSIX really calls these "open file description", not just "file description", so let's call them exactly that. :^)
2021-09-06Kernel: Make kernel region allocators return KResultOr<NOP<Region>>Andreas Kling
This expands the reach of error propagation greatly throughout the kernel. Sadly, it also exposes the fact that we're allocating (and doing other fallible things) in constructors all over the place. This patch doesn't attempt to address that of course. That's work for our future selves.
2021-09-06Kernel: Use TRY() in PTYMultiplexer::open()Andreas Kling
2021-09-05Kernel: Make all Spinlocks use u8 for storage, remove templateBrian Gianforcaro
The default template argument is only used in one place, and it looks like it was probably just an oversight. The rest of the Kernel code all uses u8 as the type. So lets make that the default and remove the unused template argument, as there doesn't seem to be a reason to allow the size to be customizable.
2021-09-05Kernel: Make copy_{from,to}_user() return KResult and use TRY()Andreas Kling
This makes EFAULT propagation flow much more naturally. :^)
2021-09-05Kernel: Declare type aliases with "using" instead of "typedef"Brian Gianforcaro
This is the idiomatic way to declare type aliases in modern C++. Flagged by Sonar Cloud as a "Code Smell", but I happen to agree with this particular one. :^)
2021-09-01Kernel: Convert UserOrKernelBuffer callbacks to use AK::BytesBrian Gianforcaro
2021-08-29Kernel: Rename FileDescription::create() => try_create()Andreas Kling
2021-08-23Kernel: Rename Thread::BlockCondition to BlockerSetAndreas Kling
This class represents a set of Thread::Blocker objects attached to something that those blockers are waiting on.
2021-08-22Kernel: Rename ScopedSpinlock => SpinlockLockerAndreas Kling
This matches MutexLocker, and doesn't sound like it's a lock itself.
2021-08-22Kernel: Rename SpinLock => SpinlockAndreas Kling
2021-08-22Kernel: Rename SpinLockProtectedValue<T> => SpinLockProtected<T>Andreas Kling
2021-08-22Kernel: Rename ProtectedValue<T> => MutexProtected<T>Andreas Kling
Let's make it obvious what we're protecting it with.
2021-08-19Kernel: Make Process::current() return a Process& instead of Process*Idan Horowitz
This has several benefits: 1) We no longer just blindly derefence a null pointer in various places 2) We will get nicer runtime error messages if the current process does turn out to be null in the call location 3) GCC no longer complains about possible nullptr dereferences when compiling without KUBSAN
2021-08-17Kernel: Convert SlavePTY all-instances HashTable to an IntrusiveListAndreas Kling
This simplifies the DevPtsFS implementation somewhat, as it no longer requires SlavePTY to register itself with it, since it can now simply use the list of SlavePTY instances.
2021-08-09Kernel: Fix logic typo in ConsoleManagement::is_initialized()Andreas Kling
Regressed in 2ff3c54153b66e71f2917afe525d64fe63305245.
2021-08-08Kernel: Remove unnecessary churn in ConsoleManagementAndreas Kling
The maximum number of virtual consoles is determined at compile time, so we can pre-allocate that many slots, dodging some heap allocations. Furthermore, virtual consoles are never destroyed, so it's fine to simply store a raw pointer to the currently active one.
2021-08-08Everywhere: Replace AK::Singleton => SingletonAndreas Kling
2021-08-07Kernel: Port PTYMultiplexer to ProtectedValueAndreas Kling
2021-08-07Kernel: Increase maximum PTY count from 8 to 64Andreas Kling
Let's allow users to allocate more pseudo-terminals if they want.
2021-08-07Kernel/TTY: Remove redundant SpinLock from VirtualConsoleAndreas Kling
VirtualConsole::m_lock was only used in a single place: on_tty_write() That function is already protected by a global lock, so this second lock served no purpose whatsoever.
2021-08-07Kernel: Move Mutex into Locking/Jean-Baptiste Boric
2021-08-06Kernel: Add convenience values to the Memory::Region::Access enumAndreas Kling
Instead of `Memory::Region::Access::Read | Memory::Region::AccessWrite` you can now say `Memory::Region::Access::ReadWrite`.
2021-08-06Kernel: Move Kernel/Memory/ code into Kernel::Memory namespaceAndreas Kling
2021-08-06Kernel: Fix handful of remaining "return -EFOO" mistakesAndreas Kling
Now that all KResult and KResultOr are used consistently throughout the kernel, it's no longer necessary to return negative error codes. However, we were still doing that in some places, so let's fix all those (bugs) by removing the minuses. :^)
2021-08-03Kernel: Convert MasterPTY creation to use DoubleBuffer factoryBrian Gianforcaro
In order to remove the public DoubleBuffer constructor, we need to convert the callers to the factory instead, allowing the caller to observe OOM.
2021-07-27Kernel: Modify the IOCTL API to return KResultBrian Gianforcaro
The kernel has been gradually moving towards KResult from just bare int's, this change migrates the IOCTL paths.
2021-07-27Kernel+LibC: Use argument for TIOCGPGRP ioctl valueBrian Gianforcaro
In preparation for modifying the Kernel IOCTL API to return KResult instead of int, we need to fix this ioctl to an argument to receive it's return value, instead of using the actual function return value.
2021-07-27Kernel: Utilize AK::Userspace<T> in the ioctl interfaceBrian Gianforcaro
It's easy to forget the responsibility of validating and safely copying kernel parameters in code that is far away from syscalls. ioctl's are one such example, and bugs there are just as dangerous as at the root syscall level. To avoid this case, utilize the AK::Userspace<T> template in the ioctl kernel interface so that implementors have no choice but to properly validate and copy ioctl pointer arguments.
2021-07-18Kernel: Rename Locker => MutexLockerAndreas Kling
2021-07-17Kernel: Rename Lock to MutexAndreas Kling
Let's be explicit about what kind of lock this is meant to be.
2021-07-11Kernel: Standardize the header include style to 'include <Kernel/...>'Brian Gianforcaro
This is the overwhelming standard in the project, but there were some cases in the kernel which were not following it, lets fix those cases!
2021-07-11Kernel: Remove unused header includes in TTY subtreeBrian Gianforcaro
2021-07-11Kernel: Make various T::class_name() and similar return StringViewAndreas Kling
Instead of returning char const*, we can also give you a StringView.
2021-07-03Kernel: Fix miscellaneous warnings when building with ClangDaniel Bertalan
These small changes fix the remaining warnings that come up during kernel compilation with Clang. These specific fixes were for benign things: unused lambda captures and braces around scalar initializers.
2021-06-25Kernel: Don't clear VirtualConsoles when initializingSahan Fernando
Instead of calling clear() for each virtual console we initialize, we only call clear() when activating it from ConsoleManagement.
2021-06-24Everywhere: Use nothrow new with `adopt_{ref,own}_if_nonnull`Daniel Bertalan
This commit converts naked `new`s to `AK::try_make` and `AK::try_create` wherever possible. If the called constructor is private, this can not be done, so we instead now use the standard-defined and compiler-agnostic `new (nothrow)`.
2021-06-24Kernel: Move special sections into Sections.hHendiadyoin1
This also removes a lot of CPU.h includes infavor for Sections.h
2021-06-24Kernel: Pull apart CPU.hHendiadyoin1
This does not add any functional changes