summaryrefslogtreecommitdiff
path: root/Kernel/TTY
AgeCommit message (Collapse)Author
2020-01-20Kernel: Make DoubleBuffer use a KBuffer instead of kmalloc()ingAndreas Kling
Background: DoubleBuffer is a handy buffer class in the kernel that allows you to keep writing to it from the "outside" while the "inside" reads from it. It's used for things like LocalSocket and TTY's. Internally, it has a read buffer and a write buffer, but the two will swap places when the read buffer is exhausted (by reading from it.) Before this patch, it was internally implemented as two Vector<u8> that we would swap between when the reader side had exhausted the data in the read buffer. Now instead we preallocate a large KBuffer (64KB*2) on DoubleBuffer construction and use that throughout its lifetime. This removes all the kmalloc heap traffic caused by DoubleBuffers :^)
2020-01-18Kernel: Move setting file flags and r/w mode to VFS::open()Sergey Bugaev
Previously, VFS::open() would only use the passed flags for permission checking purposes, and Process::sys$open() would set them on the created FileDescription explicitly. Now, they should be set by VFS::open() on any files being opened, including files that the kernel opens internally. This also lets us get rid of the explicit check for whether or not the returned FileDescription was a preopen fd, and in fact, fixes a bug where a read-only preopen fd without any other flags would be considered freshly opened (due to O_RDONLY being indistinguishable from 0) and granted a new set of flags.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2020-01-17Kernel: Move kernel above the 3GB virtual address markAndreas Kling
The kernel and its static data structures are no longer identity-mapped in the bottom 8MB of the address space, but instead move above 3GB. The first 8MB above 3GB are pseudo-identity-mapped to the bottom 8MB of the physical address space. But things don't have to stay this way! Thanks to Jesse who made an earlier attempt at this, it was really easy to get device drivers working once the page tables were in place! :^) Fixes #734.
2020-01-12Kernel: Require "tty" for ioctl() on TTY and MasterPTYAndreas Kling
SystemServer now pledges "tty" since it's used when spawning services.
2020-01-12Kernel: Put termios debug spam behind TTY_DEBUGAndreas Kling
2020-01-04Kernel: File::open() should apply r/w mode from the provided optionsAndreas Kling
This has been a FIXME for a long time. We now apply the provided read/write permissions to the constructed FileDescription when opening a File object via File::open().
2019-12-20VirtualConsole: use memmove for an overlapping copyjoshua stein
2019-12-09Kernel: Give PTY's *actually* unique major ID'sAndreas Kling
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!
2019-12-09TTY: Change the MasterPTY device major to not conflict with /dev/psauxAndreas Kling
The 1st master pseudoterminal had the same device ID as /dev/psaux which was caught by an assertion in Device VFS registration. This would cause us to overwrite the PS/2 mouse device registration which was definitely not good.
2019-11-27Kernel: Demangle userspace ELF symbols in backtracesAndreas Kling
Turns out we can use abi::__cxa_demangle() for this, and all we need to provide is sprintf(), realloc() and free(), so this patch exposes them. We now have fully demangled C++ backtraces :^)
2019-11-23Revert "Kernel: Move Kernel mapping to 0xc0000000"Andreas Kling
This reverts commit bd33c6627394b2166e1419965dd3b2d2dc0c401f. This broke the network card drivers, since they depended on kmalloc addresses being identity-mapped.
2019-11-22Kernel: Move Kernel mapping to 0xc0000000Jesse Buhagiar
The kernel is now no longer identity mapped to the bottom 8MiB of memory, and is now mapped at the higher address of `0xc0000000`. The lower ~1MiB of memory (from GRUB's mmap), however is still identity mapped to provide an easy way for the kernel to get physical pages for things such as DMA etc. These could later be mapped to the higher address too, as I'm not too sure how to go about doing this elegantly without a lot of address subtractions.
2019-11-06AK: Remove unused AK::not_implemented()Andreas Kling
Whatever this was supposed to be, it was ironically... not implemented.
2019-11-04Kernel: Make File's can_read/can_write take a const FileDescription&Andreas Kling
Asking a File if we could possibly read or write it will never mutate the asking FileDescription&, so it should be const.
2019-11-02TTY: Don't flush input on every characterAndreas Kling
Oops, we had a little mistake here. We were flushing whenever !NOFLSH, not just when generating a signal. This broke arrow keys in the terminal (you would only get A/B/C/D when pressing arrow keys, instead of the full escape sequence.)
2019-11-01TTY: Flush input on signal character.Drew Stratford
We now flush the input when we recieve a signal character. This can be disabled using the newly implemented NOFLSH attribute.
2019-10-30TTY: Properly implement echo in VirtualConsole.Drew Stratford
VirtualConsole::echo now actually echoes characters instead of doing nothing.
2019-10-24TTY: MasterPTY should fail to ioctl() if slave is goneAndreas Kling
Just fail with EIO in that case.
2019-10-24TTY: Forward TIOCGPGRP from MasterPTY to SlavePTYAndreas Kling
This makes tcgetpgrp() on a master PTY return the PGID of the slave PTY which is probably what you are looking for. I'm not sure how correct or standardized this is, but it makes sense to me right now.
2019-10-20TTY: Implement Canonical mode and basic echoing.Drew Stratford
The TTY driver now respects the ICANON flag, enabling basic line editing like VKILL, VERASE, VEOF and VWERASE. Additionally, ICANON is now set by default. Basic echoing has can now be enabled via the ECHO flag, though more complicated echoing like ECHOCTL or ECHONL has not been implemented.
2019-10-18Revert "Kernel: Make DoubleBuffer use a KBuffer instead of kmalloc()ing"Andreas Kling
This reverts commit 1cca5142afbd76833deedfdb238230ac53424855. This appears to be causing intermittent triple-faults and I don't know why yet, so I'll just revert it to keep the tree in decent shape.
2019-10-18Kernel: Make DoubleBuffer use a KBuffer instead of kmalloc()ingAndreas Kling
Background: DoubleBuffer is a handy buffer class in the kernel that allows you to keep writing to it from the "outside" while the "inside" reads from it. It's used for things like LocalSocket and PTY's. Internally, it has a read buffer and a write buffer, but the two will swap places when the read buffer is exhausted (by reading from it.) Before this patch, it was internally implemented as two Vector<u8> that we would swap between when the reader side had exhausted the data in the read buffer. Now instead we preallocate a large KBuffer (64KB*2) on DoubleBuffer construction and use that throughout its lifetime. This removes all the kmalloc heap traffic caused by DoubleBuffers :^)
2019-10-18Kernel: VirtualConsole can use kmalloc_eternal() for permanent stuffAndreas Kling
Less pressure on kmalloc heap.
2019-10-18Kernel: Keep TTY names in character buffers instead of StringsAndreas Kling
Just going over some little unnecessary little kmalloc allocations.
2019-09-16Kernel: Move kmalloc() into a Kernel/Heap/ directoryAndreas Kling
2019-09-06AK: Rename <AK/AKString.h> to <AK/String.h>Andreas Kling
This was a workaround to be able to build on case-insensitive file systems where it might get confused about <string.h> vs <String.h>. Let's just not support building that way, so String.h can have an objectively nicer name. :^)
2019-08-23Kernel: Give each TTY 1 KB of input bufferAndreas Kling
This papers over an immediate issue where pseudoterminals would choke on more than 16 characters of pasted input in the GUI terminal. Longer-term we should find a more elegant solution than using a static size CircularQueue for this.
2019-08-23Kernel: Use IteratorDecision in Process::for_each_in_pgrp()Andreas Kling
2019-08-18Kernel: Disable VGA console in graphical modeConrad Pankoff
2019-08-17DevPtsFS: Do not assume there is one of itSergey Bugaev
Unfortunately, that also means it can no longer inherit from SynthFS.
2019-08-12Kernel: Use a CircularQueue for input rather than a DoubleBufferConrad Pankoff
TTY::emit is called from an IRQ handler, and is used to push input data into a buffer for later retrieval. Previously this was using DoubleBuffer, but that class wants to take a lock. Our lock code wants to make sure interrupts are enabled, but they're disabled while an IRQ handler is running. This made the kernel sad, but this CircularQueue cheers it up by avoiding the lock requirement completely.
2019-08-12VirtualConsole: Only consume data from key-down eventsConrad Pankoff
2019-08-12Kernel: Restore alt+n hijacking for virtual console switchingConrad Pankoff
2019-08-11Kernel: Customize absolute_path() for more file typesSergey Bugaev
2019-08-11FileDescription: Disallow construction with a null FileAndreas Kling
It's not valid for a FileDescription to not have a file, so let's disallow it by taking a File& (or FIFO&) in the constructor.
2019-07-03AK: Rename the common integer typedefs to make it obvious what they are.Andreas Kling
These types can be picked up by including <AK/Types.h>: * u8, u16, u32, u64 (unsigned) * i8, i16, i32, i64 (signed)
2019-06-21Change "retain" to "ref" in various comments.Andreas Kling
2019-06-21AK: Rename RetainPtr => RefPtr and Retained => NonnullRefPtr.Andreas Kling
2019-06-21AK: Rename Retainable => RefCounted.Andreas Kling
(And various related renames that go along with it.)
2019-06-13Kernel: Rename "descriptor" to "description" where appropriate.Andreas Kling
Now that FileDescription is called that, variables of that type should not be called "descriptor". This is kinda wordy but we'll get used to it.
2019-06-07Kernel: Move i386.{cpp,h} => Arch/i386/CPU.{cpp,h}Andreas Kling
There's a ton of work that would need to be done before we could spin up on another architecture, but let's at least try to separate things out a bit.
2019-06-07Meta: Tweak .clang-format to not wrap braces after enums.Andreas Kling
2019-06-07Kernel: Run clang-format on everything.Andreas Kling
2019-06-07Kernel: Rename FileDescriptor to FileDescription.Andreas Kling
After reading a bunch of POSIX specs, I've learned that a file descriptor is the number that refers to a file description, not the description itself. So this patch renames FileDescriptor to FileDescription, and Process now has FileDescription* file_description(int fd).
2019-06-06TTY: Generate SIGTSTP if cc[VSUSP] is pressed.Andreas Kling
Fixes #207.
2019-06-01Kernel: Make File::absolute_path() const.Andreas Kling
2019-05-31Update Badge<T> instantiations to simply be {}.Andreas Kling
2019-05-28Add clang-format fileRobin Burchell
Also run it across the whole tree to get everything using the One True Style. We don't yet run this in an automated fashion as it's a little slow, but there is a snippet to do so in makeall.sh.
2019-05-08Replace various copies of parse_uint(String) with String::to_uint().Andreas Kling