diff options
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Console.cpp | 4 | ||||
-rw-r--r-- | Kernel/Console.h | 4 | ||||
-rw-r--r-- | Kernel/KSyms.cpp | 2 | ||||
-rw-r--r-- | Kernel/Keyboard.cpp | 4 | ||||
-rw-r--r-- | Kernel/Keyboard.h | 4 | ||||
-rw-r--r-- | Kernel/MasterPTY.cpp | 4 | ||||
-rw-r--r-- | Kernel/MasterPTY.h | 4 | ||||
-rw-r--r-- | Kernel/PS2MouseDevice.cpp | 4 | ||||
-rw-r--r-- | Kernel/PS2MouseDevice.h | 4 | ||||
-rw-r--r-- | Kernel/Process.cpp | 8 | ||||
-rw-r--r-- | Kernel/TTY.cpp | 4 | ||||
-rw-r--r-- | Kernel/TTY.h | 4 | ||||
-rw-r--r-- | Kernel/kprintf.cpp | 3 |
13 files changed, 27 insertions, 26 deletions
diff --git a/Kernel/Console.cpp b/Kernel/Console.cpp index eece98ac26..4dbd2df5b4 100644 --- a/Kernel/Console.cpp +++ b/Kernel/Console.cpp @@ -28,14 +28,14 @@ bool Console::can_read(Process&) const return false; } -ssize_t Console::read(byte*, size_t) +ssize_t Console::read(Process&, byte*, size_t) { // FIXME: Implement reading from the console. // Maybe we could use a ring buffer for this device? return 0; } -ssize_t Console::write(const byte* data, size_t size) +ssize_t Console::write(Process&, const byte* data, size_t size) { if (!size) return 0; diff --git a/Kernel/Console.h b/Kernel/Console.h index d8bcc5a24d..fe4c3aea70 100644 --- a/Kernel/Console.h +++ b/Kernel/Console.h @@ -20,8 +20,8 @@ public: virtual bool can_read(Process&) const override; virtual bool can_write(Process&) const override { return true; } - virtual ssize_t read(byte* buffer, size_t size) override; - virtual ssize_t write(const byte* data, size_t size) override; + virtual ssize_t read(Process&, byte* buffer, size_t size) override; + virtual ssize_t write(Process&, const byte* data, size_t size) override; void setImplementation(ConsoleImplementation* implementation) { m_implementation = implementation; } diff --git a/Kernel/KSyms.cpp b/Kernel/KSyms.cpp index 3d0d014767..4168e8a43c 100644 --- a/Kernel/KSyms.cpp +++ b/Kernel/KSyms.cpp @@ -128,7 +128,7 @@ void load_ksyms() if (!descriptor) { kprintf("Failed to open /kernel.map\n"); } else { - auto buffer = descriptor->read_entire_file(); + auto buffer = descriptor->read_entire_file(*current); ASSERT(buffer); load_ksyms_from_data(buffer); } diff --git a/Kernel/Keyboard.cpp b/Kernel/Keyboard.cpp index f7c7b799e1..8aa18b32a3 100644 --- a/Kernel/Keyboard.cpp +++ b/Kernel/Keyboard.cpp @@ -119,7 +119,7 @@ bool Keyboard::can_read(Process&) const return !m_queue.is_empty(); } -ssize_t Keyboard::read(byte* buffer, size_t size) +ssize_t Keyboard::read(Process&, byte* buffer, size_t size) { ssize_t nread = 0; while ((size_t)nread < size) { @@ -130,7 +130,7 @@ ssize_t Keyboard::read(byte* buffer, size_t size) return nread; } -ssize_t Keyboard::write(const byte*, size_t) +ssize_t Keyboard::write(Process&, const byte*, size_t) { return 0; } diff --git a/Kernel/Keyboard.h b/Kernel/Keyboard.h index 63226e756d..7fab83bb44 100644 --- a/Kernel/Keyboard.h +++ b/Kernel/Keyboard.h @@ -37,8 +37,8 @@ private: virtual void handle_irq() override; // ^CharacterDevice - virtual ssize_t read(byte* buffer, size_t) override; - virtual ssize_t write(const byte* buffer, size_t) override; + virtual ssize_t read(Process&, byte* buffer, size_t) override; + virtual ssize_t write(Process&, const byte* buffer, size_t) override; virtual bool can_read(Process&) const override; virtual bool can_write(Process&) const override { return true; } diff --git a/Kernel/MasterPTY.cpp b/Kernel/MasterPTY.cpp index af1fd38227..138d9bc5b0 100644 --- a/Kernel/MasterPTY.cpp +++ b/Kernel/MasterPTY.cpp @@ -20,12 +20,12 @@ String MasterPTY::pts_name() const return buffer; } -ssize_t MasterPTY::read(byte* buffer, size_t size) +ssize_t MasterPTY::read(Process&, byte* buffer, size_t size) { return m_buffer.read(buffer, size); } -ssize_t MasterPTY::write(const byte* buffer, size_t size) +ssize_t MasterPTY::write(Process&, const byte* buffer, size_t size) { m_slave->on_master_write(buffer, size); return size; diff --git a/Kernel/MasterPTY.h b/Kernel/MasterPTY.h index deefe7793b..822764f57a 100644 --- a/Kernel/MasterPTY.h +++ b/Kernel/MasterPTY.h @@ -11,8 +11,8 @@ public: virtual ~MasterPTY() override; void set_slave(SlavePTY& slave) { m_slave = &slave; } - virtual ssize_t read(byte*, size_t) override; - virtual ssize_t write(const byte*, size_t) override; + virtual ssize_t read(Process&, byte*, size_t) override; + virtual ssize_t write(Process&, const byte*, size_t) override; virtual bool can_read(Process&) const override; virtual bool can_write(Process&) const override; virtual bool is_master_pty() const override { return true; } diff --git a/Kernel/PS2MouseDevice.cpp b/Kernel/PS2MouseDevice.cpp index d3c0b6f767..679410b72d 100644 --- a/Kernel/PS2MouseDevice.cpp +++ b/Kernel/PS2MouseDevice.cpp @@ -121,12 +121,12 @@ bool PS2MouseDevice::can_read(Process&) const return !m_buffer.is_empty(); } -ssize_t PS2MouseDevice::read(byte* buffer, size_t size) +ssize_t PS2MouseDevice::read(Process&, byte* buffer, size_t size) { return m_buffer.read(buffer, size); } -ssize_t PS2MouseDevice::write(const byte*, size_t) +ssize_t PS2MouseDevice::write(Process&, const byte*, size_t) { return 0; } diff --git a/Kernel/PS2MouseDevice.h b/Kernel/PS2MouseDevice.h index 1c066c6f89..2dfbb2c178 100644 --- a/Kernel/PS2MouseDevice.h +++ b/Kernel/PS2MouseDevice.h @@ -13,8 +13,8 @@ public: // ^CharacterDevice virtual bool can_read(Process&) const override; - virtual ssize_t read(byte* buffer, size_t) override; - virtual ssize_t write(const byte* buffer, size_t) override; + virtual ssize_t read(Process&, byte* buffer, size_t) override; + virtual ssize_t write(Process&, const byte* buffer, size_t) override; virtual bool can_write(Process&) const override { return true; } private: diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index c08f5176bc..556304e69e 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -1031,7 +1031,7 @@ ssize_t Process::sys$write(int fd, const void* data, size_t size) block(BlockedWrite); Scheduler::yield(); } - ssize_t rc = descriptor->write((const byte*)data + nwritten, size - nwritten); + ssize_t rc = descriptor->write(*this, (const byte*)data + nwritten, size - nwritten); #ifdef IO_DEBUG dbgprintf(" -> write returned %d\n", rc); #endif @@ -1051,7 +1051,7 @@ ssize_t Process::sys$write(int fd, const void* data, size_t size) nwritten += rc; } } else { - nwritten = descriptor->write((const byte*)data, size); + nwritten = descriptor->write(*this, (const byte*)data, size); } if (has_unmasked_pending_signals()) { block(BlockedSignal); @@ -1084,7 +1084,7 @@ ssize_t Process::sys$read(int fd, void* outbuf, size_t nread) return -EINTR; } } - nread = descriptor->read((byte*)outbuf, nread); + nread = descriptor->read(*this, (byte*)outbuf, nread); #ifdef DEBUG_IO dbgprintf("%s(%u) Process::sys$read: nread=%u\n", name().characters(), pid(), nread); #endif @@ -1232,7 +1232,7 @@ int Process::sys$readlink(const char* path, char* buffer, size_t size) if (!descriptor->metadata().isSymbolicLink()) return -EINVAL; - auto contents = descriptor->read_entire_file(); + auto contents = descriptor->read_entire_file(*this); if (!contents) return -EIO; // FIXME: Get a more detailed error from VFS. diff --git a/Kernel/TTY.cpp b/Kernel/TTY.cpp index cc36608329..808e2976f0 100644 --- a/Kernel/TTY.cpp +++ b/Kernel/TTY.cpp @@ -24,12 +24,12 @@ void TTY::set_default_termios() memcpy(m_termios.c_cc, default_cc, sizeof(default_cc)); } -ssize_t TTY::read(byte* buffer, size_t size) +ssize_t TTY::read(Process&, byte* buffer, size_t size) { return m_buffer.read(buffer, size); } -ssize_t TTY::write(const byte* buffer, size_t size) +ssize_t TTY::write(Process&, const byte* buffer, size_t size) { #ifdef TTY_DEBUG dbgprintf("TTY::write {%u} ", size); diff --git a/Kernel/TTY.h b/Kernel/TTY.h index b708bed1d9..abe06a9141 100644 --- a/Kernel/TTY.h +++ b/Kernel/TTY.h @@ -10,8 +10,8 @@ class TTY : public CharacterDevice { public: virtual ~TTY() override; - virtual ssize_t read(byte*, size_t) override; - virtual ssize_t write(const byte*, size_t) override; + virtual ssize_t read(Process&, byte*, size_t) override; + virtual ssize_t write(Process&, const byte*, size_t) override; virtual bool can_read(Process&) const override; virtual bool can_write(Process&) const override; virtual int ioctl(Process&, unsigned request, unsigned arg) override final; diff --git a/Kernel/kprintf.cpp b/Kernel/kprintf.cpp index 412f915ea6..a7de0d50dd 100644 --- a/Kernel/kprintf.cpp +++ b/Kernel/kprintf.cpp @@ -2,12 +2,13 @@ #include "Console.h" #include "IO.h" #include <stdarg.h> +#include "Process.h" #include <AK/Types.h> #include <AK/printf.cpp> static void console_putch(char*&, char ch) { - Console::the().write((byte*)&ch, 1); + Console::the().write(*current, (byte*)&ch, 1); } int kprintf(const char* fmt, ...) |